Skip to main content

Software Library Documentation

XGO Serial Communication Protocol

Document Purpose and Target

This document applies to the communication protocol for command/data interaction between any host computer and the XGO series machine driver board. It is intended for advanced developers to perform secondary development on XGO.

Software interface

Uses standard TTL serial communication.

Baud rate115200
Data bits8
Stop bits1
Parity bitNo

Data frame format

The data frame uses a fixed format: frame header + frame length + data + checksum + frame tail.

Frame HeaderFixed to 0x55 0x00
Frame lengthThe number of bytes in the entire data frame
DataIt has different meanings depending on the instruction type, see the second part
ChecksumAdd all bytes of the length and data, take the lowest byte, and then invert it
Frame endFixed to 0x00 0xAA

Instructions

It is recommended that the interval between each instruction of the host computer is at least 1ms to prevent the robot dog from losing packets due to sending instructions too quickly.

You can refer to the send and read codes in the python library.

Write command, no response (0x00)

Frame headerFrame LengthCommand typeFirst addressDataChecksumFrame end
0x55 0x000x00data0x00 0xAA

The write command will modify the data starting from the first address and will not generate a response.

>For example, to modify the forward speed of the robot dog, the forward speed address is 0x30, and it moves at the maximum speed, that is, the speed content is 0xFF. The specific instructions are as follows: >0x55 0x00 0x09 0x00 0x30 0xFF 0xC7 0x00 0xAA >The checksum calculation process is as follows: >0x09+0x00+0x30+0xFF=0x138, take the lowest byte 0x38, and invert it to get 0xC7

Read command, response (0x02)

Frame headerFrame LengthCommand typeFirst addressRead LengthChecksumFrame end
0x55 0x000x02uint_80x00 0xAA

The write command will continuously read data starting from the first address and will not generate a response. The format of the returned data packet is:

Frame headerFrame LengthCommand typeFirst addressDataChecksumFrame end
0x55 0x000x12data0x00 0xAA

>For example, to read the angles of 12 servos, 0x50 is the address of the first servo position, and 0x0C means to read 12 servos in succession. The specific instructions are as follows: >0x55 0x00 0x09 0x02 0x50 0x0C 0x98 0x00 0xAA >The checksum calculation process is as follows: >0x09+0x02+0x50+0x0C=0x67, inverted to get 0x98 >Read the return data packet: >0x55 0x00 0x14 0x12 0x50 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x89 0x00 0xAA

Double wheel foot memory table 2024-11

AddressFunctionReadInitial ValueNote
0x01Battery levelread0xffThe range is 0-100, linearly corresponding to the minimum value - maximum value of power
0x02Working statusread0x010x00 Falling state
0x03Performance Modewrite0x000x00 Normal control mode
0x04Calibration modewrite0x000x01 Enter calibration mode 0x00 Exit calibration mode Complete calibration
0x05 Update the firmwareUpdate the firmwarewrite0x000x01 Enter update mode, the lower computer will send a command with the content of 0x55 as a reply, and the upper computer will start transmitting hex after a delay of 1s
0x06Setting the originwrite0x000x01 setting, set the current direction to 0 degrees, and reset the odometer to zero
0x07Firmware versionreadReturns a 10-byte string, for example "R-1.2.3" L stands for lite, M stands for mini, and R stands for rider
0x08Automatic data feedbackwrite0x00Send data packets of power, joint angle, IMU6-axis data and odometer to the serial port at a frequency of 50Hz
0x0AStatic steering ring switchwrite0x010x00 Off |0x01 On By default, the orientation is kept. After turning it manually, it will return to the original orientation.
0x13Bluetooth NamewriteThe name length is 20 bytes and can only be a combination of English and numbers. The Bluetooth name after naming is XGORider_xxxx
0x30Moving speedwrite0x80The range is 0x00- 0xff, linearly corresponding to the reverse maximum value - the forward maximum value
0x32Clockwise and counterclockwise rotation speedwrite0x80Face the z-axis and point clockwise to the direction of the maximum value
0x35Body heightwrite0x80
0x39Rotate the body around the x-axis at a certain periodwrite0x000x00 stops, 0x01- 0xff linearly corresponds to the minimum-maximum rotation speed. This function cannot work at the same time as directly setting roll.
0x3EAction Instructionswrite0x00For details, see the action instruction table. 255 is to restore the default posture. 1-N is each action.
0x82Translational motion along the Z axis at a certain periodwrite0x000x00 Stop, 0x01- 0xff Corresponding to the minimum-maximum rotation speed, the movement amplitude is half of the position limit
0x61ROLL balance modewrite0x000x00 Off 0x01Self-stabilizing mode
0x62ROLL anglereadfloat
0x63PITCH anglereadfloat
0x64YAW anglereadfloat
0x65IMU 6-axis datareadfloat*6 A total of 24 bytes
0x66ROLL angelreadint16
0x67PITCH angelreadint16
0x68YAW angelreadint16
0x69Color of LED No. 1writeThree bytes, the value range is 0-255, [0,0,0] represents off, [255,255,255] represents the brightest white light
0x6AColor of LED No. 2writeSame as above
0x6BColor of LED No. 3writeSame as above
0x6CColor of LED No. 4writeSame as above
Action ID (decimal)Action content
1Swinging
2Ups and downs
3Forward and Backward
4Four-sided serpentine motion
5Lift and rotate
6Circular shake