High-Level Motion Control Service
About 2411 wordsAbout 8 min
2025-01-27
Provides robot system high-level motion control service. Through HighLevelMotionController, you can control robot gait, tricks, and remote control via RPC communication.
Interface Definition
HighLevelMotionController
is a high-level motion controller for semantic control, supporting control operations such as walking, tricks, head movement, etc., encapsulating low-level details for upper system calls.
HighLevelMotionController
Item | Content |
---|---|
Class Name | HighLevelMotionController |
Constructor | controller = HighLevelMotionController() |
Function Overview | Constructor, initializes high-level controller state |
Notes | Constructs internal control resources |
initialize
Item | Content |
---|---|
Function Name | initialize |
Function Declaration | bool initialize() |
Function Overview | Initialize controller, prepare high-level control functions |
Return Value | True indicates success, False indicates failure |
Notes | Must be called before first use |
shutdown
Item | Content |
---|---|
Function Name | shutdown |
Function Declaration | void shutdown() |
Function Overview | Close controller and release resources |
Notes | Used in conjunction with initialize, safely disconnect |
set_gait
Item | Content |
---|---|
Function Name | set_gait |
Function Declaration | Status set_gait(GaitMode gait_mode) |
Function Overview | Set robot gait mode (such as recovery stand, balance stand, humanoid walking, etc.) |
Parameter Description | gait_mode : Gait control enumeration |
Return Value | Status object, Status.code == ErrorCode.OK indicates success |
Notes | Blocking interface, can switch between multiple gait modes |
get_gait
Item | Content |
---|---|
Function Name | get_gait |
Function Declaration | Status get_gait() |
Function Overview | Get robot gait mode (such as recovery stand, balance stand, humanoid walking, etc.) |
Return Value | Status object containing current gait mode information |
Notes | Blocking interface, gets current gait mode |
execute_trick
Item | Content |
---|---|
Function Name | execute_trick |
Function Declaration | Status execute_trick(TrickAction trick_action) |
Function Overview | Execute trick actions (such as celebrate, wave, etc.) |
Parameter Description | trick_action : Trick action identifier |
Return Value | Status object, Status.code == ErrorCode.OK indicates success |
Notes | Blocking interface, ensure robot can currently execute tricks Note: Trick actions must be performed under GaitMode.GAIT_BALANCE_STAND(46) gait |
send_joystick_command
Item | Content |
---|---|
Function Name | send_joystick_command |
Function Declaration | Status send_joystick_command(JoystickCommand joy_command) |
Function Overview | Send real-time joystick control commands |
Parameter Description | joy_command : Control data containing joystick coordinates |
Return Value | Status object, Status.code == ErrorCode.OK indicates success |
Notes | Non-blocking interface, recommended sending frequency is 20Hz |
Type Definitions
JoystickCommand
— High-Level Motion Control Joystick Command Structure
Field Name | Type | Description |
---|---|---|
x | float | Left joystick X-axis direction value (-1.0: left, 1.0: right) |
y | float | Left joystick Y-axis direction value (-1.0: down, 1.0: up) |
yaw | float | Right joystick X-axis direction value (rotation -1.0: left, 1.0: right) |
z | float | Right joystick Y-axis direction value (purpose not yet defined) |
Enumeration Type Definitions
GaitMode
— Robot Gait Mode Enumeration
Enumeration Value | Value | Description |
---|---|---|
GAIT_PASSIVE | 0 | Passive |
GAIT_RECOVERY_STAND | 1 | Recovery Stand |
GAIT_BALANCE_STAND | 46 | Balance Stand (supports movement) |
GAIT_ARM_SWING_WALK | 47 | Arm Swing Walking |
GAIT_LOWLEVL_SDK | 200 | Low-level Control SDK Mode |
TrickAction
— Trick Action Command Enumeration
Enumeration Value | Value | Description |
---|---|---|
ACTION_RECOVERY_STAND | 103 | Balance Stand |
ACTION_CELEBRATE | 201 | Celebrate |
ACTION_SHAKE_HAND_REACHOUT | 217 | Shake Hand - Reach Out |
ACTION_SHAKE_HAND_WITHDRAW | 218 | Shake Hand - Withdraw |
ACTION_NOD_HEAD | 219 | Nod Head |
ACTION_SHAKE_HEAD | 220 | Shake Head |
ACTION_CIRCLE_HEAD | 221 | Circle Shake Head |
ACTION_GTEETING | 301 | Greeting |
ACTION_POINT_GROUND | 302 | Point Ground - Reach Out |
ACTION_POINT_GROUND_WITH_DRAW | 303 | Point Ground - Withdraw |
ACTION_SPREAD_HAND | 304 | Spread Hand |
ACTION_SPREAD_HAND_WITH_DRAW | 305 | Spread Hand - Withdraw |
ACTION_TRUN_AWAY_LEFT_INTRODUCE | 306 | Turn Away Back |
ACTION_TRUN_BACK_LEFT_INTRODUCE | 307 | Turn Back Forward |
Joystick Diagram
- The range of left and right joystick x-axis and y-axis values is [-1.0, 1.0];
- The direction of left and right joystick x-axis and y-axis is up/right as positive, as shown in the diagram;
High-Level Motion Control Robot State Introduction
Robot motion includes recovery stand, balance stand, basic motion, and trick action states. During operation, the robot switches between different states through a state machine to achieve different control tasks. The explanation of each state is as follows:
- Recovery Stand: Recovery stand is the state connecting robot suspension landing and balance stand. The robot needs to enter balance stand state before calling corresponding motion services to achieve robot control.
- Balance Stand: In balance stand state, you can call various SDK interfaces to achieve robot trick actions and basic motion control.
- Basic Motion: During motion execution, you can call SDK interfaces to make the robot enter different gaits.
- Trick Actions: When entering special action execution state, other motion control services will be suspended first, waiting for current action to complete and enter balance stand state before taking effect again.
Robot state switching mechanism;
High-Level Motion Control Interface
Robot high-level motion control service can be divided into basic motion control and trick action control.
- In basic motion control service, you can call corresponding interfaces to switch robot walking gaits according to different terrain scenarios and task requirements.
- In trick action control service, you can call corresponding interfaces to achieve robot built-in special tricks, such as celebrate, shake hand, greeting, etc.
Gait Switching
Current Gait | Gait Switching Process | Diagram |
---|---|---|
Recovery Stand | ![]() | ![]() |
Balance Stand | ![]() | ![]() |
Arm Swing Walking | ![]() | ![]() |
Trick Execution
Trick | Trick Execution Process | Diagram |
---|---|---|
Celebrate | ![]() | ![]() |
Shake Hand | ![]() | ![]() |
Nod Head | ![]() | ![]() |
Shake Head | ![]() | ![]() |
Circle Shake Head | ![]() | ![]() |
Greeting | ![]() | ![]() |
Point Ground | ![]() | ![]() |
Spread Hand | ![]() | ![]() |
Turn Body | ![]() | ![]() |