Programming forLego® Mindstorms™using Eclipseto take you back to your childhood!<br />Benjamin CabéOct 28th, 2009<br />
Agenda<br />The Mindstorms NXT brick<br />The LeJOS VM<br />Eclipse + Mindstorms = FUN!<br />Implementing an RSE connector...
The NXT brick<br />32-bit ARM7 processor @48MHz<br />256kB of Flash<br />64kB of RAM<br />100x64 pixel LCD display<br />US...
4 input ports<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
3 output ports (motors)<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
LeJOS NXJ VM<br />A tiny (10kb) but stillcool Java VM<br />Threads / Synchronization<br />Exceptions<br />Most of the java...
LeJOS NXJ Eclipse plug-in<br />Useful to upload firmware and/or programs to the brick<br />Not much integrated in the IDE…...
TM/RSE hacking<br />LeJOS NXJ comes with APIs to :<br />List/get/send files<br />Execute programs<br />Get sensor states<b...
Brief RSE introduction<br />A frameworkat Eclipse to connect to remotesystems and provide:<br />remote file systems throug...
TM/RSE hacking (2)<br />In a couple of hours:<br />A new &apos;LeJOS&apos; system is available<br />An RSE file &apos;subs...
TM/RSE hacking (3)<br />Very straightforward 1..1 mapping between RSE and LEJOS APIs<br />Example: LejosRemoteFile impleme...
Let’stoy a cool sonar!<br />Follows a closed track<br />Scans the interior of the track with the ultrasonic sensor<br />Wr...
Robot behavior<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
Robot Java program<br />publicstaticvoid main(String[] args) {<br />  tachoNav= new TachoNavigator(5.6f, 11.5f, Motor.A, M...
Display captured data<br />In an Eclipse editor associated to .radar files<br />Parse binary files<br />Process signal <br...
©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
17<br />State machines modeling<br />LeJOS comes with an event-based robotics API, remember?<br />Eclipse has a bunch of c...
18<br />LeJOS Visual Development Toolkit<br />A state machine framework on top of LeJOS<br />A GMF editor<br />Xpandtempla...
A state machine diagram…<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
Questions?<br />Benjamin Cabé<br />BCabe@sierrawireless.com<br />
Upcoming SlideShare
Loading in …5
×

Programming for Lego Mindstorms using Eclipse to take you back to your childhood!

5,934
-1

Published on

Did the little boy -or girl- in you ever wondered if Eclipse was cool enough to develop code for Lego Mindstorms?
The answer is definitively yes, and this talk will show you how fun it is to use Eclipse technologies dedicated to embedded development (CDT, TM, ...) to create the brain of your future cybernetic buddy!

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,934
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
118
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Programming for Lego Mindstorms using Eclipse to take you back to your childhood!

  1. 1. Programming forLego® Mindstorms™using Eclipseto take you back to your childhood!<br />Benjamin CabéOct 28th, 2009<br />
  2. 2. Agenda<br />The Mindstorms NXT brick<br />The LeJOS VM<br />Eclipse + Mindstorms = FUN!<br />Implementing an RSE connector<br />Data visualization inside an Eclipse editor<br />State machines modeling and code generation<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  3. 3. The NXT brick<br />32-bit ARM7 processor @48MHz<br />256kB of Flash<br />64kB of RAM<br />100x64 pixel LCD display<br />USB 2.0<br />Bluetooth<br />Open Source firmware!<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  4. 4. 4 input ports<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  5. 5. 3 output ports (motors)<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  6. 6. LeJOS NXJ VM<br />A tiny (10kb) but stillcool Java VM<br />Threads / Synchronization<br />Exceptions<br />Most of the java.lang, java.util and java.io classes<br />Generics, enums, « for each » loops<br />A “robotics”, event-based, API<br />Open Source!<br />Limitations<br />No GarbageCollector<br />No switch()<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  7. 7. LeJOS NXJ Eclipse plug-in<br />Useful to upload firmware and/or programs to the brick<br />Not much integrated in the IDE…<br /> … how about leveraging DSDP/TM?! <br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  8. 8. TM/RSE hacking<br />LeJOS NXJ comes with APIs to :<br />List/get/send files<br />Execute programs<br />Get sensor states<br />… it should be possible to define an RSE connector and a file subsystem…!<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  9. 9. Brief RSE introduction<br />A frameworkat Eclipse to connect to remotesystems and provide:<br />remote file systems through SSH, FTP, a dedicated agent, or whatever<br />remote shell access<br />remote process monitoring<br />remote debugging (gdb)<br />It comeswithgeneric, reusable, UI<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  10. 10. TM/RSE hacking (2)<br />In a couple of hours:<br />A new &apos;LeJOS&apos; system is available<br />An RSE file &apos;subsystem&apos; allows to:<br />Browse the brick&apos;s filesystem<br />Remotely execute programs<br />Another subystem could bewritten to retrieve sensors values<br />Nota: Communication with the brick can be done using either BT or USB<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  11. 11. TM/RSE hacking (3)<br />Very straightforward 1..1 mapping between RSE and LEJOS APIs<br />Example: LejosRemoteFile implementation<br />publicvoid launch() throwsIOException {<br /> LejosConnectorService connector = (LejosConnectorService) getParentRemoteFileSubSystem()<br /> .getConnectorService();<br /> connector.getComm().startProgram(_hostFile.getName());<br />}<br />RSE<br />LEJOS<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  12. 12. Let’stoy a cool sonar!<br />Follows a closed track<br />Scans the interior of the track with the ultrasonic sensor<br />Writes a binary output file into flash memory<br />The file will be retrieved using the RSE connector<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  13. 13. Robot behavior<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  14. 14. Robot Java program<br />publicstaticvoid main(String[] args) {<br /> tachoNav= new TachoNavigator(5.6f, 11.5f, Motor.A, Motor.B);<br /> File fRadar = new File(&quot;result.radar&quot;);<br /> FileOutputStream fosRadar = new FileOutputStream(fRadar);<br /> tachoNav.goTo(0, TERRAIN_WIDTH, true);<br /> while(tachoNav.isMoving()) {<br /> intdist = ultrasonic.getDistance();<br /> fosRadar.writeInt(dist);<br /> }<br />}<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  15. 15. Display captured data<br />In an Eclipse editor associated to .radar files<br />Parse binary files<br />Process signal <br />sin(α)… cos(α)… Remember?! <br />Since the ambient noise level is also recorded, we can display it in a similar manner<br />http://www.sxc.hu/photo/1099687<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  16. 16. ©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  17. 17. 17<br />State machines modeling<br />LeJOS comes with an event-based robotics API, remember?<br />Eclipse has a bunch of cool modeling/diagramming/code generation technologies<br /> … how about mixingboth?! <br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  18. 18. 18<br />LeJOS Visual Development Toolkit<br />A state machine framework on top of LeJOS<br />A GMF editor<br />Xpandtemplates for code generation<br />An integrationwith the LeJOS Eclipse plugin<br />Auto-deployment of the binary<br />Communication between the brick and the IDE to monitor the state machine<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  19. 19. A state machine diagram…<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  20. 20. ©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  21. 21. ©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  22. 22. Questions?<br />Benjamin Cabé<br />BCabe@sierrawireless.com<br />
  23. 23. If youwannaplay by yourself!<br />http://www.mindstorms.com<br />http://lejos.sourceforge.net<br />http://www.juanantonio.info/p_articles/archive/2008/leJOSStatemachineDevelopmentToolkit.pdf<br />http://www.eclipse.org/dsdp/tm/<br />©2009 Sierra Wireless inc. – Made availableunderEPL v1.0<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×