Communications protocol: serial data, 57600 baud, 8N1 format bytes 0-223 for data bytes 224-255 for control All messages consist of optional data bytes, followed by a control byte to complete the message. Only bytes 0 to 223 may be used for data. Bytes 224 to 255 are reserved for control bytes. Control byte 224 is a "no operation" command. All devices must discard any stored data. So 224 may be transmitted first before data, to assure that the message does not unintentionally include any data bytes that may have been present before. command turn-around req'd ------- ----------------- 224: no operation no 225: wheel positions (not implemented) no 226: sonar ping no 227: sonar read request yes 228: sonar read reply yes 229: reboot to bootloader no 230: set motor no 231: motor status request yes 232: motor status reply yes 233: set led no Some messages require waiting a brief turn-around delay. This allows time for one devices rs-485 transmitter to disable before another device enables its transmitter and begins driving the line. No Operation (224): ----------------- Wheel position message (225): ---------------------------- This command is not implemented Sonar ping message (226): ------------------------ This command instructs one or more sonar sensors to transmit a ping. The data is a list of all sensor addresses that should ping. No reply is sent. After 20 ms, each of the sonar sensors may be querried. Sonar read request (227): ------------------------ This command requests the last sonar reading from a single sensor. A single data byte specifies the address of the sensor which is to reply with its last reading. Sonar read reply (228): ---------------------- This message is sent by a sonar sensor in response to the read request. Two data bytes are transmitted, the number of inches measured, and a serial number. The serial number is from 1 to 255 (todo: bug... count shouldn't go over 223). The count may be compared to the previous reply's count to determine if this is truly a new measurement, or simply the same value read last time. Reboot To Bootloader (229): -------------------------- This command instructs all motor control boards to reboot to their bootloader. Presumably a new firmware image will be transmitted within 10 seconds. This command requires 3 data bytes, which must be 195, 85, 19. Set Motor (230): --------------- This command sets new parameters for all 4 motors on a motor control board. Five data bytes are required, the board's address, followed by 4 new settings. 198 disables the motor. 199 is "no change". 0 and 64 stop the motor (hold its current position). 1 to 63 set clockwise motion (1=slow, 63=fast), and 65 to 127 set counter clockwise motion (65=slow, 127=fast). All other values are undefined and should not be sent. Motor Status Request (231): -------------------------- The command requests a motor control board to transmit the status of its four motors. One data byte is sent, for the address of the board to respond. Motor Status Reply (232): ------------------------ This is the reply to the motor status request. Five data bytes are sent. Additional bytes may be added in the future, so receivers should allow for more than 5 bytes but only parse the first 5. Byte 1 is the enable/disable status for all 4 motors. Bytes 2 to 5 are the current angular position. Set LEDS (233): -------------- Set the 8 LEDs on a motor control board. Byte 1 is the board address in bits 0 to 5, bit 6 is the MSB for the LEDS. Byte 2 is the low 7 bits to appear on the LEDs. Sound play message: ------------------ to be defined Sound stop message: ------------------ to be defined Poweroff message: ---------------- (not implemented)