Skip to content

Motion Control and Status Interface

Send motion control commands to the navigation host (192.168.1.106:30000) via the TCP body monitoring protocol.

Type Field ValueMessage Type
2Motion control
Command Field ValueMessage Command
1Move forward
2Move backward
3Turn left
4Turn right
6Zero velocity
11Strafe left
12Strafe right
13Soft emergency stop
14Stop motion
15Lie down
16Stand up
18Start motion
20Switch gait

Note: When controlling robot motion using this protocol, the robot will automatically switch to the required mode (navigation mode). Some commands support step-skipping: for example, when the robot is in the lying down state, sending a start motion command will cause the robot to automatically stand up and start moving.

<?xml version="1.0" encoding="UTF-8"?>
<PatrolDevice>
<Type>2</Type>
<Command>1</Command>
<Time>2023-01-01 00:00:00</Time>
<Items>
<Value>-1</Value>
</Items>
</PatrolDevice>
ParameterPreconditionMeaningValue Description
ValueCommand=1Set forward velocity (m/s){-1}∪[0,1.50], default 0.50 when -1
Command=2Set backward velocity (m/s){-1}∪[0,1.30], default 0.50 when -1
Command=3Set left turn angular velocity (rad/s){-1}[0,0.45], default 0.35 when -1
Command=4Set right turn angular velocity (rad/s){-1}∪[0,0.45], default 0.35 when -1
Command=11Set left strafe velocity (m/s){-1}∪[0,0.15], default 0.10 when -1
Command=12Set right strafe velocity (m/s){-1}∪[0,0.15], default 0.10 when -1
Command=20Switch gaitWalking gait=0, Normal stair gait=1, Slope/anti-slip gait=2, Perception stair gait=4, L-walking gait=100, Mountain gait=101, L-stair gait=102

Note: Axis commands (Command=1, 2, 3, 4, 6, 11, 12) and gait switch commands (Command=20) are only supported when the robot is in stepping state or RL state. The request message frequency for controlling translation or rotation is 3Hz~5Hz.

Robot basic states are switched via UDP commands, with the target address 192.168.1.103:43893.

The following diagram shows the robot basic state transition diagram. Dashed arrows indicate that in any basic state, the robot may transition to the soft emergency stop/fall state due to an unexpected accident.

Robot basic state transition diagram

Command NameCommand CodeCommand Function
Stand up / Lie down0x21010202Toggle between lying down and initial standing state
Force control mode0x2101020ASwitch from initial standing to force-controlled standing
Start motion / Stop motion0x21010201Toggle between force-controlled standing and stepping state
Soft emergency stop0x21010C0EImmediately lie down, enter joint protection state

Basic motion state values (obtained via RcsData or ROS topic /robot_basic_state):

State ValueStatus
0Lying down
1Standing up
2Initial standing
3Force-controlled standing
4Stepping
5Lying down
6Soft emergency stop / Fall
16RL state

Note: Sending state switch commands cannot override the original control logic. For example, when the robot is in the lying down state, sending a start motion command will not take effect. The control logic follows the robot’s own motion logic.

The control mode determines the source of velocity commands the robot responds to:

Command NameCommand CodeCommand Function
Manual mode0x21010C02Robot responds to joystick velocity commands (joystick axis commands)
Non-manual mode0x21010C03Distinguish between assist mode and navigation mode based on height map velocity input source

Get the current control mode via ROS topic /control_mode: 0 = Manual mode, 1 = Non-manual mode.

The robot can switch gaits while in stepping state to adapt to different terrains.

GaitCommand Code
Walking gait0x21010300
Slope gait0x21010402
Obstacle-clearing gait0x21010401
Stair gait (solid ground / hollow ground / stairs without risers mode)0x21010405
Stair gait (accumulated frame mode)0x2101040A
45° stair gait (accumulated frame mode)0x2101040B
L-walking gait0x21010420
Mountain gait0x21010421
Silent gait0x21010422
L-stair gait0x21010424

Get the current gait value via ROS topic /robot_gait_state.

Note: Each stair gait can only be used in its corresponding height map mode. When the robot body height is at crawl height, only walking gait and slope gait are supported. When using L-walking, mountain, silent, or L-stair gait, changing the robot body height and height map mode is not supported.

Axis commands are the X-axis and Y-axis outputs from the left and right joysticks, with a value range of [−32767,32767][-32767, 32767]. The axis command frequency is 50Hz.

