27
The information contained in the
sent speed bytes is codified over
the bits in the following manner:
Speed byte:
CTRL DIR SPEED5 SPEED4 SPEED3 SPEED2 SPEED1 SPEED0
1: Closed loop
0: Open loop
1: Forward
0: Backwards
Speed value range (6bits)
0-30 with closed loop
0-63 with open loop
In closed loop the speed
value is the number of
codewheel tics per control
period which is 41ms.
In open loop the speed value is
simply multiplied by 4 and
sent to the PWM registers that
feed the motor drivers.
The computer-control interface protocol:
Here the communication takes place through two channels of UDP sockets. The first channel
(robot’s port 15000) is for sending commands to the robot while second (robot’s port 15010) is to
request data from it. Communication is done by the use of different and specific messages that the
robot separately processes in order to take the proper action. We will present here only the basic set
of messages necessary for your program to deal with the control interface, please refer to the source
code for more detailed information.
Messages to port
15000
:
“
|i|n|i|t|
” this has to be answered with “
|o|k|
” to let the control interface know we are really there
“
|s|p|e|e|d| |RS| |LS|
” this needs no answer. RS stands for right speed and LS for left speed.
Messages to port
15010
:
“
|i|n|i|t|
” this has to be answered with “
|o|k|
” to let the control interface know we are really there
“
|d|a|t|a| |x|x|x|.|x|x|x|.|x|x|x|.|x|x|x|
” this is a request for sensor data, the message includes the IP
address of the reference for calculating the SNR. This needs to be answered with:
“
|BATT|RS|LS|SNR| |x|x|x|.|x|x|x|.|x|x|x|.|x|x|x| |LAT…byte 39|LNG…|
”
Speed feedback
(char)
Battery
level (char)
SNR
(char)
Robot’s IP
address (char)
Latitude
(float)
Longitude
(float)