Skip to content

Motion Control State Interface

Switching between basic robot states is achieved by sending corresponding commands, as shown below (state values are noted in parentheses).

Basic State Switching Diagram

Key commands:

CommandCodeValueTypeFunction
Stand/Sit0x21010202-0Switch between sitting and standing
Stop STOP0x21020C0E-0Trigger software emergency stop
Home0x21010C05-0Initialize robot joints

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.

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 NameCodeTypeDead ZoneFunction
Adjust roll angle0x210101310[-12553, 12553]Positive value rolls right
Adjust pitch angle0x210101300[-6553, 6553]Positive value looks down
Adjust body height0x210101020[-20000, 20000]Positive value raises body
Adjust yaw angle0x210101350[-9553, 9553]Positive value rotates right

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 NameCodeTypeDead ZoneFunction
Lateral movement0x210101310[-12553, 12553]Desired linear velocity on y-axis, positive right
Forward/backward0x210101300[-6553, 6553]Desired linear velocity on x-axis, positive forward
Left/right turn0x210101350[-9553, 9553]Desired angular velocity, positive right turn

During robot movement, if the axis command is 0, the robot will stop moving.

Command NameCodeValueType
Posture mode0x21010D05-0
Motion mode0x21010D06-0

Gait can be adjusted when the robot is in motion mode.

CommandCodeValueTypeFunction
Low gear flat ground gait0x21010300-0Switch to low-speed gait
Medium gear flat ground gait0x21010307-0Switch to medium-speed gait
High gear flat ground gait0x21010303-0Switch to high-speed gait
Crawl gear flat ground gait0x21010406-0Switch to low-speed crawl gait, or from crawl to normal low-speed
Grip RUG gait0x21010402-0Switch to grip gait
Normal RUG gait0x21010401-0Switch to normal gait
High-step RUG gait0x21010407-0Switch 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 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 NameCodeTypeValue Range
Angular velocity (rad/s)0x01411[-1.5, 1.5]
Robot x-axis linear velocity (m/s)0x01401[-1.0, 1.0]
Robot y-axis linear velocity (m/s)0x01451[-0.5, 0.5]

The command code for robot state information:

CodeTypeData ContentSend Frequency
0x09011Struct 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:

FieldTypeDescription
robot_basic_stateintRobot basic motion state
robot_gait_stateintRobot current gait
rpy[3]doubleIMU angle information
rpy_vel[3]doubleIMU angular velocity information
xyz_acc[3]doubleIMU acceleration information
pos_world[3]doubleRobot pose in world coordinate system
vel_world[3]doubleRobot velocity in world coordinate system
vel_body[3]doubleRobot velocity in body coordinate system
touch_down_and_stair_trotunsignedInvalid data, placeholder only
is_chargingboolInvalid data, placeholder only
error_stateunsignedInvalid data, placeholder only
robot_motion_stateintRobot motion action state
battery_leveldoubleBattery level as decimal fraction
task_stateintInvalid data, placeholder only
is_robot_need_moveboolBalance state when affected by external force
zero_position_flagboolHoming flag
ultrasound[2]doubleUltrasonic data
ValueRobot Basic Motion State
1Lying down
4Preparing to stand
5Standing up
6Force control
7Lying down in progress
8Loss-of-control protection
9Posture adjustment
11Performing turn-over
17Homing
18Performing backflip
20Performing wave

Note: For basic state transition relationships, refer to Basic State Switching Interface.

ValueGait
0Flat ground low-speed gait
2General obstacle-crossing gait
4Flat ground medium-speed gait
5Flat ground high-speed gait
6Grip obstacle-crossing gait
12Moonwalk gait
13High-step obstacle-crossing gait

double rpy[3] = {roll, pitch, yaw};

ElementDescription
rollIMU roll angle in world coordinate system (°)
pitchIMU pitch angle in world coordinate system (°)
yawIMU yaw angle in world coordinate system (°)

double rpy_vel[3] = {roll_vel, pitch_vel, yaw_vel};

ElementDescription
roll_velIMU roll angular velocity in world coordinate system (rad/s)
pitch_velIMU pitch angular velocity in world coordinate system (rad/s)
yaw_velIMU yaw angular velocity in world coordinate system (rad/s)

double xyz_acc[3] = {x_acc, y_acc, z_acc};

ElementDescription
x_accIMU acceleration on world x-axis (m/s²)
y_accIMU acceleration on world y-axis (m/s²)
z_accIMU acceleration on world z-axis (m/s²)

double pos_world[3] = {x, y, yaw};

ElementDescription
xRobot x-axis position in world coordinate system (m)
yRobot y-axis position in world coordinate system (m)
yawRobot yaw angle in world coordinate system (rad)

double vel_world[3] = {x_vel, y_vel, yaw_vel};

ElementDescription
x_velRobot velocity on world x-axis (m/s)
y_velRobot velocity on world y-axis (m/s)
yaw_velRobot yaw angular velocity in world coordinate system (rad/s)

double vel_body[3] = {x_vel, y_vel, yaw_vel};

ElementDescription
x_velRobot velocity on body x-axis (m/s)
y_velRobot velocity on body y-axis (m/s)
yaw_velRobot yaw angular velocity in body coordinate system (rad/s)
ValueRobot Motion Action State
0Robot is in the state corresponding to robot_basic_state
1Robot is stepping with gait corresponding to robot_gait_state
2Robot is performing body twist
4Robot is performing twist jump
11Robot is performing forward jump

Note: The robot’s complete state is determined by robot_basic_state, robot_gait_state, and robot_motion_state together.

ValueBalance State
0Can maintain balance
1Cannot maintain balance, stepping to adjust posture
ValueHoming State
0Homing not completed or exited homing state
1Homing completed

double ultrasound[2] = {forward_distance, backward_distance};

ElementDescription
forward_distanceDistance to obstacle in front of robot (m)
backward_distanceDistance 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.