LEGO Mindstorms Robotic Invention System Barb Ericson ericsoncc
LEGO Mindstorms Robotic Invention System Barb Ericson ericson@cc. gatech. edu Georgia Institute of Technology
What is it? • A kit for creating and programming robots built with LEGOs
What is in it? • 717 LEGO elements – – – One RCX programmable brick 2 motors 2 push sensors 1 light sensor Infrared transmitter for transferring the programs • A Constructopedia book with plans for 3 robots and many variations on them • CD with video on getting started and visual programming environment (RCX code) – 9 robots total
What else do you need? • 6 AA batteries • Computer – Windows 98/Me/XP – Pentium II 233 MHz – 32 MB RAM – 115 MB Disk Space – USB Port (for the infrared transmitter)
What else might you want? • Plastic storage containers – For storing built robots – And for sorting parts better • Ultimate Accessory Kit - $50 – 45 LEGO pieces including • • • 1 remote control 1 touch sensor 1 rotation sensor 1 lamp 1 Constructopedia
More Sensors • http: //www. legoeducationstore. com/catalo g. cfm? dest=itempg&itemid=920&secid=9& linkon=subsection&linkid=45 Light Angle (Rotation) Touch Temp Touch
DCP Sensors • http: //www. legoeducationstore. com/catalo g. cfm? dest=itempg&itemid=922&secid=9& linkon=subsection&linkid=45
What else might you want? • Vision Command - $100 – A video camera • • • 30 frames per second 352 by 288 color 145 LEGO elements USB connection Built-in microphone Vision recognition software • Or get just the camera and USB cable for $39. 00 at LEGO Education Store
What does it cost? • About $200 • Buy at – Toys R Us – Shop. lego. com – Amazon. com – Wallmart. com – http: //legomindstorms 2. 0. hobbytron. net/robotl egosub. html? source=1359 – Ebay. com
What can you do with it? • Use it with RCX code or Robolab (visual programming) – To teach about commands, programs, iteration, conditionals, and variables – Without worrying about syntax • Use it with le. JOS (Java) – To teach about commands, programs, iteration, conditionals, and variables – Arrays, strings, recursion, listeners, static – Using Java syntax
Programming your Robot • Click the Program button in the main menu
Pick the Robot • Pick the robot to program. If you are using your own design pick “Freestyle”.
Create a Program using RCX code • Big Blocks are shown for a particular robot • Click and drag them to make a program – They will snap into place • You can save the program using the File menu – This will name your program
Download your Program • • Turn on the RCX (On. Off button) Plug the IR Tower into your computer Put the RCX near the IR Tower Click the “Download” button – The default is to download to slot 5 – You can change this by clicking on “Settings” • When the download is finished the RCX will play a short tune – It displays dots during the download
Running the Program • Two ways to run – Click the Run button on the RCX – Or click the Run button on the screen • Stopping the program – Click the Run button again on the RCX – Or click the Stop button on the screen
Modify a Block • Click on the edit tab at the right edge of the block • You can change the duration of commands – Use the arrow key to use preset values – Or type a value in the textbox
Robot Challenge • Make your robot go forward for 2 seconds • Make your robot turn right for 1. 5 seconds • Make your robot go backwards for 3 seconds • Make your robot spin left for 1. 5 seconds • Save your program using the File menu
Getting More Information • Click on Help • Click on What’s this? • The cursor will show What’s this? with an arrow • Click on something you want more information about – Like a block – Or a menu item
Robot Challenge • Use the help to find out the difference between turn left and spin left • Use the help to figure out what a Dance block will do • Use the edit tab to try out the Dance block – Make sure your robot is on and near the IR tower
Using the Sensors • Click a Touch Sensor on the left and position it on the right – Pick the input port attached to your sensor – Click next • Pick when to respond – On press, release, or click (press and release) – Click next • Click “Try It” to try it or “Done”
Handling a Sensor Event • Add command blocks after the if sensor event block – These actions will happen when that sensor event happens – Like when the touch sensor is pressed – Or when the light sensor’s value is > or < some amount
Robot Challenge • Make your robot go forward for 10 seconds • If your robot’s touch sensor is pressed backup for 1 second and spin right • Set up items to block your robot and try it
Adding Iteration • Use Repeat Blocks to add iteration (looping) • You can change the number of iterations • You can repeat a group of commands
Conditionals • Add a test – Do one thing if the test is true • Like turn left – Do something else if the test is false • Like turn right
Variables • You can create new variables – freq • And use them in other blocks – Add to them – Subtract from them – Multiply them – Divide them
Create New Blocks • You can create new blocks using My Blocks – Name the block – Add other blocks to it – You can collapse the interior commands • Click on upper left square
Small Blocks • Finer control of robot • Big Blocks are made up of small block commands • Click on the top left box to open a big block – And see the internal small blocks
Where to get help? • http: //mindstorms. lego. com – Main web site • Books – at LEGO Education Store – Building Robots with LEGO Mindstorms – Creative Projects with LEGO Mindstorms – LEGO Mindstorms: RIS 2 Projects
Project Ideas • Anders Project ideas (scanner, fan) – http: //www. norgesgade 14. dk/lego. Sider/mindstorm_en. html • Andy’s Page (chess playing robot) – http: //www. artilect. co. uk/lego/default. asp? page=Chess • Buick Music Study (Play MIDI or WAV files) – http: //www. aga. it/%7 Eguy/lego/bms. html • Joe’s Nagata’s Mindstorms Gallery (vehicles) – http: //homepage 3. nifty. com/mindstorms/ – http: //members. at. infoseek. co. jp/Milano/studio 1. html (movies) • Mario Ferrari’s Web Pages (piano player, skier, etc) – http: //www. marioferrari. org/lego_mindstorm. html
Using Java with LEGO Robots • Install le. JOS (the Java Operating System) – Download from http: //lejos. sourceforge. net/faq. html • Set the system variables • Plug in the IR Tower to the top USB port • Download the firmware using a command prompt – lejosfirmdl
Setting System Variables • Create new System Variables – LEJOS_HOME variable to the directory where le. JOS is installed – RCXTTY=USB • Add to the PATH variable – The Java SDK bin directory – ; %LEJOS_HOME%bin • Add to the CLASSPATH variable – ; %LEJOS_HOME%/lib/classes. jar; %LEJOS_HOME% /lib/pcrcxcomm. jar
Using le. JOS • Import the classes in le. JOS – import josx. platform. rcx. *; • Compile for Java 1. 1 using – lejosjc. bat Class. java • Link together an executable – lejoslink. bat -o Class. bin Class • Download the executable to the RCX – lejosdl. bat Class. bin
LCD Control
Motor Class – 3 objects are available as public static (class) variables • Motor. A, Motor. B, and Motor. C – You make the motor go forward, backward, stop (brake), and float to a stop – When you start a motor forward it will keep going until you tell it to stop or float to a stop. – Use Thread. sleep(num. Milliseconds) to control how long the motor is moving – Control how fast the motor moves with • set. Power(num) with num from 0 to 7 (fastest)
Motor Test • Make both A and C motors go forward at power 7 for 1 second • Stop for 1 second • Have both motors go forward at power 2 for 3 seconds • Float to a stop
le. JOS Resources • Download from – http: //lejos. sourceforge. net/ • Tutorial at – http: //lejos. sourceforge. net/tutorial/ • Discussion at – http: //sourceforge. net/mailarchive/forum. php? f orum_id=552 • Books – http: //lejos. sourceforge. net/books. html
FIRST LEGO League • Robotics competition for a team of kids (ages 9 -14) – Up to 10 kids on a team • Register by Sept 30 th – Work for 8 weeks on a challenge • New one each year – Compete at tournaments Nov – Dec • Georgia Tech hosted one Jan 15, 2005 – Cost (about $600 per team)
- Slides: 37