For programming courses focused on OOP I intend to develop a Java library with a clean OOP design to be used with the NXT brick. In direct mode there will be support for several bricks at the same time using Bluetooth communication. Part of the design is shown in the following class diagram:

The programs compiles and runs on the PC/Mac and uses the Bluetooth connection to the NXT with the NXT direct commands.

They run with the original Mindstorms or the Lejos firmware. Obviously it is not a typical NXJ project but uses code inspirations from the Lejos source distribution. Like Lejos all library sources are freely distributed.

To port the same strict OOP concepts to standalone programs would require a total reengeneering of the Lejos package. This is too much of work.

I am interested in the design of your library. Does it use lejos NXJ? Or is it completely independent? Is it to be used only on a PC to control the robot in direct mode? or to be run on the NXT also?
I notice that your Gear class is quite similar to the Pilot class of NXJ. Why did you decide to not use the Pilot ?
Roger

roger wrote:Does it use lejos NXJ? Or is it completely independent? Is it to be used only on a PC to control the robot in direct mode? or to be run on the NXT also?

The library is only used to control the NXT in direct mode. It is completely independent of the leJOS NXJ or iCommand, but uses some low level code from the leJOS iCommand distribution (did not reinvent the wheel).The main advantage is it's clean OOP design. We need this for our Java courses, because Java + Robotics is a very motivating.

roger wrote:I notice that your Gear class is quite similar to the Pilot class of NXJ. Why did you decide to not use the Pilot ?

That's true, but Pilot is not available in leJOS iCommand. It's quite natural to create a class that supports the two wheels together (there was once a class called SynchMotors)

My library supports more than one brick at the same time, and this is a must for our OOP concept. All sensor classes use the Java event model, because event handling is another highlight of our teaching. The user of the library does not "poll" the sensors, but registers a callback method to get an event trigger.

The first official release of my NXT Java Library is available at http://www.aplu.ch/nxt. It contains NxtJLib.jar for the J2SE platform and NxtJLibMP.jar for the J2ME platform to develop MIDlets for Java-enabled mobile phones.

Both are beta versions. Therefore the source code is not yet included.