MindStorms Robot - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

MindStorms Robot

Description:

Learning to Program with Robots – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 27
Provided by: gate311
Category:

less

Transcript and Presenter's Notes

Title: MindStorms Robot


1
MindStorms Robot
Learning to Program with Robots
2
What is MindStorm Robots?
  • Designed to introduce students to programming,
    logical thinking, teamwork, and project-based
    learning

3
Lego Robots
4
Robot Construction
  • Choose your robot design from the following
    list
  • Hank
  • Minerva
  • Mushi Mushi 7
  • Trusty
  • TankBot

5
Robot Construction
Steps
  • Choose a partner to work together as a team.
  • Choose your robot design.
  • Establish team member roles.
  • Inventory Mind Storm tackle box parts placement.
  • Create your robot according to the design plan.

6
Steps
Robot Construction
  1. Examine Course Rules
  2. Program Mind Storm Robot to run course.
  3. Complete test run of course.
  4. Finalize Mind Storm Robot programming.

7
Course Rules
8
TankBot Demonstration
9
TankBot Demonstration
Peg Connector (J)
10
Full Bushing
TankBot Demonstration
24 tooth gear wheel
11
2x8 plate with holes
TankBot Demonstration
2x4 plate w/holes
1x4 Plate
12
Gear Motor
24 tooth gear wheel
TankBot Demonstration
2x8 plate w/holes
2x2 brick
13
RCX
Connector Pegs
TankBot Demonstration
1x8 brick
1.5 Connection Pegs
14
Full Bushings
TankBot Demonstration
16 tooth gear wheel
Rims
Caterpillar Belts
Connecting leads
15
Programming
  • The key to programming your Robot is to determine
    how to solve the problem followed by writing down
    the logical steps to accomplish your goal.

16
Programming the Robot Constructors
  • import josx.platform.rcx.
  • public class Robot
  • ///////////// fields //////////////
  • private Motor leftMotor Motor.A
  • private Motor rightMotor Motor.C
  • private int powerLevel 7
  • ///////////// Constructor ////////
  • / Constructor take takes no
  • arguments
  • /
  • public Robot()
  • /
  • Constructor that takes the left
  • motor and right motor
  • _at_param left the left motor
  • _at_param right the right motor
  • /
  • public Robot(Motor left, Motor right)
  • leftMotor left
  • rightMotor right

17
Method to Move Robot Forward
  • Method to make the robot go forward for the
    passed amount of time (in milliseconds)
  • public void forward(int numMillisecs)
  • throws Exception
  • leftMotor.setPower(powerLevel)
  • rightMotor.setPower(powerLevel)
  • leftMotor.forward()
  • rightMotor.forward()
  • Thread.sleep(numMillisecs)
  • leftMotor.flt()
  • rightMotor.flt()

18
Method to Move Robot Backwards
  • Method to make the robot go backward for the
    passed amount of time (in milli-seconds)
  • public void backward(int numMillisecs)
  • throws Exception
  • leftMotor.setPower(powerLevel)
  • rightMotor.setPower(powerLevel)
  • leftMotor.backward()
  • rightMotor.backward()
  • Thread.sleep(numMillisecs)
  • leftMotor.flt()
  • rightMotor.flt()

19
Method to Turn Robot to the Right
  • public void turnRight(int numMillisecs)
  • throws Exception
  • leftMotor.setPower(powerLevel)
  • leftMotor.forward()
  • rightMotor.stop()
  • Thread.sleep(numMillisecs)
  • leftMotor.flt()

Method to turn the robot to the right for the
passed number of milliseconds_at_parm numMillisecs
the number of milliseconds to turn
20
Method to Spin the Robot to the Right
  • Method to spin the robot right
  • _at_param numMills the number of
  • milliseconds
  • public void spinRight(int numMills)
  • throws Exception
  • leftMotor.setPower(powerLevel)
  • leftMotor.forward()
  • rightMotor.setPower(powerLevel)
  • rightMotor.backward()
  • Thread.sleep(numMills)
  • rightMotor.flt()
  • leftMotor.flt()

21
Method to Spin Robot to the Left
  • Method to spin the robot left
  • _at_param numMills the number of
  • milliseconds
  • public void spinLeft(int numMills)
  • throws Exception
  • rightMotor.setPower(powerLevel)
  • rightMotor.forward()
  • leftMotor.setPower(powerLevel)
  • leftMotor.backward()
  • Thread.sleep(numMills)
  • rightMotor.flt()
  • leftMotor.flt()

22
Method to Turn Robot to the Left
  • public void turnLeft(int numMillisecs)
  • throws Exception
  • rightMotor.setPower(powerLevel)
  • rightMotor.forward()
  • leftMotor.stop()
  • Thread.sleep(numMillisecs)
  • rightMotor.flt()

Method to turn the robot to the left for the
passed number of milliseconds_at_ param numMillisecs
the number of milliseconds
23
Method to Zig-Zag the Robot
  • Method to zig-zag the robot turn left and then
    right _at_param numMills the number milliseconds
  • public void zigZag(int numMills)
  • throws Exception
  • leftMotor.setPower(powerLevel)
  • rightMotor.setPower(powerLevel)
  • leftMotor.forward()
  • Thread.sleep(numMills)
  • rightMotor.forward()
  • Thread.sleep(numMills)
  • leftMotor.flt()
  • rightMotor.flt()

24
Main Method
  • public static void main(String args)
  • try
  • Robot robot new Robot()
  • robot.forward(3000)
  • robot.spinLeft(3000)
  • TextLCD.print("done")
  • catch (Exception ex)
  • TextLCD.print ("error")

25
Download Your Program to the RCX
Infra-Red receiver must face IR Tower
26
Have Fun!
Write a Comment
User Comments (0)
About PowerShow.com