Appendix : Protocol Specification
Payload is a consist of several sub-payloads.
Payload
Sub-Payload 0Sub-Payload 1Sub-Payload 2...Sub-Payload N-1


Serialization is the process of converting a data structure into a bytestream. Deserialization is reversal process. Each data types are serialized and deserialized by <a href="http://en.wikipedia.org/wiki/Least_significant_byte">LSB</a>-First Order. It means Least Significant Bytes will comes first on the bytestream. For example, The integer number 2,864,434,397(0xAABBCCDD) can be serialized into:

0xDD0xCC0xBB0xAA

So, 0xDD will arrive first in bytestream.

Here are template functions to handle it on kobuki_deriver, buildVariable() and buildBytes().


$\mbox{1/}(f \cdotp a)$, where $f$ is frequency of sound in Hz, and $a$ is 0.00000275

Duration

1

Duration of playing note in milli-seconds

Warning
This command is implemented on the kobuki with firmware, but not implemented yet on driver software(kobuki_driver).


NameSizeValueValue in HexDescription
HeaderIdentifier1120x0CFixed
LengthSize of data field120x02Fixed
DataDigital output flags2Set the flags to set high on output pins of expansion port
0x0001 for digital output ch. 0
0x0002 for digital output ch. 1
0x0004 for digital output ch. 2
0x0008 for digital output ch. 3

Set the flags to turn on external powers
0x0010 for external power 3.3V ch.
0x0020 for external power 5V ch.
0x0040 for external power 12V/5A ch.
0x0080 for external power 12V/1.5A ch.

Set the flags to turn on LEDs
0x0100 for red colour of LED1
0x0200 for green colour of LED1
0x0400 for red colour of LED2
0x0800 for green colour of LED2


NameSizeValueValue in HexDescription
HeaderFeedback Identifier110x01Fixed
LengthSize of data field1150x0FFixed
DataTimestamp2Timestamp generated internally in milliseconds
It circulates from 0 to 65535
Bumper1Flag will be setted when bumper is pressed
0x01 for right bumper
0x02 for central bumper
0x04 for left bumper
Wheel drop1Flag will be setted when wheel is dropped
0x01 for right wheel
0x02 for left wheel
Cliff1Flag will be setted when cliff is detected
0x01 for right cliff sensor
0x02 for central cliff sensor
0x04 for left cliff sensor
Left encoder2Accumulated encoder data of left and right wheels in ticks
Increments of this value means forward direction
It circulates from 0 to 65535
Right encoder2
Left PWM1PWM value that applied to left and right wheel motor
This data should be converted signed type to represent correctly
Negative sign indicates backward direction
Right PWM1
Button1Flag will be setted when button is pressed
0x01 for Button 0
0x02 for Button 1
0x04 for Button 2
Charger10 for DISCHARGING state
2 for DOCKING_CHARGED state
6 for DOCKING_CHARGING state
18 for ADAPTER_CHARGED state
22 for ADAPTER_CHARGING state
Battery1Voltage of battery in 0.1 V
Typically 16.7 V when fully charged
Overcurrent flags1Flag will be setted when overcurrent is detected
0x01 for left wheel
0x02 for right wheel
Note
This sub-payload will be sent by default.
See also
Appendix : Kobuki Parameters - necessary parameters for conversion of encoder ticks to robot pose.


This value is related with distance between sensor and floor surface. See the datasheet for more detailed information.

This data also available in the Cliff field of enBasicSensorData , as a boolean type, processed on the kobuki.

NameSizeValueValue in HexDescription
HeaderIdentifier150x05Fixed
LengthSize of data field160x06Fixed
DataRight cliff sensor2ADC output of each PSD
Data range: 0 ~ 4095 (0 ~ 3.3V)
Distance range: 2 ~ 15 cm
Distance is not linear w.r.t. ADC output.
See the datasheet for more detail.
Central cliff sensor2
Left cliff sensor2
Note
This sub-payload will be sent by default.
See also
enBasicSensorData


Raw gyro data 0

x-axis

2

ADC output of each-axis in 0.00875 deg/s

y-axis

2

z-axis

2

:
:

Raw gyro data N-1

x-axis

2

y-axis

2

z-axis

2

Note
This sub-payload will be sent by default.


Warning
Sensing axis of 3d gyro is not match with robot. It is rotated 90 degree counterclockwise about z-axis. So, below conversion will needed.
const double digit_to_dps = 0.00875;
angular_velocity.x = -digit_to_dps * (short)raw_gyro_data.y;
angular_velocity.y = digit_to_dps * (short)raw_gyro_data.x;
angular_velocity.z = digit_to_dps * (short)raw_gyro_data.z;




kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Wed Mar 2 2022 00:26:14