Real robot are built with:
- An Arduino for motors and sensors control
- A Raspberry PI for running the robot engine developed in Java, and as storage of robot instructions (robot’s memory) in a system directory
- A XBee for communication.
The Arduino is connected via USB cable with Raspberry PI and a simple communication protocol has been defined for Raspberry PI to Arduino and vice-versa communications. The XBee is connected to the Raspberry PI via USB cable and uses the XBee binary protocol for communications.
The Raspberry PI o Arduino communication protocol, and vice-versa, are implemented using some Java classes in the roboleo package and C++ for the Arduino. The communication form Raspberry PI to XBee and vice-versa are implemented using an open source package.
The Robot’s engine is coded in Java language and represents the equivalent of robot’s brain; it is stored in the roboleo package.
The start up class of roboleo package is Server.java; this class requires two input parameters: the configuration file and the xmlrpc service port number. The configuration file that can be located in any directory and contains all initial information needed to start the robot’s engine, the xmlrpc service port is the TCP/IP port that an xmlrpc can call in order to communicate with the robot.
The robot’s engine, based on the information stored in the configuration file, starts up many different Java modules. Each Java module is responsible for one or more kind of action; for instance: managing the communication with Arduino or XBee, acquisition and processing of robot’s sensor data, etc. If needed you can build your own module to extend your robot’s capability.
The following figure shows the logical modules that are part of the robot engine
The basic concept is that the robot engine has to process messages that come from different sources like: xmlrpc client or sensors, all the messages are parsed by the Message Manager module. Message can be commands, that other modules can receive and execute, or pair of key and value that are stored in the robot memory.
In the robot engine you can deploy a special java class that implement the CacheInterface and Runnunble interface, these class are responsible for implementing special robot logic like controlling accelerometer sensors, ping sensors an more. There is non limit at this type of classes you can build.
The communication with arduino is managed by the Serial Manager (code class RobotSerialController.java) module , this module manage the serial port and send or receive string to and from the arduino roboleo firmware.
The comunication with XBEE is managed by the module Xbee Manager (code classRobotXbeeController.java) the xbee transceiver must be configured in API mode.
The communication with blender is managed by the module TCP/IP Manager (code class BaseTCP.java) this class open a TCP/IP socket that python code can use to connect blender game engine to the roboleo engine.
If you need to use sensor like accelerometer, ping or others sensor you can write your own java class that can get data from robot memory elaborate it and send messages to the robot engine. In the code there are simple class to control accelerometer (code class BaseACC.java) and ping (code class BasePing.java)