Low-Level Motion Control Service
About 1636 wordsAbout 5 min
2025-01-27
Provides low-level motion control services for the robot system. Through the LowLevelMotionController, you can use topic-based communication to send joint commands and receive joint states.
Interface Definition
LowLevelMotionController
is a motion controller designed for low-level development, supporting direct control and state subscription of leg and other moving parts.
LowLevelMotionController
— Low-Level Motion Controller
Item | Description |
---|---|
Class Name | LowLevelMotionController |
Overview | Low-level joint motion controller providing precise joint control |
Main Functions | Joint state subscription, joint command publishing, control period setting |
Use Cases | Precise motion control, custom gait, research and development |
initialize
Item | Description |
---|---|
Method Name | initialize |
Declaration | bool initialize() |
Overview | Initialize the controller and establish low-level connections. |
Return Value | true for success, false for failure. |
Note | Must be called before first use. |
shutdown
Item | Description |
---|---|
Method Name | shutdown |
Declaration | void shutdown() |
Overview | Shut down the controller and release low-level resources. |
Note | Used together with initialize. |
set_period_ms
Item | Description |
---|---|
Method Name | set_period_ms |
Declaration | void set_period_ms(int period_ms) |
Overview | Set the control period in milliseconds. |
Parameter | period_ms : Period in milliseconds. |
Note | Non-blocking interface. The controller uses this period to set the frequency of joint command sending. |
subscribe_leg_state
Item | Description |
---|---|
Method Name | subscribe_leg_state |
Declaration | void subscribe_leg_state(callback) |
Overview | Subscribe to leg joint state data. |
Parameter | callback : Callback function to handle received leg joint state data. Function signature: callback(data : LegState) -> None |
Note | Non-blocking interface. |
publish_leg_command
Item | Description |
---|---|
Method Name | publish_leg_command |
Declaration | Status publish_leg_command(LegJointCommand command) |
Overview | Publish leg joint control commands. |
Parameter | command : Leg joint control command containing target angles/velocities, etc. |
Return Value | Status::OK for success, others for failure. |
Note | Non-blocking interface. |
enable_send_msg
Item | Description |
---|---|
Method Name | enable_send_msg |
Declaration | Status enable_send_msg(bool enable) |
Overview | LCM channel switch. |
Parameter | enable : LCM channel switch information. |
Return Value | Status::OK for success, others for failure. |
Note | When using high-level motion control, turn off the LCM channel; when using low-level motion control, turn on the LCM channel. |
Data Structure Definitions
LegJointCommandArray
— Leg Joint Command Array
Item | Description |
---|---|
Type | Python binding of std::array<magic::dog::SingleLegJointCommand, magic::dog::kLegJointNum> |
Overview | Fixed-size array of leg joint commands, containing control commands for all leg joints |
Main Methods | Supports index access, iteration, and length query. Length is fixed to the number of leg joints. |
Use Cases | Leg motion control, joint coordination control, gait planning |
LegJointStateArray
— Leg Joint State Array
Item | Description |
---|---|
Type | Python binding of std::array<magic::dog::SingleLegJointState, magic::dog::kLegJointNum> |
Overview | Fixed-size array of leg joint states, containing real-time state information for all leg joints |
Main Methods | Supports index access, iteration, and length query. Length is fixed to the number of leg joints. |
Use Cases | Joint state monitoring, motion feedback, safety detection |
SingleLegJointCommand
— Single Leg Joint Command Structure
Field Name | Type | Description |
---|---|---|
q_des | float | Desired joint angle |
dq_des | float | Desired joint angular velocity |
tau_des | float | Desired joint torque |
kp | float | Position gain |
kd | float | Velocity gain |
LegJointCommand
— Leg Joint Command Structure
Field Name | Type | Description |
---|---|---|
timestamp | int | Timestamp |
cmd | LegJointCommandArray | List of joint commands |
SingleLegJointState
— Single Leg Joint State Structure
Field Name | Type | Description |
---|---|---|
q | float | Joint angle |
dq | float | Joint angular velocity |
tau_est | float | Estimated joint torque |
LegState
— Leg State Structure
Field Name | Type | Description |
---|---|---|
timestamp | int | Timestamp |
state | LegJointStateArray | List of joint states |
URDF Reference
Introduction to Low-Level Motion Control Robot States
The robot's low-level motion mainly refers to the three-loop joint control, enabling developers to further develop the robot's motion capabilities. The basic control state switching mechanism: