introduction to the lego nxt
play

Introduction to the Lego NXT Vasilis Spiliopoulos < - PowerPoint PPT Presentation

Introduction to the Lego NXT Vasilis Spiliopoulos < ssssts > (special thanks to Andreas Sandberg) What is Lego Mindstorm? A kit containing: A Lego NXT computer


  1. Introduction to the Lego NXT Vasilis Spiliopoulos < ✈❛s✐❧❡✐♦s✳s♣✐❧✐♦♣♦✉❧♦s❅✐t✳✉✉✳s❡ > (special thanks to Andreas Sandberg)

  2. What is Lego Mindstorm? A kit containing: ◮ A Lego NXT computer ◮ 3 motors ◮ Touch sensor ◮ Light sensor ◮ Sound sensor ◮ Ultrasonic range sensor ◮ Lots of Lego bricks ◮ . . . and plenty of fun!

  3. The NXT Hardware overview USB Bluetooth Display IO connectors Sound Main CPU Atmel ARM7 JTAG IO Processor JTAG Atmel AVR

  4. The NXT CPUs ◮ The main CPU (AT91SAM7S256) is an ARM7TDMI based µ controller from Atmel. ◮ 32-bit RISC ◮ Running at 48 MHz ◮ 256 KiB Flash ◮ 64 KiB RAM ◮ IO coprocessor (Atmel ATmega 48) ◮ Running at 8 MHz ◮ 8-bit RISC (AVR) ◮ 4 KiB Flash ◮ 512 B RAM ◮ Samples analog sensors with @ 333 Hz ◮ Controls motors

  5. The NXT CPUs ◮ The main CPU (AT91SAM7S256) is an ARM7TDMI based µ controller from Atmel. ◮ 32-bit RISC ◮ Running at 48 MHz ◮ 256 KiB Flash ◮ 64 KiB RAM ◮ IO coprocessor (Atmel ATmega 48) ◮ Running at 8 MHz ◮ 8-bit RISC (AVR) ◮ 4 KiB Flash ◮ 512 B RAM ◮ Samples analog sensors with @ 333 Hz ◮ Controls motors

  6. The NXT External communication ◮ Bluetooth ◮ Only supports the serial profile ( ≈ 200 kb/s). ◮ Requires that devices have been paired . ◮ Useful for wireless debugging or robot cooperation. ◮ May sometimes be used to upload software to the NXT. ◮ USB ◮ Normally used for software upload ◮ Can be used for debugging ◮ Firmware uploading ◮ I 2 C ◮ Used for low-speed (9600 b/s) serial communication with sensors. ◮ RS485 ◮ High-speed ( ≈ 1 Mb/s) serial communication. ◮ Can be used for wired communication between robots. ◮ Not used in default firmware.

  7. The NXT External communication ◮ Bluetooth ◮ Only supports the serial profile ( ≈ 200 kb/s). ◮ Requires that devices have been paired . ◮ Useful for wireless debugging or robot cooperation. ◮ May sometimes be used to upload software to the NXT. ◮ USB ◮ Normally used for software upload ◮ Can be used for debugging ◮ Firmware uploading ◮ I 2 C ◮ Used for low-speed (9600 b/s) serial communication with sensors. ◮ RS485 ◮ High-speed ( ≈ 1 Mb/s) serial communication. ◮ Can be used for wired communication between robots. ◮ Not used in default firmware.

  8. The NXT External communication ◮ Bluetooth ◮ Only supports the serial profile ( ≈ 200 kb/s). ◮ Requires that devices have been paired . ◮ Useful for wireless debugging or robot cooperation. ◮ May sometimes be used to upload software to the NXT. ◮ USB ◮ Normally used for software upload ◮ Can be used for debugging ◮ Firmware uploading ◮ I 2 C ◮ Used for low-speed (9600 b/s) serial communication with sensors. ◮ RS485 ◮ High-speed ( ≈ 1 Mb/s) serial communication. ◮ Can be used for wired communication between robots. ◮ Not used in default firmware.

  9. The NXT External communication ◮ Bluetooth ◮ Only supports the serial profile ( ≈ 200 kb/s). ◮ Requires that devices have been paired . ◮ Useful for wireless debugging or robot cooperation. ◮ May sometimes be used to upload software to the NXT. ◮ USB ◮ Normally used for software upload ◮ Can be used for debugging ◮ Firmware uploading ◮ I 2 C ◮ Used for low-speed (9600 b/s) serial communication with sensors. ◮ RS485 ◮ High-speed ( ≈ 1 Mb/s) serial communication. ◮ Can be used for wired communication between robots. ◮ Not used in default firmware.

  10. Motors ◮ Included motors linear and not step motors. ◮ Speed is controlled using Pulse Width Modulation . ◮ The AVR µ controller handles PWM generation. ◮ Feedback is provided by a quadrature encoder attached to the motor. ◮ Allows detection of rotation direction and amount.

  11. Sensors Light sensor ◮ Simple photo-sensor that detects the strength of the incoming light. ◮ Has a LED mounted to provide illumination. ◮ Analog sensor

  12. Sensors Touch sensor ◮ Just a button with some Lego extras for mounting. Nothing fancy. ◮ Analog sensor

  13. Sensors Sound sensor ◮ Measures sound intensity . ◮ Can be run in either DB or DBA mode. ◮ Analog sensor

  14. Sensors Ultrasonic range sensor ◮ “Smart” sensor – uses I 2 C for communication. ◮ Detects distance to objects using sound pulses.

  15. Developing for the NXT Overview ◮ NXT-G ◮ Bundled with the NXT. ◮ Graphical drag and drop flowchart programming. ◮ Doesn’t work for large applications, unstable. ◮ Requires Windows. ◮ RobotC ◮ Commercial, but the department has licenses. ◮ C-based language, but not “vanilla” C. ◮ Has an integrated development environment with debugging. ◮ Requires Windows. ◮ Not eXactly C ◮ Has an IDE (Bricx Command Center) ◮ Debugger support ◮ Supports at least Windows and OSX ◮ No releases in a long time – development has stagnated?

  16. Developing for the NXT Overview ◮ NXT-G ◮ Bundled with the NXT. ◮ Graphical drag and drop flowchart programming. ◮ Doesn’t work for large applications, unstable. ◮ Requires Windows. ◮ RobotC ◮ Commercial, but the department has licenses. ◮ C-based language, but not “vanilla” C. ◮ Has an integrated development environment with debugging. ◮ Requires Windows. ◮ Not eXactly C ◮ Has an IDE (Bricx Command Center) ◮ Debugger support ◮ Supports at least Windows and OSX ◮ No releases in a long time – development has stagnated?

  17. Developing for the NXT Overview ◮ NXT-G ◮ Bundled with the NXT. ◮ Graphical drag and drop flowchart programming. ◮ Doesn’t work for large applications, unstable. ◮ Requires Windows. ◮ RobotC ◮ Commercial, but the department has licenses. ◮ C-based language, but not “vanilla” C. ◮ Has an integrated development environment with debugging. ◮ Requires Windows. ◮ Not eXactly C ◮ Has an IDE (Bricx Command Center) ◮ Debugger support ◮ Supports at least Windows and OSX ◮ No releases in a long time – development has stagnated?

  18. Developing for the NXT Overview (contd.) ◮ nxtOSEK ◮ GCC development environment (real C!) ◮ Uses some Japanese embedded OS used in the automotive industry. ◮ C/C++ library for accessing IO devices. ◮ LEJOS ◮ Mini-Java implementation. ◮ Uses the standard Java compiler, but a limited class library. ◮ Has a plugin for Eclipse. ◮ Works on most operating systems (even Solaris 1 ) ◮ Somewhat limited debugging capabilities. 1 Requires patching and a sacrifice to Cthulhu.

  19. Developing for the NXT Overview (contd.) ◮ nxtOSEK ◮ GCC development environment (real C!) ◮ Uses some Japanese embedded OS used in the automotive industry. ◮ C/C++ library for accessing IO devices. ◮ LEJOS ◮ Mini-Java implementation. ◮ Uses the standard Java compiler, but a limited class library. ◮ Has a plugin for Eclipse. ◮ Works on most operating systems (even Solaris 1 ) ◮ Somewhat limited debugging capabilities. 1 Requires patching and a sacrifice to Cthulhu.

  20. Remote controlling Overview ◮ The NXT can be controlled from a computer (or another NXT!). ◮ Libraries exist for most common programming languages. ◮ Matlab ◮ Python ◮ Ruby ◮ Java ◮ . . .

  21. LEJOS Overview ◮ Requires custom firmware with a small Java Virtual Machine ◮ Supports standard Java threads ◮ Almost the same code can used both on the NXT and on a computer controlling the NXT ◮ Supports Bluetooth and for all communication with the NXT

  22. LEJOS Bluetooth – practical matters ◮ Bluetooth communication requires pairing to prevent unauthorized access to wireless devices ◮ Process is OS dependent ◮ Requires a PIN code, the default one is ’1234’ ◮ When communicating with the NXT you should normally specify the name of the target device ◮ Unless your NXT has a ’good’ name, rename it to something unique

  23. LEJOS Bluetooth – practical matters ◮ Bluetooth communication requires pairing to prevent unauthorized access to wireless devices ◮ Process is OS dependent ◮ Requires a PIN code, the default one is ’1234’ ◮ When communicating with the NXT you should normally specify the name of the target device ◮ Unless your NXT has a ’good’ name, rename it to something unique

  24. Compiling and linking nxjc RobotTest . java Compiles the RobotTest.java class and all its dependencies, similar to the javac command. n x j l i n k − o RobotTest . nxj RobotTest Packages the class RobotTest and all its dependencies, including the class library. Similar to the jar tool in some ways. nxjupload − b − r RobotTest . nxj Uploads the packages to the NXT using Bluetooth.

  25. Compiling and linking nxjc RobotTest . java Compiles the RobotTest.java class and all its dependencies, similar to the javac command. n x j l i n k − o RobotTest . nxj RobotTest Packages the class RobotTest and all its dependencies, including the class library. Similar to the jar tool in some ways. nxjupload − b − r RobotTest . nxj Uploads the packages to the NXT using Bluetooth.

  26. Compiling and linking nxjc RobotTest . java Compiles the RobotTest.java class and all its dependencies, similar to the javac command. n x j l i n k − o RobotTest . nxj RobotTest Packages the class RobotTest and all its dependencies, including the class library. Similar to the jar tool in some ways. nxjupload − b − r RobotTest . nxj Uploads the packages to the NXT using Bluetooth.

Recommend


More recommend