an adaptive multi-tier architecture

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

an adaptive multi-tier architecture

Postby burti » Sun Sep 13, 2009 4:55 am

I'm currently working on a term paper for my study at university (I study computer science ;-) as well.
It is about combining the reflect framework ( and the 3-tier architecture to an adaptive multi-tier architecture.
Some features:
- The Nxt detects the sensors and motors. It makes a PowerOnSelfTest to find out which sensors and motors are plugged in and which role each plays to create a small model of itself when the program on the nxt is started.
- The Nxt offers a connected PC over Buetooth both sensor values and a set of real-time-critical primitive behaviours which can be called from a program on the PC depending on the set of sensors and motors which are plugged in / available at the moment.
- The program on the PC uses a primitive behaviours proxy which hides the network and the program itself is composed by dependency injection.

My target is to be able to run several flexible programs using the remote nxt on the PC and each solving a different problem in robotics (finding out a way through a labyrinth, going a way with avoiding obstacles which lie in the way) without the need of exchanging the program on the nxt every time.
Sounds challenging and it is.

Is someone interested to hear from me about the progress and results of this project? I'm considering to write my term paper in English instead of German so that more people can read it.
(I ask because I don't want to make myself look like a bighead.)
Posts: 61
Joined: Thu Jun 25, 2009 11:41 pm

Postby lawrie » Sun Sep 13, 2009 5:55 pm

Your project sounds very interesting.

I have just added an implementation of javax.microedition.sensor to the subversion repository. It includes an API for discovery which sensors are attached and monitoring when they become available and unavailable. I have currently only implemented it for I2C sensors as they are the only ones that identify themelves. It is hard to tell when other sensors are attached. This could be relevant to your project. The API is defined by JSR 256.
leJOS Team Member
Posts: 840
Joined: Mon Feb 05, 2007 1:27 pm

Postby burti » Sat Nov 21, 2009 5:23 pm

thanks for your effort lawrie. I really appreciate it. However I'm very sorry to tell you I haven't used it yet. As I wanted to use this project with lejos 0.85 there was a little bug with a huge, negative impact on my project. so I had to avoid it to use first. Now I use a snapshot of 0.85 because of another bug in 0.8.

What's the status of the project?
There are 3 layers on the nxt:

elements means motors and sensors. You can find a ElementsDetector in it. It uses predefined objects which represent rules (how to create a sensor object, how to detect the sensor and to read a value from it) with meta information (if you can change the i2c-address e.g.).

model has to subpackages:
model offers a basic, stateless model. It admins the model elements and primitive behaviors.
model elements has a model element detector. It detects model elements by applying assigningRules. An assigningRule maps a name to an element (a motor or a sensor). So the elements get model-specific names. Having been detected, a model element can be addressed by using its name. The name also serves as an model dependant identifier.
Primitive behaviors are - as their term says - primitive behaviors like following a wall, moving forward, etc. .They can be called remotely from the pc and are performed on the nxt. Of course I know that I could have used icommand. However I didn't.
The network layer has 2 subpackages:
physical establishes the connection.
msgHandling reads msgs which are "json-serialized" request message objects which can contain additional information (e.g. a request to call a primitive behavior has the name of the primitive behavior and a parameter for it). The central msg handler uses msgHandlers which map the requests to responses.

I have programmed some test tools just to test the nxt. That shows that the work on the nxt software architecture is finished.

I import and adapt a previous project (nxtheseus) now from a nxt project on my pc.
It is about how a nxt can find the way thru a real(!) labyrinth, i.e. 3D with real walls and walks like rabbit warrens. It uses 3 distance sensors (front, left, right) and a compass (to be able to distinguish between left and right) and a light sensor (to detect the target point which has dark spot on the ground). It avoids collisions.

What secondary products were made?
I adapted a lightweight JSon-lib for the nxt. Now my nxt can communicate with my pc using json-strings. So you can at least serialize your objects to json-strings . The only thing you have to do is to write the reading and writing methods for the json-string of the object (i.e. the object representation as json-string) which is not too difficult.

I will begin at the end of December to write my term paper in English so that you can read it if you are interested in it. I will tell you as soon as I have finished that.

All the best,
Posts: 61
Joined: Thu Jun 25, 2009 11:41 pm

Postby burti » Thu Dec 31, 2009 1:58 am

FYI: I have begun writing my term paper now in English (only for you).
I think you could be interested in it and as you are English and dosn't understand any German I had to write it in English. It will be about 40 pages with photos and uml diagrams and pseudocode. I hope you appreciate it after having read it. I made some efforts.
I'm going to finish it almost at the beginning of February.
I will publish it here in the forum as soon as I submitted it to the assistant of the professor who takes care of it.
Posts: 61
Joined: Thu Jun 25, 2009 11:41 pm

Postby gloomyandy » Thu Dec 31, 2009 9:42 am

Hi Michael,
I'm looking forward to reading your term paper, thanks for taking the trouble to write it in English! If you would like any help with the proof reading (particularly of the NXT/leJOS parts), let me know I'd be happy to help...

All the best...

User avatar
leJOS Team Member
Posts: 3642
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby burti » Tue Mar 23, 2010 3:16 am

Thank you for your offer. I appreciate it very much!

I have written the section about different approaches in software architecture for roboters and about my architecture and about some sample applications of the architecture but I have not written the section about Lego Mindstorms and lejos (had a lower priority ;-). I will write within this week and keep it short. I currently improve my term paper. My professor's assistant gave me a lot of advice.

I will need to refactor and adapt the code once again and write some additional tests. Moreover I will separate some parts so that they can be used independantly from my architecture. For example I adapted a JSon Library so that it can be used with Lejos. I can contribute it with some examples to Lejos.
Posts: 61
Joined: Thu Jun 25, 2009 11:41 pm

Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff