Robot Movement and Gait Control Interfaces
The Humanoid SDK provides comprehensive robot movement and gait control interfaces, supporting multiple motion modes and gait switching. These interfaces are encapsulated in the KuavoRobot class, giving developers a simple and intuitive way to call them.
Gait State Description
The robot supports the following gait states:
- stance: standing state
- walk: walking state
- custom_gait: custom gait state
- command_pose_world: pose control state in the world coordinate frame
- command_pose: pose control state in the robot coordinate frame
State transition rules:
- stance <-> walk
- stance <-> custom_gait
- stance <-> command_pose_world
- stance <-> command_pose
Basic Movement Interfaces
walk
| Function Name | Function Prototype |
|---|---|
| Overview | Control the robot to walk continuously |
| Parameters | |
linear_x | float: Linear velocity along the x-axis, range [-0.4, 0.4] m/s |
linear_y | float: Linear velocity along the y-axis, range [-0.2, 0.2] m/s |
angular_z | float: Angular velocity around the z-axis, range [-0.4, 0.4] rad/s |
| Return Value | bool: Returns True on success, False on failure |
| Notes | 1. The robot must be in the walk state before calling 2. When stopping walking, it is recommended to decelerate first and then stop |
step_by_step
| Function Name | Function Prototype |
|---|---|
| Overview | Control the robot to walk one step at a time to a target position |
| Parameters | |
target_pose | list: Target pose [x, y, z, yaw] (units: meters, radians) |
dt | float: Time interval per step, default 0.4 seconds |
is_left_first_default | bool: Whether to step with the left foot first, default True |
collision_check | bool: Whether to perform collision checking, default True |
| Return Value | bool: Returns True on success, False on failure |
| Notes | 1. Ensure the target position is safe and reachable 2. It is recommended to enable collision checking 3. The target pose must contain 4 elements |
control_command_pose
| Function Name | Function Prototype |
|---|---|
| Overview | Control the robot pose in the robot coordinate frame |
| Parameters | |
target_pose_x | float: Position along the x-axis (meters) |
target_pose_y | float: Position along the y-axis (meters) |
target_pose_z | float: Position along the z-axis (meters) |
target_pose_yaw | float: Yaw angle (radians) |
| Return Value | bool: Returns True on success, False on failure |
control_command_pose_world
| Function Name | Function Prototype |
|---|---|
| Overview | Control the robot pose in the world coordinate frame |
| Parameters | |
target_pose_x | float: Position along the x-axis (meters) |
target_pose_y | float: Position along the y-axis (meters) |
target_pose_z | float: Position along the z-axis (meters) |
target_pose_yaw | float: Yaw angle (radians) |
| Return Value | bool: Returns True on success, False on failure |
Gait Mode Interfaces
stance
| Function Name | Function Prototype |
|---|---|
| Overview | Make the robot enter standing mode |
| Return Value | bool: Returns True on success, False on failure |
| Notes | 1. You can call KuavoRobotState.wait_for_stance() to wait until standing mode is entered2. When switching from the walk state, the robot decelerates first and then stops |
stop
| Function Name | Function Prototype |
|---|---|
| Overview | Stop all robot motion |
| Return Value | bool: Returns True on success, False on failure |
| Notes | 1. In an emergency, call this function immediately to stop the robot 2. When stopping from the walk state, the robot decelerates first and then stops |
For detailed examples, please refer to the SDK example code:
Velocity control: <kuavo-ros-opensource>/src/kuavo_humanoid_websocket_sdk/examples/atomic_skills/motion_example.py
Demonstrates how to use the SDK to control the robot through a variety of basic motions, including standing, walking, and turning.
It supports actions such as walking forward, walking backward, and turning in place, and outputs pose information in real time. It is suitable for testing the robot's chassis and gait control capabilities.
The example code mainly demonstrates the following features:
-
Basic motion control:
- Standing:
stance()controls the robot to stand - Walking:
walk()controls the robot to walk forward/backward - Turning in place: use the angular_z parameter of
walk()to control the robot to turn in place
- Standing:
-
Motion parameter settings:
- Linear velocity: adjust the
linear_xandlinear_yparameters of thewalk()function to control forward/backward and lateral movement speed - Angular velocity: adjust the
angular_zparameter of thewalk()function to control turning speed
- Linear velocity: adjust the
-
Motion state monitoring:
- Obtain the robot's position and orientation information in real time via
robot_state.odometry - Supports waiting for an action to complete before executing the next one
- Press Ctrl+C to terminate motion at any time
- Obtain the robot's position and orientation information in real time via
-
Motion examples:
- Walk forward for 8 seconds at 0.3 m/s
- Walk backward for 8 seconds at -0.3 m/s
- Turn left in place for 8 seconds at an angular velocity of 0.4 rad/s
- Turn right in place for 8 seconds at an angular velocity of -0.4 rad/s
Single-step control: <kuavo-ros-control>/src/kuavo_humanoid_websocket_sdk/examples/atomic_skills/step_control_example.py
Demonstrates how to control robot movement in a step-by-step manner.
It uses the step_by_step() function to achieve precise step-by-step control of the robot. The example code shows:
- Ensure the robot is in the standing state
- Step forward 0.8 meters
- Wait for the robot to return to the standing state
- Step another 0.2 meters and rotate 90 degrees
Notes:
- Step-by-step control can only be used in standing mode
- After each step, you need to wait for the robot to return to the standing state
- You can set a timeout for waiting on the state transition