ArbotiX Commander Packet Structure and Calculator

mt_ignore
Reference Material

There are two parts to the commander protocol - the sending and the receiving ends. The receiving end is usually an ArbotiX robocontroller using the commander library to accept, parse and use commander data sent to it. The sending end does not require a specific library, just the ability to send a serial packet as outlined below. The commander packet is designed to be sent via a remote control like the ArbotiX Commander or Virtual Commander, though it can be sent via any device that can send a TTL serial signal to the arbotix or an XBee.

Enter in a value for each parameter. Be mindful of the limits for each parameter. This calculator will not check limits. Once all values are present, press 'Calculate' to generate a serial packet. You can then use the serial packet below the 'calculate' button in your application.

Packet Structure

Packet # Description Commander Library Call Mixed Byte Commander Call
1 Header (0xFF/255)
2 Look Joystick (Vertical) command.lookv command.pan(High Byte)
3 Look Joystick (Horizontal) command.lookh command.pan(Low Byte)
4 Walk Joystick (Vertical) command.walkv command.tilt(High Byte)
5 Walk Joystick (Horizontal) command.walkh command.tilt(Low Byte)
6 Button Byte command.button
7 Extended Instruction Byte command.ext
8 Checksum

Joysticks

The first four fields correspond to the commander's joysticks. Each axis on the left joystick (look) and the right joystick (walk) take up one field. When the joystick is centered, the value transmitted is 128. When the joystick is all the way left (vertical) or down (horizontal) the value is 3. When the joystick is all the way right(vertical) or up (horizontal) the value is 253.

On the receiving end, the commander library will shift these values for you. The shift is a simple value - 128 operation. So when you send a 128, the receiving end will read a 0. When you send a 3, the receiving end will read a -125, and when you send a 253, the receiving end will read a 125, etc

It is also possible to combine 2 joystick bytes into a single high resolution value. The two look byte can be read as pan and the two walk bytes can be read as tilt by the commander library on the receiving end. The vertical byte is always the High byte while the horizontal byte is the low byte. Usually this is used to send a 10-bit analog value (0-1023) though it can send up to a 16-bit value (0-65535).

Button Byte Structure

Bit # 8 7 6 5 4 3 2 1
Button Left Top Right Top Left 6 Left 5 Left 4 Right 3 Right 2 Right 1
Examples
Hex Decimal Binary Buttons Pressed
0x00 0 00000000 none
0x01 1 00000001 R1
0x02 2 00000010 R2
0x0f 15 00001110 R2,R3,L4
0xF2 242 11111110 R2,R3,L4,L5,L6,RT,LT

Extended

The extended byte can be used to send additional data. The exact function will depend on the firmware of your receiving robot.

Calculator

Calculated Packet (HEX)

0xff