Xgo-Mini Protocol v1
Xgo-Mini Protocol v1
Xgo-Mini Protocol v1
XGO-Mini Communication
Protocol
版本: V1.0
Version: V1.0
发布日期: 2021/08/05
日期 原因 作者
Date Reason Author
2021/08/05 创建文档发布文档 林涛
陆吾智能科技有限公司
Lwu Intelligent Technology Co., Ltd.
陆吾智能科技有限公司
Lwu Intelligent Technology Co., Ltd.
前 言
Preface
本文档适用于 XGO产品上位机与机器狗之间命令/数据交互的通信协议,采用标准TTL
串行通讯,XH2.54 4PIN接口连接。
XGO-Mini是一款12自由度桌面级机器狗,可以实现全向移动,六维姿态控制,姿态稳定
,多种运动步态,内部搭载了9轴的IMU,关节位置传感和电流传感器反馈自身姿态和关节转
角与力矩,用于内部算法和二次开发。
用六角螺丝到拧下背部两颗螺丝,左右两侧螺丝,尾部两颗螺丝后,拆除机器狗后背板
,注意小心拔掉电源线。
Unscrew 2 screws on the back, 2 screws on the left and right, and 2 screws at the
tail with a hex screwdriver, detach the back panel of the robot dog, unplug the power cord
with caution.
如下图所示主板一侧有两个串口通信接口,按主板丝印线序和上位机线序对接即可以
开始调试。两个端子对外供电电压分别是5V和3.3V,但不可同时使用。
As shown below, there are 2 serial communication interfaces at one side of the
motherboard, connect interfaces by the line sequence printed on the motherboard and
the host computer, then start the testing procedure. External supply voltage at two
terminals is 5V and 3.3V respectively, but both are not allowed to use simultaneously.
默认情况下3.3V端子被AI模块占用,如果想用其他设备进通讯,请将AI模组端子拔下。
In default mode, 3.3V terminal is occupied by the AI module. Unplug the AI module
terminal if you intend to use other device for communication.
软件接口
Software interface
通讯采用固定格式:字头+信息+字尾。
The fixed format applicable to communication: prefix+message+suffix.
标准TTL串行通讯:
Standard TTL serial communication:
波特率 115200
Baud rate
数据位 8
Data bit
停止位 1
Stop bit
奇偶校验位 无
Parity bit NA
1. 通讯格式
1. Communication format
字头 长度 校验和 字尾
Message
Prefix (Length) (CheckSum) Suffix
0x55 0x00 0x00 0xAA
整个数据包
判断数据是
所占字节数
否正确
Bytes 具体数据
Check if
occupied by Data
data is
the data
correct
packet
字头:固定格式
Prefix: in fixed format
长度:数据包长度=字头占位[2]+长度占位[1]+Data占位[x]+校验和占位[1]+字尾占用[2]=6+x
Length: length of data packet = space occupied by prefix [2] + space occupied by length
[1] + space occupied by Data [x] + space occupied by CheckSum [1] + space occupied by
suffix [2]=6+x
Message:详见2.指令
Message: See 2. Command
校验和:CheckSum = ~(Length+Message)若括号内的计算和超过255,则取最低
的一个字节
,然后取反
CheckSum: CheckSum= ~(Length+Message) If the sum of bytes in the bracket is greater
than 255, the byte with the lowest value is taken, vice versa.
字尾:固定格式
Suffix: in fixed format
TIPS:本机接收指令时,如果长度或校验和出错,则认为数据出错,会自动丢弃该数据包。
TIPS: When the local appliance receives a command, if the length or CheckSum goes
wrong, then the data is considered to be wrong and the data packet will be automatically
discarded.
2. 指令
2. Commands
2.1写指令,无应答(0x00)
2.1 Write command, no response (0x00)
指令
首地址
字头 类型 数据 字尾
Length First CheckSum
Prefix Command Data Suffix
Address
Type
0x55 0x00 0x00 0xAA
data1,data2
0x00
……
指令:0x00,向内存表连续写入一定字节的数据,不会产生应答
Command: 0x00, write data of some bytes to MemTable consecutively, no response will
be generated
首地址:数据包写入的首地址(详见协议内存表)
First address: the first address written in the data packet (more details are available in the
protocol MemTable)
数据:连续写入的数据
Data: data that are written consecutively
例:设置机器人最大速度向前运动
Example: set the max. forward movement speed of the robot
0x55 0x00 0x09 0x00 0x30 0xFF 0xC7 0x00 0xAA
字头:0x55 0x00
Prefix: 0x55 0x00
Length:0x09,数据包共9个字节
Length: 0x09, there are 9 bytes contained in the data packet
Message:0x00无应答写指令,0x30前后移动速度寄存器地址,0xff设置最大速度
Message: 0x00 write command with no response, 0x30 register address of forward,
backward movement speed, 0xff set the max. speed
CheckSum:0x09+0x00+0x30+0xFF=0x138,取最低字节0x38,取反得0xC7
CheckSum: 0x09+0x00+0x30+0xFF=0x138, take the lowest byte 0x38, take the
inverse to get 0xC7
字尾:0x00 0xAA
Suffix: 0x00 0xAA
2.2读指令(0x02)
2.2 Read command (0x02)
指令
首地址
字头 类型 字节数 字尾
Length First CheckSum
Prefix Command Bytes Suffix
Address
Type
0x55 0x00 0x00 0xAA
0x09 0x02
指令:0x02,读取内存表中一段连续的字节
Command: 0x02, a length of consecutive bytes in the read MemTable
首地址:数据包读取的首地址(详见协议内存表)
First address: the first address of the data packet that has been read (more details are
available in the protocol MemTable)
字节数:连续读取的字节长度
Bytes: the length of bytes that are read consecutively
返回数据包格式:
Format of the data packet returned:
应答符 首地址
字头 数据 字尾
Length Response First CheckSum
Prefix Data Suffix
character Address
0x55 0x00 0x00 0xAA
0x12
应答符:0x12,表明该数据包为读取指令的应答包
Response character: 0x12, it means this packet is response packet of the read command
首地址:读取指令数据包中的首地址
First address: the first address in the read command packet
数据:读取到的数据,长度为相应读取指令要求字节长度
Data: the data that has been read, with the same length as the length of bytes requested
by the read command
例:读取12个舵机的位置
Example: read the respective position of 12 steering gears
0x55 0x00 0x09 0x02 0x50 0x0C 0x98 0x00 0xAA
字头:0x55 0x00
Prefix: 0x55 0x00
Length:0x09,数据包共9个字节
Length: 0x09, there are 9 bytes contained in the data packet
Message:0x02读指令,0x50舵机ID为11位置寄存器地址,0x0C,连续读取12个字节
Message: 0x02 read command, 0x50 gear ID is the register address at the position
“11”, read 12 bytes consecutively
CheckSum:0x09+0x02+0x50+0x0C=0x67,取反得0x98
CheckSum: 0x09+0x02+0x50+0x0C=0x67, reverse to obtain 0x98
字尾:0x00 0xAA
Suffix: 0x00 0xAA
读取返回数据包:
Read the packet returned:
0x55 0x00 0x14 0x12 0x50 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80
0x80 0x80 0x80 0x80 0x89 0x00 0xAA
字头:0x55 0x00
Prefix: 0x55 0x00
Length:0x14,数据包共20个字节
Length: 0x14, there are 20 bytes contained in the packet
Message:0x12应答符,0x50首地址与相应读取指令一致,0x80共12个,对应12个连续
寄存器地址
Message: 0x12 response character, the first address of 0x50 is the same as the
corresponding read command, there are 12“0x80” that correspond to the respective
address of 12 consecutive registers
CheckSum:0x14+0x12+0x50+0x80*12(d)=0x676,取最低字节0x76,取反得0x89
CheckSum:0x14+0x12+0x50+0x80*12(d)=0x676, take the byte with the lowest value
0x76, reverse to obtain 0x89
字尾:0x00 0xAA
Suffix: 0x00 0xAA
3. 机器人坐标系
3. Robot coordinate system
整机坐标系
Whole unit coordinate system
单腿坐标系
Single leg coordinate system
下面为XGO内存表
Remark: test mode, whole unit mode, single leg mode, steering gear mode (priority level
in a descending order): when you try to write any register under the four modes to change
data, the robot will enter the mode by default while the register data under other three
modes cannot work. The robot is default in whole unit mode.
读写 初始值
地址 功能 备注 模式
Read-w Initial
Address Function Note Mode
rite Value
工作状态 读
0x00 0x00
Mode of operation Read
电池电量 读 范围为0-100,线性对应电量最低值-最高值
0x01 0xff
Battery level Read Range: 0-100, linearly corresponding to the lowest-highest battey level
XGO版本 读 状态信息
0x02 0x00 MINI | 0x01 Lite | 0x02 PRO
XGO version Read State
表演模式 写 0x00正常控制模式 | 0x01循环做动作 information
0x03 0x00
Performance mode Write 0x00 normal control mode | 0x01 cyclic action
0x01进入标定模式 0x00退出标定模式完成标定
标定模式 写
0x04 0x00 0x01 Enter the calibration mode 0x00 Exit the calibration mode and complete the calibration
Calibration mode Write
process
0x00本机无蓝牙设备或蓝牙模块故障 0x01支持蓝牙设备但未连接手机终端 0x02已连接手机终端
蓝牙连接状态 读 0x00 The appliance has no Bluetooth device or the Bluetooth module malfunctions
0x10 0x00
Status of Bluetooth connection Read 0x01 Bluetooth device is supported but the mobile terminal is not connected 蓝牙信息
0x02 The mobile terminal is connected 暂不支持
蓝牙串口波特率 Bluetooth
读
0x11 Baud rate of Bluetooth serial 0x00 information
Read
port Currently not
读写 supported
蓝牙密码 该寄存器为字符串类型,典型值占位可能超过一个字节,读取命令时将忽略指令中的字节数,
0x12 Read-w 1234
Bluetooth password 返回数据包中按真实字节数,写入时数据包中请按真实字节数
rite
This register is a string type and the space occupied by typical value may be more than one byte.
Bytes in the instruction will be ignored when reading command, take actual bytes in the packet
returned; when writing take actual bytes in the packet
该寄存器为字符串类型,典型值占位可能超过一个字节,读取命令时将忽略指令中的字节数,
读写 返回数据包中按真实字节数,写入时数据包中请按真实字节数
蓝牙名称
0x13 Read-w HC-05 This register is a string type and the space occupied by typical value may be more than one byte.
Bluetooth name
rite Bytes in the instruction will be ignored when reading command, take actual bytes in the packet
returned; when writing take actual bytes in the packet
0x00舵机处于正常工作状态,0x01卸载所有舵机,0x11-0x14依次卸载1-4号腿,0x21-0x24
依次恢复
读写
卸载舵机 1-4号腿
0x20 Read-w 0x00
Unmount steering gear 0x00 The steering gear is in normal operation, 0x01 Unmount all gears, 0x11-0x14 Unmount #1-4
rite
leg in order, 0x21-0x24 Remount #1-4 leg in order 调试模式
0x00舵机处于正常工作状态0x01所有舵机记录当前位置为零位 该寄存器设定为0x01后,会自动跳 Test mode
重置舵机零位
写 变为0x00
0x21 Reset the zero position of 0x00
Write 0x00 The steering gear is in normal operation, 0x01 All gears record the current position as the
steering gear
zero position. Once set as 0x01, the register will automatically jump to 0x00
前后移动速度 读写 范围为0x00-0xff,线性对应反向最大值-正向最大值,正方向按机器人坐标系,下同
0x30 Forward/backward movement Read-w 0x80 Range: 0x00-0xff, linearly corresponding to the revers max. value-forward max. value. The
speed rite forward direction is the same as the robot coordinate system, the same below
读写
左右移动速度 整机模式
0x31 Read-w 0x80
Left/right movement speed Whole unit
rite
mode
顺逆时针旋转速度 读写
迎着z轴射来方向顺时针对应最大值方向
0x32 Clockwise/counterclockwise Read-w 0x80
The incidence direction along the z axis corresponds to the max. value direction clockwise
rotation speed rite
0x33 身体沿x方向平移距离 读写 0x80 足端与地面接触点不变而身体扭动,下同
Body shift distance along the x Read-w The body twists with the area where the foot contacts the floor remains unchanged, the same
direction rite below
身体沿y方向平移距离 读写
0x34 Body shift distance along the y Read-w 0x80
direction rite
读写
身体高度
0x35 Read-w 0x80
Body height
rite
身体绕x轴旋转角度 读写
0x36 Angle at which the body Read-w 0x80
rotates around the x axis rite
身体绕y轴旋转角度 读写 迎着坐标轴射来方向顺时针对应最大值方向
0x37 Angle at which the body Read-w 0x80 The incidence direction along the coordinate system corresponds to the max. value direction
rotates around the y axis rite clockwise
身体绕z轴旋转角度 读写
0x38 Angle at which the body Read-w 0x80
rotates around the z axis rite
以一定周期绕x轴旋转身体 读写
0x39 A given period in which the Read-w 0x00
body rotates around the x axis rite
以一定周期绕y轴旋转身体 读写 0x00停止,0x01-0xff线性对应最小-最大旋转速度 ,该功能与直接设置位置寄存器不能同时起作用
0x3A A given period in which the Read-w 0x00 0x00 stop, 0x01-0xff linearly corresponds to the min.-max. rotation speed, this function cannot
body rotates around the y axis rite work alongside with the direct setup of the position register
以一定周期绕z轴旋转身体 读写
0x3B A given period in which the Read-w 0x00
body rotates around the z axis rite
0x3C 原地踏步 读写 0x00 0x00停止,0x01-0xff线性对应最小-最大踏步高度
Stepping Read-w 0x00 stop, 0x01-0xff linearly corresponds to the min.-max. stepping height
rite
读写
运动模式 0x00常速运动0x01慢速运动0x02高速运动
0x3D Read-w 0x00
Moving mode 0x00 Move at normal speed 0x01 Move at slow speed 0x02 Move at high speed
rite
动作指令表, 0为默认站姿 1-N为各个动作(0-N为十进制),1趴下,2站起,3匍匐前进,4转圈,
5原地
踏步,6蹲起,7转动Roll,8转动Pitch,9转动Yaw,10三轴转动,11撒尿,12坐下,13
招手,14伸懒腰,
15波浪,16左右摇摆,17求食,18找食物,19握手
动作指令 写
0x3E 0x00 List of action commands, 0 is the default stance 1-N means each action (0-N is decimal value), 1:
Action command Write
lying down, 2: standing up, 3: creeping, 4: circling, 5: stepping, 6: squatting, 7: rolling , 8: pitching,
9: yawing, 10 three-axis rotation, 11 peeing, 12 sitting, 13 beckoning, 14: stretching, 15: waving,
16 swaying, 17 begging for food, 18 searching food, 19 shaking hands
以一定周期沿X轴方向平移运动 读写
0x80 A given period in which the Read-w 0x00
body shifts along the X axis rite
0x00停止,0x01-0xff对应最小-最大旋转速度,移动幅度为位置限幅的一半
以一定周期沿Y轴方向平移运动 读写
0x00 stop, 0x01-0xff corresponds to the min.-max. rotation speed, the extent of movement is a
0x81 A given period in which the Read-w 0x00
half of the position limit
body shifts along the Y axis rite
以一定周期沿Z轴方向平移运动 读写
0x82 A given period in which the Read-w 0x00
body shifts along the Z axis rite
左前腿x方向足端位置 读写
0x40 Foot position along the x Read-w 0x80
direction of the left fore leg rite 范围为0x00-0xff,线性对应反向最大值-正向最大值,正方向按机器人坐标系 单腿模式
左前腿y方向足端位置 读写 Range: 0x00-0xff, linearly corresponding to the reverse max. value-forward max. value, the Single leg
0x41 Foot position along the y Read-w 0x80 forward direction is the same as the robot coordinate system mode
direction of the left fore leg rite
左前腿z方向足端位置 读写
0x42 Foot position along the z Read-w 0x80
direction of the left fore leg rite
右前腿x方向足端位置 读写
0x43 Foot position along the x Read-w 0x80
direction of the right fore leg rite
右前腿y方向足端位置 读写
0x44 Foot position along the y Read-w 0x80
direction of the right fore leg rite
右前腿z方向足端位置 读写
0x45 Foot position along the z Read-w 0x80
direction of the right fore leg rite
右后腿x方向足端位置 读写
0x46 Foot position along the x Read-w 0x80
direction of the right rear leg rite
右后腿y方向足端位置 读写
0x47 Foot position along the y Read-w 0x80
direction of the right rear leg rite
右后腿z方向足端位置 读写
0x48 Foot position along the z Read-w 0x80
direction of the right rear leg rite
左后腿x方向足端位置 读写
0x49 Foot position along the x Read-w 0x80
direction of the left rear leg rite
左后腿y方向足端位置 读写
0x4A Foot position along the y Read-w 0x80
direction of the left rear leg rite
左后腿z方向足端位置 读写
0x4B Foot position along the z Read-w 0x80
direction of the left rear leg rite
左前腿肘,ID为11舵机位置 读写
0x50 Left fore leg elbow, ID is the Read-w 0x80
position of #11 gear rite
左前腿臂,ID为12舵机位置Left 读写
0x51 fore leg arm, ID is the position Read-w 0x80
of #12 gear rite
左前腿肩,ID为13舵机位置 读写
0x52 Left fore leg shoulder, ID is the Read-w 0x80
position of #13 gear rite
右前腿肘,ID为21舵机位置 读写
0x53 Right fore leg elbow, ID is the Read-w 0x80
position of #21 gear rite 舵机模式
范围为0x00-0xff,线性对应反向最大值-正向最大值
右前腿臂,ID为22舵机位置 读写 Steering gear
Range: 0x00-0xff, linearly corresponding to the reverse max. value-forward max. value
0x54 Right fore leg arm, ID is the Read-w 0x80 mode
position of #22 gear rite
右前腿肩,ID为23舵机位置 读写
0x55 Right fore leg shoulder, ID is Read-w 0x80
the position of #23 gear rite
右后腿肘,ID为31舵机位置 读写
0x56 Right rear leg elbow, ID is the Read-w 0x80
position of #31 gear rite
右后腿臂,ID为32舵机位置 读写
0x57 Right rear leg arm, ID is the Read-w 0x80
position of #32 gear rite
右后腿肩,ID为33舵机位置 读写
0x58 Right rear leg shoulder, ID is Read-w 0x80
the position of #33 gear rite
左后腿肘,ID为41舵机位置 读写
0x59 Left rear leg elbow, ID is the Read-w 0x80
position of #41 gear rite
左后腿臂,ID为42舵机位置 读写
0x5A Right rear leg arm, ID is the Read-w 0x80
position of #42 gear rite
左后腿肩,ID为43舵机位置 读写
0x5B Right rear leg shoulder, ID is Read-w 0x80
the position of #43 gear rite
读写 范围为0x00-0xff,线性对应最小值-最大值(仅在该模式下有效)
设置舵机速度
0x5C Read-w 0x80 Range: 0x00-0xff, linearly corresponding to the min. - max. value (only applicable under this
Set the speed of steering gear
rite mode)
舵机位置设置为站立姿态 0x00不起作用0x01舵机位置恢复站立时位置 该寄存器设定为0x01后,会自动跳变为0x00
写
0x5D The gear position is set as 0x00 0x00 inactive. 0x01 The gear position returns to the standing position. Once set as 0x01, the
Write
standing posture register will automatically jump to 0x00
读写
IMU状态 0x00关闭 0x01自稳定模式
0x61 Read-w 0x00
IMU state 0x00 close 0x01 self-stabilizing mode
rite