Lego Mindstorm Example

From Intrument Element Wiki

Jump to: navigation, search

This page describes how to use the Instrument Element architecture. The Lego Mindstorm NXT robotics tool kit is used for this purpose. The Lego Mindstorm NXT comes with a small computing device that is capable of executing codes written in several different programming languages. In this case, Java has been used.

Contents

The fun part

The first step is to assemble the Lego Mindstorm NXT robot however one may wish. But depending on the physical structure and configuration of the robot, the software code needs some small modification. In this example, we have used a modified model of Lego Mindstorm NXT that has a pair of tracked wheels operated with two separate motors, a touch sensor, an ultrasonic sensor and a light sensor.

Installing Lejos

The "not so fun part" is to install LeJOS in the Mindstorm NXT brick. But be warned, doing so will remove the existing firmware that comes with the brick. The following links may help:

http://www.bartneck.de/2008/03/04/java-lego-nxt-eclipse-tutorial/#installLejos

http://weblogs.java.net/blog/jfalkner/archive/2008/02/controlling_leg_1.html

http://legolab.daimi.au.dk/DigitalControl.dir/Lejos_NXJ.dir/lejos_nxj_install_guide.html

http://www.mathworks.com/matlabcentral/fx_files/13399/9/content/ecrobotNXT/environment/nxtOSEK/lejos_nxj/README.html

Setting up IE in a computer

Check out the software from SVN (module tinyIE) in your working environment Info about our SVN:

http://sourceforge.net/scm/?type=svn&group_id=225147

A suggestion on how to set up your eclipse (just in case):

First_Steps


Pluging in an instrument

Once LeJOS is successfully installed in the Mindstorm NXT brick, it is time to program the NXT brick using LeJOS libraries.

This following is an UML oriented guide on how to plug a new instrument: How_to_plug_a_new_Instrument

Javadoc of the object that you have to implement:

http://instrumentelem.sourceforge.net/doc/im/index.html

Key classes:

http://instrumentelem.cvs.sourceforge.net/viewvc/instrumentelem/tinyIE/src/main/java/org/ie/instr/InstrumentControl.java?view=markup

http://instrumentelem.cvs.sourceforge.net/viewvc/instrumentelem/tinyIE/src/main/java/org/ie/instr/InstrumentFunctionality.java?revision=1.1&view=markup

Hello word example:

http://instrumentelem.cvs.sourceforge.net/viewvc/instrumentelem/tinyIE/src/main/java/org/ie/impl/imimpl/HelloWorldIE.java?revision=1.2&view=markup

Using the IE

Done! Web APIs have been implemented and the service is exposed using the IE WSDL. All you have to do is to use them. At your http://yourTomcatUrl/yourAppName/ you can already find a (very basic) GUI that uses the service.

link to the WSDL:

http://instrumentelem.sourceforge.net/wsdl/IEService.xml

link to the Javadoc related to the Service methods:

http://instrumentelem.sourceforge.net/doc/ie/index.html

link to a UML oriented documentation:

How_to_access_and_use_the_Web_API

example of how to access the WS APIs from Java:

How_to_use_the_Web_Service_API_with_Axis_1.4


The real fun

Have fun with the robot! :-)

Personal tools