Recent Changes - Search:

Tracking

Hardware

Software

Mega Plan

Etc.

PacketFormats

Communications

This page describes the internal Serial communications packet format for Raspberry Pi and Arduino communications. The Socket Programming page describes the protocol for creating socket code for a client to interface with the Flockbot.

Serial Packets

The startup handshake is two-part. The Uno sends an ACK message to initiate. The Pi responds with a CFG packet. The Uno then responds with an ACK.

Any transmission errors result in the sending of a NAK. Upon receipt of a NAK, the receiving system will automatically resend the last packet transmitted.

Socket connected systems may send packets directly through on a retransmit message. For these messages, described in the later section on socket packets, there is no checksum. That is computed on the Pi in the retransmit process. This simplifies the client code necessary for controlling the robots.

The general framing is as follows:

HeaderLengthPayloadChecksum

Sample Packet - Move Foward 10cm/s

0xBD0xBD0xBD4DMS100x53

Header The header/synchronization sequence uses three sequential octets consisting of 0xBD. This byte was selected because it would not naturally appear in packets.

0xBD0xBD0xBD

Length This is a single octet and represents the number of octets in the payload.

Checksum This is a single octet and is the XOR combination of all octets in the payload and the length.

Payload

Packet TypeCommand Code OneCommand Code TwoData

The valid payloads are as follows:

Claw Functions

FunctionLen: byte[0]byte[1]byte[2]byte[3]byte[4]byte[5]byte[6]byte[7]
Claw Open3DGO
Claw Close3DGC
Claw Set4DGS<pos>(0 to 30)
Claw Can Close3DGG

Camera Functions

FunctionLen: byte[0]byte[1]byte[2]byte[3]byte[4]byte[5]byte[6]byte[7]
Camera Up3DCU
Camera Down3DCD
Camera Set4DCS<pos> (0 to 100)
Camera Forward3DCF

LCDFunctions

FunctionLen: byte[0]byte[1]byte[2]byte[3]byte[4]byte[5]byte[6]byte[7]
LCD Clear3DLC
Set Cursor5DLU<col> 1-2<row> 1-16
Write String4+DLS<\0 terminated string>

Movement Functions

Functionbyte[0]byte[1]byte[2]byte[3]byte[4]byte[5]byte[6]byte[7]
Move4DMS<speed>(-100 to 100)
Move to Distance5DMD<speed>(-100 to 100)<dist> (0 to x meters)
Differential Wheels5DMW<left speed>(-100 to 100)<right speed> (-100 to 100)
Rotation4DRC<speed> (-100 to 100)
Arc7DRA<speed> (0 to 100)<distance to object> (0 to 128cm)LSB <degree> (0 to 359)MSB <degree> (0 to 359)
Degree Rotation6DRD<speed> (-100 to 100)LSB <degree> (0 to 359)MSB <degree> (0 to 359)
Stop3DST
Reset Odometer3DMR

Administrative Functions

Functionbyte[0]byte[1]byte[2]byte[3]byte[4]byte[5]byte[6]byte[7]byte[8]byte[9]byte[10]byte[11]byte[12]
Configuration12CFG<gripper>LSB <l_wheel_stop>MSB <l_wheel_stop>LSB <r_wheel_stop>MSB <r_wheel_stop><servo model><id><ip 3><ip 4>
Acknowledge3ACK
Non-Acknowledge3NAK
Emergency3EMG

Sensor Packet

Functionbyte[0]byte[1]byte[2]byte[3]byte[4]byte[5]byte[6]byte[7]byte[8]byte[9]byte[10]byte[11]byte[12]byte[13]
Sensor29SENLSB <battery>MSB <batteryLSB <ir0>MSB <ir0>LSB <ir1>MSB <ir1>LSB <ir2>MSB <ir2>LSB <ir3>MSB <ir3>
byte[14]byte[15]byte[16]byte[17]byte[18]byte[19]byte[20]byte[21]byte[22]byte[23]byte[24]byte[25]byte[26]byte[27]byte[28]byte[29]
LSB <ir4>MSB <ir4><l_bump><h_bump>LSB <left Odometer>MSG <left Odometer>LSB <right Odometer>MSB <right Odometer>LSB <avg Odometer>MSG <avg Odometer>LSB <left WW>MSG <left WW>LSB <right WW>MSG <right WW>00
Edit - History - Print - Recent Changes - Search
Page last modified on September 07, 2014, at 01:34 PM