T1 Robot Documentation

From Intrument Element Wiki

Jump to: navigation, search
T1 robot(front)
T1 robot(front)
T1 robot(side)
T1 robot(side)

As a case study, the Instrument element has been used to develop abstract control interfaces for the Lego Mindstorms NXT robotics tool kit that are made accessible from the web. For those who are not familiar with Lego Mindstorms NXT, let start with a background on that.

This robotics tool kit basically has three interactive servo motors and four different kinds of sensors: a light sensor for measuring light intensity, a sound sensor for measuring loudness of sound, an ultrasonic sensor for measuring distance of any obstacle using ultra-sound and a touch sensor. It also consists of an embedded computing device, commonly known as the “NXT intelligent brick” that can be programmed using the LEGO NXT-G software. The NXT brick is also capable of Bluetooth communication interface and USB interface to program. More elaborate details can be found in the Lego Mindstorms NXT wikipedia page. In order to program the NXT using Java programming language, the default firmware needs to be replaced with LeJOS. The LeJOS thus provides the flexibility to use the Lego Mindstorms NXT as an “instrument element”.

For our purpose, a particular model has been developed using two motors, three sensors and obviously, the NXT brick. It has two motors for movements using the caterpillar tracked wheels, ultrasonic sensor for detecting obstacle in the front and touch sensor in its back to detect obstacles behind it. The light sensor is used for sensing reflected light from the floor so that it can be used, for example, to follow a line. Apparently, the model looks like the T1 Terminator combat drone from “The Terminator – rise of the machines” cinema and so the Lego model is also named “T1”:-).

Some words about the implementation

The following is the description on how the implementation was done. The main idea is to expose the functionalities of device to the World Wide Web using the Instrument Element framework. To do so, the design and implementation is done in several layers of abstraction, encapsulating the details of the one layer to the one above it. The system can be thought as a "subscribed client-sever" system.

The LeJOS API provide very flexible Java interface to configure, control and to monitor very low level parts and functions of the Lego Mindstroms NXT. It provides Java classes that contains method for various purposes, for example, to control individual motors by specifying number of rotations, power to the motor, direction of rotation, etc. Also some other classes give access to, for instance, hardware sensor ports, individual sensors to allow calibration and configuration and even low level Bluetooth communication.

Using this API, a higher level Java classes has been developed to establish a protocol for the purpose controlling and monitoring the robot at runtime using a computer workstation. In this case, the robot has to be able to use the attached sensors as well as to be controlled at the same time. To do that, multi-threaded programming techniques are followed for most of the concurrent operations like movement, sensing and managing Bluetooth communication at the same time. Finally, the robot has been programmed to follow simple instructions like moving into different directions, changing the speed of movement, taking turns, sensing its sensors and reacting to those as well as providing feedback to the user from the sensors over the Bluetooth channel so that it can be remotely monitored.

As the Lego Mindstorms NXT does not support any other wireless communication except the Bluetooth, in order to control and monitor the robot remotely, a Bluetooth capable workstation is required. This workstation must also run the Instrument Element web service on top of a Java Servlet Container for the robot that can be accessed from the World Wide Web. In this case, we have used Apache Tomcat

The system includes Java classes for handling Bluetooth communication with the robot, for abstracting the low level functionalities with user-friendly commands like “Move forward” with a “speed” parameter, for normalizing raw data from the sensors, etc. Then these are plugged into the Instrument Element framework, following the instructions described in the How to plug a new Instrument section.

Personal tools