Low-Level Motion Control Service
About 3744 wordsAbout 12 min
2025-07-0810:18:56
Provides robot system low-level motion control service. Through the
LowLevelMotionController
, you can control robot joints and obtain status via topic communication.
Interface Definition
LowLevelMotionController
is a motion controller for low-level development, supporting direct control and state subscription of motion components such as arms, legs, head, waist, hands, etc., as well as body IMU data acquisition.
LowLevelMotionController
Item | Content |
---|---|
Function Name | LowLevelMotionController |
Function Declaration | LowLevelMotionController(); |
Function Overview | Constructor, initializes low-level controller object. |
Notes | Constructs internal resources. |
~LowLevelMotionController
Item | Content |
---|---|
Function Name | ~LowLevelMotionController |
Function Declaration | virtual ~LowLevelMotionController(); |
Function Overview | Destructor, releases resources. |
Notes | Cleans up low-level resources. |
Initialize
Item | Content |
---|---|
Function Name | Initialize |
Function Declaration | virtual bool Initialize() override; |
Function Overview | Initialize controller, establish low-level connections. |
Return Value | true indicates success, false indicates failure. |
Notes | Must be initialized on first call. |
Shutdown
Item | Content |
---|---|
Function Name | Shutdown |
Function Declaration | virtual void Shutdown() override; |
Function Overview | Shutdown controller, release low-level resources. |
Notes | Used in conjunction with Initialize. |
SetPeriodMs
Item | Content |
---|---|
Function Name | SetPeriodMs |
Function Declaration | void SetPeriodMs(uint64_t period_ms); |
Function Overview | Set control cycle time (milliseconds). |
Parameter Description | period_ms : Cycle time, unit is milliseconds. |
Notes | Non-blocking interface, cycle parameter used internally by controller, controls joint command sending frequency. |
SubscribeArmState
Item | Content |
---|---|
Function Name | SubscribeArmState |
Function Declaration | void SubscribeArmState(ArmJointStateCallback callback); |
Function Overview | Subscribe to arm joint state data |
Parameter Description | callback: Data processing function |
Notes | Non-blocking interface. |
PublishArmCommand
Item | Content |
---|---|
Function Name | PublishArmCommand |
Function Declaration | Status PublishArmCommand(const JointCommand& command); |
Function Overview | Publish arm control commands |
Parameter Description | command: Target position/velocity etc. |
Return Value | true indicates success, false indicates failure. |
Notes | Non-blocking interface. |
SubscribeLegState
Item | Content |
---|---|
Function Name | SubscribeLegState |
Function Declaration | void SubscribeLegState(LegJointStateCallback callback); |
Function Overview | Subscribe to leg joint state data |
Parameter Description | callback: Data processing function |
Notes | Non-blocking interface. |
PublishLegCommand
Item | Content |
---|---|
Function Name | PublishLegCommand |
Function Declaration | Status PublishLegCommand(const JointCommand& command); |
Function Overview | Publish leg control commands |
Parameter Description | command: Target position/velocity etc. |
Return Value | true indicates success, false indicates failure. |
Notes | Non-blocking interface, called when publishing or subscribing. |
SubscribeHeadState
Item | Content |
---|---|
Function Name | SubscribeHeadState |
Function Declaration | void SubscribeHeadState(HeadJointStateCallback callback); |
Function Overview | Subscribe to head joint state data |
Parameter Description | callback: Data processing function |
Notes | Non-blocking interface. |
PublishHeadCommand
Item | Content |
---|---|
Function Name | PublishHeadCommand |
Function Declaration | Status PublishHeadCommand(const JointCommand& command); |
Function Overview | Publish head control commands |
Parameter Description | command: Target position/velocity etc. |
Return Value | true indicates success, false indicates failure. |
Notes | Non-blocking interface. |
SubscribeWaistState
Item | Content |
---|---|
Function Name | SubscribeWaistState |
Function Declaration | void SubscribeWaistState(WaistJointStateCallback callback); |
Function Overview | Subscribe to waist joint state data |
Parameter Description | callback: Data processing function |
Notes | Non-blocking interface. |
PublishWaistCommand
Item | Content |
---|---|
Function Name | PublishWaistCommand |
Function Declaration | Status PublishWaistCommand(const JointCommand& command); |
Function Overview | Publish waist control commands |
Parameter Description | command: Target position/velocity etc. |
Return Value | true indicates success, false indicates failure. |
Notes | Non-blocking interface. |
SubscribeHandState
Item | Content |
---|---|
Function Name | SubscribeHandState |
Function Declaration | void SubscribeHandState(HandStateCallback callback); |
Function Overview | Subscribe to hand state data |
Parameter Description | callback: Data processing function |
Notes | Non-blocking interface. |
PublishHandCommand
Item | Content |
---|---|
Function Name | PublishHandCommand |
Function Declaration | Status PublishHandCommand(const HandCommand& command); |
Function Overview | Publish hand control commands |
Parameter Description | command: Hand joint target position etc. |
Return Value | true indicates success, false indicates failure. |
Notes | Non-blocking interface. |
SubscribeBodyImu
Item | Content |
---|---|
Function Name | SubscribeBodyImu |
Function Declaration | void SubscribeBodyImu(const BodyImuCallback& callback); |
Function Overview | Subscribe to body IMU data |
Parameter Description | callback: IMU data processing function |
Notes | Non-blocking interface. |
Type Definitions
SingleHandJointCommand
— Single Hand Joint Control Command
Field Name | Type | Description |
---|---|---|
operation_mode | int16_t | Control word |
pos | vector<float> | Desired position array (7 DOF, unit: rad) |
HandCommand
— Complete Hand Control Command
Field Name | Type | Description |
---|---|---|
timestamp | int64_t | Timestamp (unit: nanoseconds) |
cmd | vector<SingleHandJointCommand> | Control command array, left hand and right hand in order |
SingleHandJointState
— Single Hand Joint State
Field Name | Type | Description |
---|---|---|
status_word | int16_t | Status word |
pos | vector<float> | Current position (unit: rad) |
toq | vector<float> | Current torque (unit: Nm) |
cur | vector<float> | Current current (unit: A) |
error_code | int16_t | Error code |
HandState
— Complete Hand State Information
Field Name | Type | Description |
---|---|---|
timestamp | int64_t | Timestamp (unit: nanoseconds) |
state | vector<SingleHandJointState> | All hand joint states (left hand, right hand order) |
SingleJointCommand
— Single Joint Control Command
Field Name | Type | Description |
---|---|---|
operation_mode | int16_t | Control mode identifier: • 200=Ready state • 3=Mixed loop force control (position+torque) • 4=Series PID (position loop+velocity loop) • 5=ADRC position control (active disturbance rejection control) |
pos | float | Target position (unit: rad) |
vel | float | Velocity limit (unit: rad/s) |
toq | float | Torque limit (unit: Nm) |
kp | float | Position loop proportional gain |
kd | float | Velocity loop derivative gain |
- Left arm or right arm joints 1-5 operation_mode needs to switch from mode: 200 to mode: 4 (Series PID mode) for command sending;
- Waist joint 1 operation_mode needs to switch from mode: 200 to mode: 5 (ADRC position control mode) for command sending;
- Left leg or right leg joints 1-6 operation_mode needs to switch from mode: 200 to mode: 3 (Mixed loop force control mode) and ADRC position control mode (5) for command sending;
JointCommand
— Joint Control Command
Lower limbs contain 12 joint items, upper limbs 10(14), head 1(2), waist 1:
Field Name | Type | Description |
---|---|---|
timestamp | int64_t | Timestamp (unit: nanoseconds) |
joints | vector<SingleJointCommand> | Control commands for all joints |
SingleJointState
— Single Joint State Information
Field Name | Type | Description |
---|---|---|
status_word | int16_t | Current joint state (custom state machine encoding) |
posH | float | Actual position (high-precision encoder reading) |
posL | float | Actual position (low-precision encoder reading, for redundancy check) |
vel | float | Current velocity (unit: rad/s or m/s, automatically switches based on joint type) |
toq | float | Current torque (unit: Nm) |
current | float | Current current (unit: A) |
err_code | int16_t | Error code (such as encoder exception, motor overcurrent, etc., see error code reference table) |
JointState
— Joint State Data
Lower limbs contain 12 joint items, upper limbs 10(14), head 1(2), waist 1:
Field Name | Type | Description |
---|---|---|
timestamp | int64_t | Timestamp (unit: nanoseconds) |
joints | vector<SingleJointState> | State data for all joints |
Joint Motor Order
Head Joints
Index | Joint Name |
---|---|
0 | joint_hy |
1 | joint_hp |
Upper Arm Joints
Index | Joint Name |
---|---|
0 | joint_la1 |
1 | joint_la2 |
2 | joint_la3 |
3 | joint_la4 |
4 | joint_la5 |
5 | joint_la6 |
6 | joint_ra7 |
7 | joint_ra1 |
8 | joint_ra2 |
9 | joint_ra3 |
10 | joint_ra4 |
11 | joint_ra5 |
12 | joint_ra6 |
13 | joint_ra7 |
Waist Joints
Index | Joint Name |
---|---|
0 | joint_wy |
Leg Joints
Index | Joint Name |
---|---|
0 | left hip roll |
1 | left hip yaw |
2 | left hip pitch |
3 | left knee pitch |
4 | left ankle pitch |
5 | left ankle roll |
6 | right hip roll |
7 | right hip yaw |
8 | right hip pitch |
9 | right knee pitch |
10 | right ankle pitch |
11 | right ankle roll |
URDF Reference
Low-Level Motion Control Robot State Introduction
Robot low-level motion mainly develops three-loop control of joints for developers to perform secondary development of robot motion capabilities, basic control state switching mechanism: