Kuavo Docs
Development InterfacesPython SDK Guide

Robot Movement and Gait Control Interfaces

The KUAVO Humanoid WebSocket SDK provides comprehensive interfaces for robot movement and gait control, 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 system
  • command_pose: pose control state in the robot coordinate system

State transition rules:

  • stance <-> walk
  • stance <-> custom_gait
  • stance <-> command_pose_world
  • stance <-> command_pose

Basic Movement Interfaces

walk

Function NameFunction Prototype
OverviewControls continuous walking of the robot
Parameters
linear_xfloat: linear velocity along the x-axis, range [-0.4, 0.4] m/s
linear_yfloat: linear velocity along the y-axis, range [-0.2, 0.2] m/s
angular_zfloat: angular velocity around the z-axis, range [-0.4, 0.4] rad/s
Return Valuebool: returns True on success, False on failure
Notes1. 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 NameFunction Prototype
OverviewControls the robot to walk step by step to a target position
Parameters
target_poselist: target pose [x, y, z, yaw] (units: meters, radians)
dtfloat: time interval per step, default 0.4 seconds
is_left_first_defaultbool: whether the left foot steps first, default True
collision_checkbool: whether to perform collision checking, default True
Return Valuebool: returns True on success, False on failure
Notes1. 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 NameFunction Prototype
OverviewControls the robot pose in the robot coordinate system
Parameters
target_pose_xfloat: position along the x-axis (meters)
target_pose_yfloat: position along the y-axis (meters)
target_pose_zfloat: position along the z-axis (meters)
target_pose_yawfloat: yaw angle (radians)
Return Valuebool: returns True on success, False on failure

control_command_pose_world

Function NameFunction Prototype
OverviewControls the robot pose in the world coordinate system
Parameters
target_pose_xfloat: position along the x-axis (meters)
target_pose_yfloat: position along the y-axis (meters)
target_pose_zfloat: position along the z-axis (meters)
target_pose_yawfloat: yaw angle (radians)
Return Valuebool: returns True on success, False on failure

Gait Mode Interfaces

stance

Function NameFunction Prototype
OverviewPuts the robot into standing mode
Return Valuebool: returns True if the switch succeeds, False on failure
Notes1. You can call KuavoRobotState.wait_for_stance() to wait until the robot enters standing mode
2. When switching from the walk state, the robot decelerates first and then stops

stop

Function NameFunction Prototype
OverviewStops all motion of the robot
Return Valuebool: returns True on success, False on failure
Notes1. 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: /home/lab/kuavo-ros-opensource/src/kuavo_humanoid_websocket_sdk/examples/atomic_skills/motion_example.py

Demonstrates how to use the SDK to control the robot in a variety of basic motions, including standing, walking, and turning.

It supports moving forward, moving backward, turning in place, and other actions, and outputs pose information in real time, making it suitable for testing the robot's chassis and gait control capabilities.

The example code mainly demonstrates the following features:

  1. Basic motion control:

    • Standing: stance() controls the robot to stand
    • Walking: walk() controls the robot to move forward/backward
    • Turning in place: control the robot to turn in place via the angular_z parameter of walk()
  2. Motion parameter settings:

    • Linear velocity: adjust the linear_x and linear_y parameters of the walk() function to control forward/backward and lateral movement speed
    • Angular velocity: adjust the angular_z parameter of the walk() function to control turning speed
  3. Motion state monitoring:

    • Obtain the robot's position and orientation in real time via robot_state.odometry
    • Supports waiting for an action to complete before executing the next action
    • Press Ctrl+C to terminate motion at any time
  4. Motion examples:

    • Move forward for 8 seconds at 0.3 m/s
    • Move 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: /home/lab/kuavo-ros-opensource/src/kuavo_humanoid_websocket_sdk/examples/atomic_skills/step_control_example.py

Demonstrates how to control robot movement in a step-by-step manner.

Use the step_by_step() function to achieve precise step-by-step control of the robot. The example code shows:

  1. Ensure the robot is in the standing state
  2. Step forward 0.8 meters
  3. Wait for the robot to return to the standing state
  4. 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 for the state transition