Help with Extra Byte in Sensor Configuration

I am trying to decode the sensor configuration protocol. When I run the example single-sensor Python code, the code wakes up the RVR and configures it to use the accelerometer. Here’s the logging output of the program for the configuration:

Writing bytes: [0x8d, 0x18, 0x02, 0x18, 0x39, 0x02, 0x01, 0x00, 0x02, 0x02, 0xab, 0x05, 0xd8]

I understand all the bytes…except the 0xab. The bytes before it configure the sensor: 0x01 (token) 0x00 0x02 (sensor ID) 0x02 (data size). Then there’s that pesky 0xab. I can’t identify it. Then there’s the checksum and the message terminator.

Can I get some help with that byte? Thanks.

1 Like

Here’s my personal explanation for that byte. Read the section on escaping.

The Sphero doc also explains it in the packet encoding section.

The sequence 0xab 0x05 means 0x8D appeared in the byte stream. To keep if from being interpreted as an SOP the escape sequence was inserted. In that position it is the checksum byte. The actual message is:

Writing bytes: [0x8d, 0x18, 0x02, 0x18, 0x39, 0x02, 0x01, 0x00, 0x02, 0x02, 0x8d, 0xd8]

Rud

2 Likes

That makes sense. I forgot about escaping. It’s one of those things I was going to get to … then forgot. Thanks!

– Mike

2 Likes