Communications Substrate

We felt that a minimal, lightweight communications protocol was most appropriate to this project. Consequently, rather than using the monitor supplied with the Handy Board, we wrote our own protocol.

The robot code is written in Interactive-C. The host code, like the rest of Altaira, is written in C++.

Communication From Robot to Host

Whenever the robot is turned on, it continuously reads its five analog and eight digital sensors and transmits the raw data to the host. The packet format used is:

In order to maintain synchronization, each six byte packet is preceded by a start-packet character (0xbb), and followed by an even vertical parity byte. The sensors (an0 through an4) are in order from left to right. The digital sensor value is simply the value read from the digital sensor port.

Communication From Host to Robot

The host sends one byte to the robot on each execution cycle, containing commands for the four motors (only two of the motors are actually used, but since the minimum unit of tranmission is one byte, transmitting the commands for all four takes no extra time). The byte format is that used by the Handy Board's hardware motor port. The left motor is motor 0; the right is motor 1.

Synchronization

All synchronization is maintained by the host. On each execution cycle one sensor packet is read, and one motor control byte is written. The host's input queue is checked, and if it falls a packet behind the packed is dropped.

If either the robot or the host does not receive data from the other end for a short period of time (on the order of half a second), it concludes the link is down. The host will not perform execution cycles as long as it believes the link is down; the robot will shut its motors off if it believes the link is down. In spite of this, the robot will continue to attempt to send sensor packets to the host, so communications will be re-established immediately if the link becomes live again.

Robot Display

The Handy Board's LCD display is used to display the current values of the five sensors and the link status.
Go back to top of help screen