Axis Commands in Force-Controlled Standing State

Section titled “Axis Commands in Force-Controlled Standing State”

In force-controlled standing state, sending axis commands to the motion host can control the robot to change body posture. If the command times out, the robot will return to normal standing posture.

Command NameCommand CodeCommand TypeCommand Function
Left joystick X-axis0x210101310Adjust Roll angle; positive raises left shoulder, negative raises right shoulder
Left joystick Y-axis0x210101300Adjust body height; positive raises body, negative lowers body
Right joystick X-axis0x210101350Adjust Yaw angle; positive turns head right, negative turns head left
Right joystick Y-axis0x210101020Adjust Pitch angle; positive tilts head up, negative tilts head down

When the robot is in stepping state, axis commands can adjust its speed and direction. After receiving axis commands, the robot maps them from the joystick frame to the robot body frame.

Joystick frame and body frame

If the command times out, the robot will stop moving. The function of each axis command is defined as follows:

Left Joystick Y-Axis Command

Command CodeCommand TypeCommand Function
0x210101300Specify desired linear velocity on the robot X-axis; positive for forward translation, negative for backward translation

The relationship between desired linear velocity on the body frame X-axis and left joystick Y-axis value:

vx={0,−655<y<655y32767×vmax⁡,655≤∣y∣≤32767v_{x} = \begin{cases} 0, & -655 < y < 655 \\ \frac{y}{32767} \times v_{\max}, & 655 \leq |y| \leq 32767 \end{cases}

Where vxv_{x} is the desired linear velocity on the body frame X-axis, vmaxv_{max} is the maximum velocity under the current gait limit, and yy is the left joystick Y-axis command value.

Left Joystick X-Axis Command

Command CodeCommand TypeCommand Function
0x210101310Specify desired linear velocity on the robot Y-axis; positive for right strafe, negative for left strafe

The relationship between desired linear velocity on the body frame Y-axis and left joystick X-axis value:

vy={0,−655<x<655(−1)×x32767×vmax⁡,655≤∣x∣≤32767v_{y} = \begin{cases} 0, & -655 < x < 655 \\ (-1) \times \frac{x}{32767} \times v_{\max}, & 655 \leq |x| \leq 32767 \end{cases}

Right Joystick X-Axis Command

Command CodeCommand TypeCommand Function
0x210101350Specify desired angular velocity for robot Yaw; positive for right turn, negative for left turn

The relationship between desired yaw angular velocity and right joystick X-axis value:

ω={0,−655<x<655(−1)×x32767×ωmax⁡,655≤∣x∣≤32767\omega = \begin{cases} 0, & -655 < x < 655 \\ (-1) \times \frac{x}{32767} \times \omega_{\max}, & 655 \leq |x| \leq 32767 \end{cases}

Where ω\omega is the desired Yaw angular velocity, ωmax\omega_{max} is the maximum turning speed under the current gait limit, and xx is the right joystick X-axis command value.

Maximum Velocity Limits per Gait (Normal Body Height)

Section titled “Maximum Velocity Limits per Gait (Normal Body Height)”
Gait (Normal Height)Max Forward SpeedMax Backward SpeedMax Lateral SpeedMax Turning Speed
Walking gait1.5 m/s0.75 m/s0.15 m/s0.45 rad/s
Slope gait0.7 m/s0.75 m/s0.25 m/s0.5 rad/s
Obstacle-clearing gait0.3 m/s0.4 m/s0.1 m/s0.5 rad/s
Stair gait (solid ground mode)0.3 m/s0.3 m/s0.2 m/s0.8 rad/s
Stair gait (hollow ground mode)0.3 m/s0.3 m/s0.2 m/s0.8 rad/s
Stair gait (stairs without risers mode)0.3 m/s0.3 m/s0.2 m/s0.8 rad/s
Stair gait (accumulated frame mode)0.6 m/s0.3 m/s0.2 m/s0.8 rad/s
45° stair gait (accumulated frame mode)0.3 m/s0.2 m/s0.2 m/s0.8 rad/s
L-walking gait1.5 m/s1.0 m/s0.5 m/s1.2 rad/s
Mountain gait1.5 m/s1.0 m/s0.5 m/s1.2 rad/s
L-stair gait0.6 m/s0.3 m/s0.2 m/s0.5 rad/s

The perception host contains three velocity-related topics:

Topic NameDescriptionMessage Type
/handle_stateJoystick velocity commandsgeometry_msgs/Twist
/cmd_velNavigation module planned velocitygeometry_msgs/Twist
/cmd_vel_correctedCorrected velocity from height mapgeometry_msgs/Twist

In assist mode or navigation mode, the motion program executes the velocity commands published in /cmd_vel_corrected. When there are no raw velocity commands from the joystick or navigation module, developers can also directly publish messages on the /cmd_vel_corrected topic to have the motion program execute velocity commands without height map collision detection processing.

The motion host reports status information and joint information via UDP to the communication addresses listed in network.toml. Users can add their own communication addresses as described in the application manual “Communication Parameter Configuration”.

Command CodeCommand TypeData ContentSend Frequency
0x10081RcsData struct200Hz
struct RcsData{
char robot_name[15];
int32_t current_mileage;//Unit : cm
int32_t total_mileage;//Unit : cm
long current_run_time;//Unit : s
long total_run_time;//Unit : s
long current_motion_time;//Unit : s
long total_motion_time;//Unit : s
float joystick[4];
union {
struct {
uint8_t is_nav_mode;
uint8_t emergency_source;
uint8_t mode_reserved[8];
}rcs_state_list;
uint8_t rcs_state[10];
};
union{
struct{
uint32_t imu_error : 1;
uint32_t wifi_error : 1;
uint32_t driver_heat_warn : 1;
uint32_t driver_error: 1;
uint32_t motor_heat_warn : 1;
uint32_t battery_low_warn : 1;
uint32_t battery_heat_warn : 1;
uint32_t gpio_error : 1;
uint32_t cpu_heat_warn : 1;
uint32_t cpu_freq_warn : 1;
uint32_t reserved : 22;
}error_state_bit;
uint32_t error_state;
};
};
FieldTypeMeaning
robot_namechar[15]Robot name
current_mileageint32_tDistance since last boot (cm)
total_mileageint32_tCumulative distance (cm)
current_run_timelongRuntime since last boot (s)
total_run_timelongCumulative runtime (s)
current_motion_timelongMotion time since last boot (s)
total_motion_timelongCumulative motion time (s)
joystickfloat[4]Axis values scaled to [-1.0,1.0]
rcs_stateuint8_t[10]Status feedback
error_stateuint32_tError status

Parameters in the joystick field:

ParameterTypeRangeMeaning
LXfloat[-1.0,1.0]Left joystick X-axis value
LYfloat[-1.0,1.0]Left joystick Y-axis value
RXfloat[-1.0,1.0]Right joystick X-axis value
RYfloat[-1.0,1.0]Right joystick Y-axis value

Parameters in the rcs_state field:

ParameterTypeValue Meaning
is_nav_modeuint8_t0=Manual mode, 1=Non-manual mode
emergency_sourceuint8_t1=Rear soft emergency stop triggered, 2=Auto-triggered during motion, 3=Auto-triggered during navigation, 4=Auto-triggered during autonomous charging, 5=Client-triggered soft emergency stop, 6=RAS auto-triggered soft emergency stop

Each bit of error_state corresponds to a parameter, from LSB to MSB:

ParameterTypeValue Meaning
imu_errorbool0=Normal, 1=IMU update timeout
wifi_errorbool0=Normal, 1=Heartbeat update timeout
driver_heat_warnbool0=Normal, 1=Driver over-temperature
driver_errorbool0=Normal, 1=Driver fault
motor_heat_warnbool0=Normal, 1=Motor over-temperature
battery_low_warnbool0=Normal, 1=Low battery
battery_heat_warnbool0=Normal, 1=Battery over-temperature
gpio_errorbool0=Normal, 1=GPIO fault
cpu_heat_warnbool0=Normal, 1=CPU over-temperature
cpu_freq_warnbool0=Normal, 1=CPU frequency too low
Command CodeCommand TypeData ContentSend Frequency
0x10091MotionStateData struct200Hz
struct MotionStateData{
uint8_t basic_state;
uint8_t gait_state;
float max_forward_vel;
float max_backward_vel;
float leg_odom_pos[3];
float leg_odom_vel[3];
float robot_distance;
unsigned touch_state;
union {
struct{
uint32_t narrow_walk : 1;
uint32_t pose_safe_flag : 1;
uint32_t joint_limit_flag: 1;
uint32_t state_reserved : 29;
}control_state_bit;
uint32_t control_state;
};
union{
struct{
uint8_t auto_charge_state;
uint8_t pos_ctrl_state;
uint8_t task_reserved[8];
}task_state_list;
uint8_t task_state[10];
};
};
FieldTypeMeaning
basic_stateuint8_tRobot basic state
gait_stateuint8_tGait information
leg_odom_posfloat[3]Robot pose in world frame {x, y, yaw}
leg_odom_velfloat[3]Robot velocity in body frame {x_vel, y_vel, yaw_vel}
robot_distancefloatDistance since last boot (cm)
task_stateuint8_t[10]Task status

basic_state values:

ValueRobot Basic State
0Lying down
1Standing up
2Initial standing
3Force-controlled standing
4Stepping
5Lying down
6Soft emergency stop / Fall
16RL state

gait_state values:

ValueGait
0Walking gait
1Obstacle-clearing gait
2Slope gait
3Running gait
6Stair gait (solid ground / hollow ground / stairs without risers mode)
7Stair gait (accumulated frame mode)
845° stair gait (accumulated frame mode)
32L-walking gait
33Mountain gait
34Silent gait
36L-stair gait

Note: The origin of the world frame is the robot’s position at the time of this boot, and its axis orientation is consistent with the robot body frame orientation at boot time.

Send a request to the navigation host (192.168.1.106:30000) via the TCP body monitoring protocol to get the robot’s current basic status information.

Type Field ValueMessage TypeCommand Field ValueMessage Command
1002Get real-time basic status1Default
<?xml version="1.0" encoding="UTF-8"?>
<PatrolDevice>
<Type>1002</Type>
<Command>1</Command>
<Time>2023-01-01 00:00:00</Time>
<Items/>
</PatrolDevice>
<?xml version="1.0" encoding="UTF-8"?>
<PatrolDevice>
<Type>1002</Type>
<Command>1</Command>
<Time>2023-01-01 00:00:01</Time>
<Items>
<MotionState>0</MotionState>
<PosX>0.0</PosX><PosY>0.0</PosY><PosZ>0.0</PosZ>
<Roll>0.0</Roll><Pitch>0.0</Pitch><Yaw>0.0</Yaw>
<Speed>0.0</Speed>
<CurOdom>0.0</CurOdom><SumOdom>0.0</SumOdom>
<Res>0.0</Res><X0>0.0</X0><Y0>0.0</Y0><H>1000</H>
<Electricity>50</Electricity>
<Location>0</Location>
<GaitState>0</GaitState>
<MotorState>0</MotorState>
<ChargeState>0</ChargeState>
<ControlMode>0</ControlMode>
<OnDockState>0</OnDockState>
</Items>
</PatrolDevice>

Parameters in the Items field of the response:

ParameterMeaningData TypeUnitValue Description
MotionStateRobot motion stateint/Lying down=0, Standing up=1, Initial standing=2, Force-controlled standing=3, Stepping=4, Lying down=5, Soft emergency stop=6, Fall=7, RL=16
PosX/PosY/PosZRobot coordinates in map framefloatm
Roll/Pitch/YawRobot orientation in map framefloatrad
SpeedRobot forward moving speedfloatm/s
CurOdomOdometer since last bootfloatkm
SumOdomCumulative odometerfloatkm
ResPhysical length of map image pixelsfloatm
X0X-axis coordinate of map image lower-left corner in map framefloatm
Y0Y-axis coordinate of map image lower-left corner in map framefloatm
HNumber of pixels in map image heightint/
ElectricityRobot battery levelint/[0,100]
LocationRobot localization statusint/Normal=0, Lost=1
GaitStateRobot gaitint/Walking=0, Obstacle-clearing=1, Slope/anti-slip=2, Perception stair=6, Accumulated frame stair=7, Accumulated frame 45° stair=8, L-walking=32, Mountain=33, Silent=34, L-stair=36
MotorStateRobot motor statusint/Normal=0, Over-temperature=1
ChargeStateRobot autonomous charging statusint/Not charging=0, Charging=1
ControlModeRobot control modeint/Manual=0, Auto=1
OnDockStateRobot lying on charging dockint/Not on dock=0, On dock=1

Note: When all parameter values in Items are 0, it indicates that getting the robot’s real-time basic status failed or the localization/navigation program has not started.