Motion Control State Interface
Basic State Switching Interface
Section titled “Basic State Switching Interface”Switching between basic robot states is achieved by sending corresponding commands, as shown below (state values are noted in parentheses).

Key commands:
| Command | Code | Value | Type | Function |
|---|---|---|---|---|
| Stand/Sit | 0x21010202 | - | 0 | Switch between sitting and standing |
| Stop STOP | 0x21020C0E | - | 0 | Trigger software emergency stop |
| Home | 0x21010C05 | - | 0 | Initialize robot joints |
Axis Command Interface
Section titled “Axis Command Interface”Axis commands are outputs from the left and right joystick X and Y axes, with a value range of [-32767, 32767]. Axis commands should be sent at a frequency no lower than 20Hz. The axis command timeout is 250ms; when the robot doesn’t receive axis commands for more than 250ms, it will automatically stop moving.
Axis Commands in In-Place Mode
Section titled “Axis Commands in In-Place Mode”In in-place mode, the client sends axis commands to the motion host to control the robot’s body posture. If no axis command is received for more than one second, the system considers the command expired and the robot returns to normal standing posture. If the axis command value is within the dead zone, it is treated as 0.
| Command Name | Code | Type | Dead Zone | Function |
|---|---|---|---|---|
| Adjust roll angle | 0x21010131 | 0 | [-12553, 12553] | Positive value rolls right |
| Adjust pitch angle | 0x21010130 | 0 | [-6553, 6553] | Positive value looks down |
| Adjust body height | 0x21010102 | 0 | [-20000, 20000] | Positive value raises body |
| Adjust yaw angle | 0x21010135 | 0 | [-9553, 9553] | Positive value rotates right |
Axis Commands in Mobile Mode
Section titled “Axis Commands in Mobile Mode”In mobile mode, axis commands control the robot’s movement direction and speed. When the axis command value is within the dead zone, it is treated as 0 and the robot stops. The sign of the axis command determines the speed direction.
| Command Name | Code | Type | Dead Zone | Function |
|---|---|---|---|---|
| Lateral movement | 0x21010131 | 0 | [-12553, 12553] | Desired linear velocity on y-axis, positive right |
| Forward/backward | 0x21010130 | 0 | [-6553, 6553] | Desired linear velocity on x-axis, positive forward |
| Left/right turn | 0x21010135 | 0 | [-9553, 9553] | Desired angular velocity, positive right turn |
Stop Command
Section titled “Stop Command”During robot movement, if the axis command is 0, the robot will stop moving.
Motion Mode Switching Interface
Section titled “Motion Mode Switching Interface”| Command Name | Code | Value | Type |
|---|---|---|---|
| Posture mode | 0x21010D05 | - | 0 |
| Motion mode | 0x21010D06 | - | 0 |
Gait Switching Interface
Section titled “Gait Switching Interface”Gait can be adjusted when the robot is in motion mode.
| Command | Code | Value | Type | Function |
|---|---|---|---|---|
| Low gear flat ground gait | 0x21010300 | - | 0 | Switch to low-speed gait |
| Medium gear flat ground gait | 0x21010307 | - | 0 | Switch to medium-speed gait |
| High gear flat ground gait | 0x21010303 | - | 0 | Switch to high-speed gait |
| Crawl gear flat ground gait | 0x21010406 | - | 0 | Switch to low-speed crawl gait, or from crawl to normal low-speed |
| Grip RUG gait | 0x21010402 | - | 0 | Switch to grip gait |
| Normal RUG gait | 0x21010401 | - | 0 | Switch to normal gait |
| High-step RUG gait | 0x21010407 | - | 0 | Switch to high-step gait |
The robot’s current gait can be read via the robot_gait_state field. For state value definitions, see State Machine Overview and Implementation.
Velocity Interface
Section titled “Velocity Interface”Velocity commands are complex commands. Each velocity command carries double-precision floating-point data values and must be sent when the robot is in navigation mode.
| Command Name | Code | Type | Value Range |
|---|---|---|---|
| Angular velocity (rad/s) | 0x0141 | 1 | [-1.5, 1.5] |
| Robot x-axis linear velocity (m/s) | 0x0140 | 1 | [-1.0, 1.0] |
| Robot y-axis linear velocity (m/s) | 0x0145 | 1 | [-0.5, 0.5] |
Robot State Information
Section titled “Robot State Information”The command code for robot state information:
| Code | Type | Data Content | Send Frequency |
|---|---|---|---|
| 0x0901 | 1 | Struct RobotStateUpload (see below) | 50 Hz |
struct RobotStateUpload{ int robot_basic_state; int robot_gait_state; double rpy[3]; double rpy_vel[3]; double xyz_acc[3]; double pos_world[3]; double vel_world[3]; double vel_body[3]; unsigned touch_down_and_stair_trot; bool is_charging; unsigned error_state; int robot_motion_state; double battery_level; int task_state; bool is_robot_need_move; bool zero_position_flag; double ultrasound[2];};Field descriptions:
| Field | Type | Description |
|---|---|---|
| robot_basic_state | int | Robot basic motion state |
| robot_gait_state | int | Robot current gait |
| rpy[3] | double | IMU angle information |
| rpy_vel[3] | double | IMU angular velocity information |
| xyz_acc[3] | double | IMU acceleration information |
| pos_world[3] | double | Robot pose in world coordinate system |
| vel_world[3] | double | Robot velocity in world coordinate system |
| vel_body[3] | double | Robot velocity in body coordinate system |
| touch_down_and_stair_trot | unsigned | Invalid data, placeholder only |
| is_charging | bool | Invalid data, placeholder only |
| error_state | unsigned | Invalid data, placeholder only |
| robot_motion_state | int | Robot motion action state |
| battery_level | double | Battery level as decimal fraction |
| task_state | int | Invalid data, placeholder only |
| is_robot_need_move | bool | Balance state when affected by external force |
| zero_position_flag | bool | Homing flag |
| ultrasound[2] | double | Ultrasonic data |
Robot Basic Motion State
Section titled “Robot Basic Motion State”| Value | Robot Basic Motion State |
|---|---|
| 1 | Lying down |
| 4 | Preparing to stand |
| 5 | Standing up |
| 6 | Force control |
| 7 | Lying down in progress |
| 8 | Loss-of-control protection |
| 9 | Posture adjustment |
| 11 | Performing turn-over |
| 17 | Homing |
| 18 | Performing backflip |
| 20 | Performing wave |
Note: For basic state transition relationships, refer to Basic State Switching Interface.
Robot Gait
Section titled “Robot Gait”| Value | Gait |
|---|---|
| 0 | Flat ground low-speed gait |
| 2 | General obstacle-crossing gait |
| 4 | Flat ground medium-speed gait |
| 5 | Flat ground high-speed gait |
| 6 | Grip obstacle-crossing gait |
| 12 | Moonwalk gait |
| 13 | High-step obstacle-crossing gait |
IMU Angle Information
Section titled “IMU Angle Information”double rpy[3] = {roll, pitch, yaw};
| Element | Description |
|---|---|
| roll | IMU roll angle in world coordinate system (°) |
| pitch | IMU pitch angle in world coordinate system (°) |
| yaw | IMU yaw angle in world coordinate system (°) |
IMU Angular Velocity Information
Section titled “IMU Angular Velocity Information”double rpy_vel[3] = {roll_vel, pitch_vel, yaw_vel};
| Element | Description |
|---|---|
| roll_vel | IMU roll angular velocity in world coordinate system (rad/s) |
| pitch_vel | IMU pitch angular velocity in world coordinate system (rad/s) |
| yaw_vel | IMU yaw angular velocity in world coordinate system (rad/s) |
IMU Acceleration Information
Section titled “IMU Acceleration Information”double xyz_acc[3] = {x_acc, y_acc, z_acc};
| Element | Description |
|---|---|
| x_acc | IMU acceleration on world x-axis (m/s²) |
| y_acc | IMU acceleration on world y-axis (m/s²) |
| z_acc | IMU acceleration on world z-axis (m/s²) |
World Coordinate System Pose
Section titled “World Coordinate System Pose”double pos_world[3] = {x, y, yaw};
| Element | Description |
|---|---|
| x | Robot x-axis position in world coordinate system (m) |
| y | Robot y-axis position in world coordinate system (m) |
| yaw | Robot yaw angle in world coordinate system (rad) |
World Coordinate System Velocity
Section titled “World Coordinate System Velocity”double vel_world[3] = {x_vel, y_vel, yaw_vel};
| Element | Description |
|---|---|
| x_vel | Robot velocity on world x-axis (m/s) |
| y_vel | Robot velocity on world y-axis (m/s) |
| yaw_vel | Robot yaw angular velocity in world coordinate system (rad/s) |
Body Coordinate System Velocity
Section titled “Body Coordinate System Velocity”double vel_body[3] = {x_vel, y_vel, yaw_vel};
| Element | Description |
|---|---|
| x_vel | Robot velocity on body x-axis (m/s) |
| y_vel | Robot velocity on body y-axis (m/s) |
| yaw_vel | Robot yaw angular velocity in body coordinate system (rad/s) |
Robot Motion Action State
Section titled “Robot Motion Action State”| Value | Robot Motion Action State |
|---|---|
| 0 | Robot is in the state corresponding to robot_basic_state |
| 1 | Robot is stepping with gait corresponding to robot_gait_state |
| 2 | Robot is performing body twist |
| 4 | Robot is performing twist jump |
| 11 | Robot is performing forward jump |
Note: The robot’s complete state is determined by
robot_basic_state,robot_gait_state, androbot_motion_statetogether.
Balance State
Section titled “Balance State”| Value | Balance State |
|---|---|
| 0 | Can maintain balance |
| 1 | Cannot maintain balance, stepping to adjust posture |
Homing State
Section titled “Homing State”| Value | Homing State |
|---|---|
| 0 | Homing not completed or exited homing state |
| 1 | Homing completed |
Ultrasonic Data
Section titled “Ultrasonic Data”double ultrasound[2] = {forward_distance, backward_distance};
| Element | Description |
|---|---|
| forward_distance | Distance to obstacle in front of robot (m) |
| backward_distance | Distance to obstacle behind robot (m) |
Note: Ultrasonic effective range is [0.28m, 4.50m]. When obstacle distance is less than 0.28m, it displays 0.28m; when greater than 4.50m, it displays 4.50m.