Robot Information Retrieval Interfaces
The Humanoid SDK provides a comprehensive set of robot information retrieval interfaces, supporting access to the robot's basic information, state information, IMU data, and more. This document describes in detail how to use these interfaces.
Notes
Before using these interfaces, make sure you have completed the installation and configuration of the Humanoid SDK. For detailed installation steps, refer to the Installation Guide.
Interface Reference
RobotInfo
The RobotInfo class provides interfaces for retrieving basic robot information.
Property Interfaces
| Property | robot_version |
|---|---|
| Type | str |
| Description | Gets the robot version number. |
| Return Value | Robot version number, e.g., "42", "43", etc. |
| Remarks | Read-only property |
| Property | end_effector_type |
|---|---|
| Type | str |
| Description | Gets the end effector type. |
| Return Value | End effector type; "qiangnao" indicates a dexterous hand, "lejuclaw" indicates a Leju gripper |
| Remarks | Read-only property |
| Property | joint_dof |
|---|---|
| Type | int |
| Description | Gets the total number of joints on the robot. |
| Return Value | Total number of robot joints |
| Remarks | Read-only property |
| Property | joint_names |
|---|---|
| Type | list |
| Description | Gets the list of all joint names of the robot. |
| Return Value | A list containing all joint names |
| Remarks | Read-only property |
| Property | arm_joint_dof |
|---|---|
| Type | int |
| Description | Gets the number of degrees of freedom of the robot arm. |
| Return Value | Number of arm joints, e.g., 8 |
| Remarks | Read-only property |
| Property | arm_joint_names |
|---|---|
| Type | list |
| Description | Gets the list of arm joint names of the robot. |
| Return Value | A list containing the arm joint names |
| Remarks | Read-only property |
| Property | head_joint_dof |
|---|---|
| Type | int |
| Description | Gets the number of degrees of freedom of the robot head. |
| Return Value | Number of head joints |
| Remarks | Read-only property |
| Property | head_joint_names |
|---|---|
| Type | list |
| Description | Gets the list of head joint names of the robot. |
| Return Value | A list containing the head joint names |
| Remarks | Read-only property |
| Property | eef_frame_names |
|---|---|
| Type | Tuple[str, str] |
| Description | Gets the names of the end effector frames. |
| Return Value | A tuple containing the left and right hand frame names, e.g., ("zarm_l7_link", "zarm_r7_link") |
| Remarks | Read-only property |
RobotState
The RobotState class provides interfaces for retrieving the robot's real-time state.
Method Interfaces
| Function | is_stance |
|---|---|
| Signature | 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 | is_walk |
|---|---|
| Signature | bool is_walk() |
| Description | Determines whether the robot is in the walking state. |
| Parameters | None |
| Return Value | True: in the walking state False: not in the walking state |
| Remarks | None |
| Function | is_step_control |
|---|---|
| Signature | bool is_step_control() |
| Description | Determines whether the robot is in single-step control mode. |
| Parameters | None |
| Return Value | True: in single-step control mode False: not in single-step control mode |
| Remarks | None |
| Function | arm_control_mode |
|---|---|
| Signature | 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 | arm_joint_state |
|---|---|
| Signature | KuavoJointData arm_joint_state() |
| Description | Gets the robot arm joint state data. |
| Parameters | None |
| Return Value | KuavoJointData type, containing: - position: joint angle (radians) - velocity: joint velocity (radians/second) - torque: joint torque (N·m or amperes) - acceleration: joint acceleration (radians/second²) |
| Remarks | The returned data is real-time data |
| Function | head_joint_state |
|---|---|
| Signature | KuavoJointData head_joint_state() |
| Description | Gets the robot head joint state data. |
| Parameters | None |
| Return Value | KuavoJointData type, containing: - position: joint angle (radians) - velocity: joint velocity (radians/second) - torque: joint torque (N·m or amperes) - acceleration: joint acceleration (radians/second²) |
| Remarks | The returned data is real-time data |
| Function | robot_position |
|---|---|
| Signature | Tuple[float, float, float] robot_position() |
| Description | Gets the robot's position in the world coordinate frame. |
| Parameters | None |
| Return Value | A tuple containing the (x, y, z) coordinates, in meters |
| Remarks | The returned data is real-time data |
| Function | robot_orientation |
|---|---|
| Signature | Tuple[float, float, float, float] robot_orientation() |
| Description | Gets the robot's orientation in the world coordinate frame. |
| Parameters | None |
| Return Value | A tuple containing the quaternion (x, y, z, w) |
| Remarks | The returned data is real-time data |
| Function | linear_velocity |
|---|---|
| Signature | Tuple[float, float, float] linear_velocity() |
| Description | Gets the robot's linear velocity in the world coordinate frame. |
| Parameters | None |
| Return Value | A tuple containing the linear velocity (x, y, z), in meters/second |
| Remarks | The returned data is real-time data |
| Function | angular_velocity |
|---|---|
| Signature | Tuple[float, float, float] angular_velocity() |
| Description | Gets the robot's angular velocity in the world coordinate frame. |
| Parameters | None |
| Return Value | A tuple containing the angular velocity (x, y, z), in radians/second |
| Remarks | The returned data is real-time data |
| Function | wait_for_stance |
|---|---|
| Signature | 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 expires |
| Function | wait_for_walk |
|---|---|
| Signature | 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 expires |
| Function | wait_for_step_control |
|---|---|
| Signature | bool wait_for_step_control(timeout=5.0) |
| Description | Waits for the robot to enter single-step control mode. |
| Parameters | timeout: timeout duration, in seconds; default: 5.0 |
| Return Value | True: successfully entered single-step control mode False: timed out without entering single-step control mode |
| Remarks | Blocking function; waits until the state changes or the timeout expires |
| Function | gait_name |
|---|---|
| Signature | str gait_name() |
| Description | Gets the name of the current gait. |
| Parameters | None |
| Return Value | Name of the current gait |
| Remarks | None |
| Function | is_gait |
|---|---|
| Signature | 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 | imu_data |
|---|---|
| Type | KuavoImuData |
| Description | Gets IMU data. |
| Return Value | KuavoImuData type, containing gyroscope, accelerometer, and orientation information |
| Remarks | Read-only property |
| Property | 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 | 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 | current_gait_mode |
|---|---|
| Type | int |
| Description | Gets the current gait mode. |
| Return Value | Gait mode ID |
| Remarks | Read-only property |
Data Types
JointData
Joint data structure, containing the following fields:
class KuavoJointData:
position: list # 关节位置(角度),单位:弧度
velocity: list # 关节速度,单位:弧度/秒
torque: list # 关节力矩,单位:牛米或安培
acceleration: list # 关节加速度,单位:弧度/秒²ImuData
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)Odometry
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),单位:弧度/秒ArmCtrlMode
Arm control mode enumeration:
class KuavoArmCtrlMode(Enum):
ArmFixed = 0 # 固定模式
AutoSwing = 1 # 自动摆动模式
ExternalControl = 2 # 外部控制模式Example Code
Example code for retrieving robot information:
<kuavo-ros-control>/src/kuavo_humanoid_websocket_sdk/examples/atomic_skills/robot_info_example.py
Demonstrates how to retrieve basic information about the robot body.
It covers the robot type, version, end effector type, joint names, degrees of freedom, etc., retrieved and printed via RobotInfo.