Basic Services Interface
The low-level communication facilitates data interaction between the user PC and the robot. It uses the DDS protocol (DDS related knowledge can be found in 《DDS Communication Interface》).
-
Subscribe to the topic
rt/lowstate(type:unitree_hg::msg::dds_::LowState_) to obtain the current state of the G1. -
Publish to the topic
rt/lowcmd(type:unitree_hg::msg::dds_::LowCmd_) to control all body joint motors (excluding the dexterous hand), the battery, and other devices. -
To use the Dex3-1 force-controlled dexterous hand, publish to the topic
rt/dex3/(left or right)/cmd(type:unitree_hg::msg::dds_::HandCmd_) to control the dexterous hand, and subscribe to the topicrt/dex3/(left or right)/state(type:unitree_hg::msg::dds_::HandState_) to receive the hand’s state.
Interface Description
Section titled “Interface Description”Subscribe to or publish topics using the methods described in the DDS communication interface. Topic data is stored in structures defined by IDL, with commonly used structures including:
| Structure Name | Description |
|---|---|
HandCmd_ |
Dex3-1 Control |
HandState_ |
Dex3-1 Status |
IMUState_ |
G1 IMU Status |
LowCmd_ |
G1 Low-level Control |
LowState_ |
G1 Low-level Status |
MotorCmd_ |
G1 Motor Control |
MotorState_ |
G1 Motor Status |
PressSensorState_ |
Dex3-1 Tactile Feedback |
Introduction to message types
Section titled “Introduction to message types”Dex3-1 Control
Section titled “Dex3-1 Control”-
unitree_hg::msg::dds_::HandCmd_struct HandCmd_ {sequence<unitree_hg::msg::dds_::MotorCmd_> motor_cmd; // Commands for all motors in the dexterous hand};
Dex3-1 Status
Section titled “Dex3-1 Status”-
unitree_hg::msg::dds_::HandState_struct HandState_ {sequence<unitree_hg::msg::dds_::MotorState_> motor_state; // States of all motors in the dexterous handunitree_hg::msg::dds_::IMUState_ imu_state; // IMU state of the dexterous handsequence<unitree_hg::msg::dds_::PressSensorState_> press_sensor_state; // Pressure sensor statesfloat power_v; // Power voltage of the dexterous handfloat power_a; // Power current of the dexterous handunsigned long reserve[2]; // Reserved};
IMU Status
Section titled “IMU Status”-
unitree_hg::msg::dds_::IMUState_struct IMUState_ {float quaternion[4]; // Quaternion QwQxQyQzfloat gyroscope[3]; // Gyroscope (angular velocity) omega_xyzfloat accelerometer[3]; // Acceleration acc_xyzfloat rpy[3]; // Euler anglesshort temperature; // IMU temperature};
Low-level Control
Section titled “Low-level Control”-
unitree_hg::msg::dds_::LowCmd_struct LowCmd_ {octet mode_pr; // Parallel mechanism (ankle and waist) control mode (default 0) 0:PR, 1:ABoctet mode_machine; // G1 Type:4:23-Dof;5:29-Dof;6:27-Dof(29Dof Fitted at the waist)unitree_hg::msg::dds_::MotorCmd_ motor_cmd[35]; // Control commands for all body motorsunsigned long reserve[4]; // Reservedunsigned long crc; // Checksum};
Low-level Status
Section titled “Low-level Status”-
unitree_hg::msg::dds_::LowState_struct LowState_ {octet mode_pr; // Parallel mechanism (ankle and waist) control mode (default 0) 0:PR, 1:ABoctet mode_machine; // G1 Typeunsigned long tick; // Timer incrementing every 1msunitree_hg::msg::dds_::IMUState_ imu_state; // IMU stateunitree_hg::msg::dds_::MotorState_ motor_state[35]; // States of all body motorsoctet wireless_remote[40]; // Raw data from Unitree physical remote controlunsigned long reserve[4]; // Reservedunsigned long crc; // Checksum};
Motor Control
Section titled “Motor Control”-
unitree_hg::msg::dds_::MotorCmd_struct MotorCmd_ {octet mode; // Motor control mode 0:Disable, 1:Enablefloat q; // Target joint positionfloat dq; // Target joint velocityfloat tau; // Feedforward torquefloat kp; // Joint stiffness coefficientfloat kd; // Joint damping coefficientunsigned long reserve[3]; // Reserved};
Motor Status
Section titled “Motor Status”-
unitree_hg::msg::dds_::MotorState_struct MotorState_ {octet mode; // Current motor modefloat q; // Joint feedback position (rad)float dq; // Joint feedback velocity (rad/s)float ddq; // Joint feedback acceleration (rad/s^2)float tau_est; // Joint feedback torquefloat q_raw; // Reservedfloat dq_raw; // Reservedfloat ddq_raw; // Reservedshort temperature[2]; // Motor temperature (surface and winding)unsigned long sensor[2]; // Sensor datafloat vol; // Motor terminal voltageunsigned long motorstate; // Motor stateunsigned long reserve[4]; // Reserved};
Dex3-1 Tactile Feedback
Section titled “Dex3-1 Tactile Feedback”-
unitree_hg::msg::dds_::PressSensorState_struct PressSensorState_ {float pressure[12];float temperature[12];};