Advanced
Serial Protocol
Advanced
Serial Protocol
In order to communicate sensor data to a client (e.g., a RoboRio robot controller) the navX-sensor
software uses a custom protocol. This protocol defines messages sent between the navX-sensor and the
client over a serial interface, and includes an error detection capability to ensure corrupted data is not
used by the client.
The navX-sensor Serial protocol uses two message types, the legacy ASCII messages initially introduced
in the nav6 sensor, and the modern binary messages introduced in the navX-sensor.
Source code that implements the navX-sensor ASCII and binary protocols in
are provided
to simplify adding support for the navX-sensor protocol to a software project.
Message Structure
ASCII Protocol Messages
Each navX-sensor Serial ASCII protocol message has the following structure:
Start of Message
Message ID
Message Body
Message Termination
1 byte
1 byte
length is message-type
dependent
4 bytes
Binary Protocol Messages
Each navX-sensor Serial Binary protocol message has the following structure:
Start of Message Binary Message
Indicator
Binary Message
Length
Message ID
Message Body
Message
Termination
1 byte
1 byte
1 byte
1 byte
length is message-
type dependent
4 bytes
Data Type Encoding (ASCII)
Base16 encoding is used for ASCII message elements, as follows:
Data Type
Encoding
Example
Float
(Sign)(100s)(10s)(1s).(10ths)(100t
hs)
‘-132.96’. ‘ 257.38’
8-bit Integer
(HighNibble)(LowNibble)
‘E9’
16-bit Integer
(HighByte,HighNibble)(HighByte,
LowNibble)(LowByte,HighNibble
‘1A0F’
80