Robot Information Retrieval Interfaces
The KUAVO Humanoid WebSocket SDK provides a comprehensive set of interfaces for retrieving robot information, including basic robot information, status information, IMU data, and more. This document describes how to use these interfaces in detail.
Interface Description
KuavoRobotInfo
The KuavoRobotInfo class provides interfaces for retrieving basic robot information.
Property Interfaces
| Property Name | robot_version |
|---|---|
| Type | str |
| Description | Gets the robot version number. |
| Return Value | Robot version number, for example: "42", "43", etc. |
| Remarks | Read-only property |
| Property Name | end_effector_type |
|---|---|
| Type | str |
| Description | Gets the end-effector type. |
| Return Value | End-effector type: "qiangnao" indicates a dexterous hand, "lejuclaw" indicates the Leju gripper |
| Remarks | Read-only property |
| Property Name | joint_dof |
|---|---|
| Type | int |
| Description | Gets the total number of robot joints. |
| Return Value | Total number of robot joints |
| Remarks | Read-only property |
| Property Name | joint_names |
|---|---|
| Type | list |
| Description | Gets the list of all robot joint names. |
| Return Value | A list containing all joint names |
| Remarks | Read-only property |
| Property Name | arm_joint_dof |
|---|---|
| Type | int |
| Description | Gets the number of robot arm degrees of freedom. |
| Return Value | Number of arm joints, for example: 14 |
| Remarks | Read-only property |
| Property Name | arm_joint_names |
|---|---|
| Type | list |
| Description | Gets the list of robot arm joint names. |
| Return Value | A list containing arm joint names |
| Remarks | Read-only property |
| Property Name | head_joint_dof |
|---|---|
| Type | int |
| Description | Gets the number of robot head degrees of freedom. |
| Return Value | Number of head joints |
| Remarks | Read-only property |
| Property Name | head_joint_names |
|---|---|
| Type | list |
| Description | Gets the list of robot head joint names. |
| Return Value | A list containing head joint names |
| Remarks | Read-only property |
| Property Name | eef_frame_names |
|---|---|
| Type | Tuple[str, str] |
| Description | Gets the end-effector frame names. |
| Return Value | Tuple containing the left and right hand frame names, for example: ("zarm_l7_link", "zarm_r7_link") |
| Remarks | Read-only property |
KuavoRobotState
The KuavoRobotState class provides interfaces for retrieving the robot's real-time status.
Method Interfaces
| Function Name | is_stance |
|---|---|
| Function Prototype | bool is_stance() |
| Description | Determines whether the robot is in the ready stance. |
| Parameters | None |
| Return Value | True: in the ready stance False: not in the ready stance |
| Remarks | None |
| Function Name | is_walk |
|---|---|
| Function Prototype | bool is_walk() |
| Description | Determines whether the robot is walking. |
| Parameters | None |
| Return Value | True: walking False: not walking |
| Remarks | None |
| Function Name | is_step_control |
|---|---|
| Function Prototype | bool is_step_control() |
| Description | Determines whether the robot is in step control mode. |
| Parameters | None |
| Return Value | True: in step control mode False: not in step control mode |
| Remarks | None |
| Function Name | arm_control_mode |
|---|---|
| Function Prototype | KuavoArmCtrlMode arm_control_mode() |
| Description | Gets the arm control mode. |
| Parameters | None |
| Return Value | KuavoArmCtrlMode enum value: - ArmFixed(0): fixed mode - AutoSwing(1): auto-swing mode - ExternalControl(2): external control mode |
| Remarks | None |
| Function Name | arm_joint_state |
|---|---|
| Function Prototype | KuavoJointData arm_joint_state() |
| Description | Gets the robot arm joint state data. |
| Parameters | None |
| Return Value | KuavoJointData type, including: - position: joint angle (radians) - velocity: joint velocity (radians/second) - torque: joint torque (Newton-meters or amperes) - acceleration: joint acceleration (radians/second²) |
| Remarks | Returns real-time data |
| Function Name | head_joint_state |
|---|---|
| Function Prototype | KuavoJointData head_joint_state() |
| Description | Gets the robot head joint state data. |
| Parameters | None |
| Return Value | KuavoJointData type, including: - position: joint angle (radians) - velocity: joint velocity (radians/second) - torque: joint torque (Newton-meters or amperes) - acceleration: joint acceleration (radians/second²) |
| Remarks | Returns real-time data |
| Function Name | robot_position |
|---|---|
| Function Prototype | Tuple[float, float, float] robot_position() |
| Description | Gets the robot's position in the world coordinate system. |
| Parameters | None |
| Return Value | Tuple containing the (x, y, z) coordinates, in meters |
| Remarks | Returns real-time data |
| Function Name | robot_orientation |
|---|---|
| Function Prototype | Tuple[float, float, float, float] robot_orientation() |
| Description | Gets the robot's orientation in the world coordinate system. |
| Parameters | None |
| Return Value | Tuple containing the (x, y, z, w) quaternion |
| Remarks | Returns real-time data |
| Function Name | linear_velocity |
|---|---|
| Function Prototype | Tuple[float, float, float] linear_velocity() |
| Description | Gets the robot's linear velocity in the world coordinate system. |
| Parameters | None |
| Return Value | Tuple containing the (x, y, z) linear velocity, in meters/second |
| Remarks | Returns real-time data |
| Function Name | angular_velocity |
|---|---|
| Function Prototype | Tuple[float, float, float] angular_velocity() |
| Description | Gets the robot's angular velocity in the world coordinate system. |
| Parameters | None |
| Return Value | Tuple containing the (x, y, z) angular velocity, in radians/second |
| Remarks | Returns real-time data |
| Function Name | wait_for_stance |
|---|---|
| Function Prototype | bool wait_for_stance(timeout=5.0) |
| Description | Waits for the robot to enter the ready stance. |
| Parameters | timeout: timeout duration, in seconds; default: 5.0 |
| Return Value | True: successfully entered the ready stance False: timed out without entering the ready stance |
| Remarks | Blocking function; waits until the state changes or the timeout is reached |
| Function Name | wait_for_walk |
|---|---|
| Function Prototype | bool wait_for_walk(timeout=5.0) |
| Description | Waits for the robot to enter the walking state. |
| Parameters | timeout: timeout duration, in seconds; default: 5.0 |
| Return Value | True: successfully entered the walking state False: timed out without entering the walking state |
| Remarks | Blocking function; waits until the state changes or the timeout is reached |
| Function Name | wait_for_step_control |
|---|---|
| Function Prototype | bool wait_for_step_control(timeout=5.0) |
| Description | Waits for the robot to enter step control mode. |
| Parameters | timeout: timeout duration, in seconds; default: 5.0 |
| Return Value | True: successfully entered step control mode False: timed out without entering step control mode |
| Remarks | Blocking function; waits until the state changes or the timeout is reached |
| Function Name | gait_name |
|---|---|
| Function Prototype | str gait_name() |
| Description | Gets the current gait name. |
| Parameters | None |
| Return Value | Current gait name |
| Remarks | None |
| Function Name | is_gait |
|---|---|
| Function Prototype | bool is_gait(str gait_name) |
| Description | Determines whether the current gait is the specified gait. |
| Parameters | gait_name: gait name |
| Return Value | True: it is the specified gait False: it is not the specified gait |
| Remarks | None |
Property Interfaces
| Property Name | imu_data |
|---|---|
| Type | KuavoImuData |
| Description | Gets IMU data. |
| Return Value | KuavoImuData type, containing gyroscope, accelerometer, and orientation information |
| Remarks | Read-only property |
| Property Name | odometry |
|---|---|
| Type | KuavoOdometry |
| Description | Gets odometry data. |
| Return Value | KuavoOdometry type, containing position, orientation, linear velocity, and angular velocity information |
| Remarks | Read-only property |
| Property Name | com_height |
|---|---|
| Type | float |
| Description | Gets the robot's center of mass height. |
| Return Value | Center of mass height, in meters |
| Remarks | Read-only property |
| Property Name | current_gait_mode |
|---|---|
| Type | int |
| Description | Gets the current gait mode. |
| Return Value | Gait mode ID |
| Remarks | Read-only property |
Data Types
KuavoJointData
Joint data structure, containing the following fields:
class KuavoJointData:
position: list # 关节位置(角度),单位:弧度
velocity: list # 关节速度,单位:弧度/秒
torque: list # 关节力矩,单位:牛米或安培
acceleration: list # 关节加速度,单位:弧度/秒²KuavoImuData
IMU data structure, containing the following fields:
class KuavoImuData:
gyro: Tuple[float, float, float] # 角速度(x, y, z),单位:弧度/秒
acc: Tuple[float, float, float] # 线加速度(x, y, z),单位:米/秒²
free_acc: Tuple[float, float, float] # 去重力加速度(x, y, z),单位:米/秒²
quat: Tuple[float, float, float, float] # 方向四元数(x, y, z, w)KuavoOdometry
Odometry data structure, containing the following fields:
class KuavoOdometry:
position: Tuple[float, float, float] # 位置(x, y, z),单位:米
orientation: Tuple[float, float, float, float] # 姿态四元数(x, y, z, w)
linear: Tuple[float, float, float] # 线速度(x, y, z),单位:米/秒
angular: Tuple[float, float, float] # 角速度(x, y, z),单位:弧度/秒KuavoArmCtrlMode
Arm control mode enumeration:
class KuavoArmCtrlMode(Enum):
ArmFixed = 0 # 固定模式
AutoSwing = 1 # 自动摆动模式
ExternalControl = 2 # 外部控制模式Example Code
Example code for retrieving robot information:
/home/lab/kuavo-ros-opensource/src/kuavo_humanoid_websocket_sdk/examples/atomic_skills/robot_info_example.py
Demonstrates how to retrieve basic information about the robot body.
Including robot type, version, end-effector type, joint names, degrees of freedom, etc., obtained and printed via KuavoRobotInfo.