Nx project |
Nx project is an attempt to build a robot where actual robot's logic is implemented in Java and
runs on an ordinary mobile phone.
|
Elements of robot hardware on Java side are represented by driver objects. The state of each driver object is updated by corresponding hardware element via Bluetooth. Once an object state is changed the object communicates the change with its observers if any. Driver objects also provide methods which allow to alter the state of corresponding hardware elements. A robot logic implementation instantiates driver objects of involved hardware elements and adds itself as an observer to driver objects. Once initialization phase is completed, the robot logic acts on state change notifications. User input / output related part of the code if present also may be added as an observer to driver objects. |
Hardware part of the robot is organized as a set of hardware elements (sensors, actuators e.t.c) attached to the system bus. System bus is connected to the board which acts as a gateway between system and control bus. Control bus is a communication channel between hardware and Java part of the robot. Each state change describing message sent by a hardware element to the board before it is dispatched to control bus might trigger one or more reflex messages. A reflex is a mapping between two specific hardware elements state. Reflexes are programmed by Java side of the robot during robot life-cycle. This mechanism imitate one of functions of a spinal cord which enables extremely quick reaction on a critical event. |
N1 hardware includes two PWM controlled LEGO 71427 motors and an infrared radar (IRR) based on Sharp GP2D120 sensor. The radar sends to the board a block of eight measurements (a scan) approximately each second. When the scan arrives on the phone it is processed by the robot logic as well as rendered on the screen. Java code sets an alarm level on IRR so the radar emits an alarm message whenever sensor gets values above the alarm level. The alarm level is depicted on the robot screen by red dotted line. A table on the bottom of the robot's screen is round trip latency statistics in mS measured during each second by the Echo. In order to keep average latency below 100 mS Echo has to send packets approximately each 20 mS. (I guess, Bluetooth on the phone attempts to save battery if the data stream slows down.) |
This video shows N1 equipped with infrared distance sensor (IRR) in action. |
Links and photos:
| ||
N0 is built from LEGO Technic parts. This RC toy is driven by Java ME MIDlet on the phone via Bluetooth (JSR82). Small board on the tractor comprise of BlueSMiRF Bluetooth class 1 module and Atmel's ATmega88 controller. Two 71427 LEGO 9V motors are controlled by TI's SN754410 configured as a dual H-bridge. | ||