Recent Changes - Search:

Tracking

Hardware

Software

Mega Plan

Etc.

SocketProgramming

Communications

This page describes the external Socket communications packet format for communications between clients and the Flockbot. The Packet Formats page describes the protocol for the internal Serial communications framing for the Flockbot.

Socket Packets

All communications over sockets will utilize the TCP/IP socket protocol, over port 2005. The nature of TCP means that neither SYN bytes nor checksums are needed. The table below will specify the exact data needed to be sent over a socket to the robot, as well as the exact data which will be received from the Flockbot.

Note that all of these formats are done in 1-byte blocks. The sending and receiving use uint8_t standard types. For the client side, the author of the code will need to ensure they are able to properly extract and interpret the fields of the incoming packets, and that they are able to form the packets using the appropriate types and sizes.

For example, a packet labeled:

0x3'D''G''O'

Means that you will have to create a byte array in which the first element contains the value 0x3. Note this is not the character '3', but the hexadecimal value 0x3. When alphabetic characters appear, these are the ASCII characters. So 'R' would be encoded as the hexadecimal value 0x52.

The valid formats are as follows:

Claw Functions

FunctionTotal Len: byte[0]byte[1]byte[2]Data Len: byte[3]byte[4]
Claw Open0x3'D''G''O'
Claw Close0x3'D''G''C'
Claw Set0x4'D''G''S'int8_t pos (0 to 30)
Claw Can Close0x3'D''G''G'

BELOW THIS MARK, UNMODIFIED FILE. ONLY REFERENCE ABOVE THIS MARK

Camera Functions

FunctionLen: byte[0]byte[1]byte[2]byte[3]byte[4]
Camera Up (10 tics)0x3'D''C''U'
Camera Down (10 tics)0x3'D''C''D'
Camera Set0x4'D''C''S'<pos> (0 to 180, 90 is forward)
Camera Forward0x3'D''C''F'

Movement Functions

Functionbyte[0]byte[1]byte[2]byte[3]byte[4]byte[5]byte[6]byte[7]
Move0x4'D''M''S'<speed>(-100 to 100)
Move to Distance0x6'D''M''D'<speed>(-100 to 100)<dist LSB> (0 to x centimeters)<dist MSB> (0 to x centimeters)
Differential Wheels0x5'D''M''W'<left speed>(-100 to 100)<right speed> (-100 to 100)
Rotation0x4'D''R''C'<speed> (-100 to 100)
Arc0x7'D''R''A'<speed> (0 to 100)<distance to object> (0 to 128cm)LSB <degree> (0 to 359)MSB <degree> (0 to 359)
Degree Rotation0x6'D''R''D'<speed> (-100 to 100)LSB <degree> (0 to 359)MSB <degree> (0 to 359)
Stop0x3'D''S''T'
Edit - History - Print - Recent Changes - Search
Page last modified on September 17, 2015, at 10:50 AM