High-Level Motion Control Service
About 2227 wordsAbout 7 min
2025-01-27
Provides robot system high-level motion control service. Through the
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 | Shutdown 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 walk, 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 walk, etc.) |
Return Value | Status object, contains 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 welcom, 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 in 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 |
---|---|---|
left_x_axis | float | Left joystick X-axis direction value (-1.0: left, 1.0: right) |
left_y_axis | float | Left joystick Y-axis direction value (-1.0: down, 1.0: up) |
right_x_axis | float | Right joystick X-axis direction value (rotation -1.0: left, 1.0: right) |
right_y_axis | 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 | 78 | Arm Swing Walk |
GAIT_HUMANOID_WALK | 79 | Humanoid Walk |
GAIT_LOWLEVL_SDK | 200 | Low-Level Control SDK Mode |
TrickAction
— Trick Action Command Enumeration
Enumeration Value | Value | Description |
---|---|---|
ACTION_SHAKE_LEFT_HAND_REACHOUT | 215 | Handshake (Left Hand) - Reach Out |
ACTION_SHAKE_LEFT_HAND_WITHDRAW | 216 | Handshake (Left Hand) - Withdraw |
ACTION_SHAKE_RIGHT_HAND_REACHOUT | 217 | Handshake (Right Hand) - Reach Out |
ACTION_SHAKE_RIGHT_HAND_WITHDRAW | 218 | Handshake (Right Hand) - Withdraw |
ACTION_SHAKE_HEAD | 220 | Shake Head |
ACTION_LEFT_GREETING | 300 | Greeting (Left Hand) |
ACTION_RIGHT_GREETING | 301 | Greeting (Right Hand) |
ACTION_TRUN_LEFT_INTRODUCE_HIGH | 304 | Turn Left Introduction - High |
ACTION_TRUN_LEFT_INTRODUCE_LOW | 305 | Turn Left Introduction - Low |
ACTION_TRUN_RIGHT_INTRODUCE_HIGH | 306 | Turn Right Introduction - High |
ACTION_TRUN_RIGHT_INTRODUCE_LOW | 307 | Turn Right Introduction - Low |
ACTION_WELCOME | 340 | Welcome |
Joystick Diagram
- The X-axis and Y-axis value ranges for left and right joysticks are [-1.0, 1.0];
- The up/right direction of the left and right joystick X-axis and Y-axis is 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 explanations for each state are as follows:
- Recovery Stand: Recovery stand is the state connecting robot suspension landing and balance stand. The robot needs to enter the balance stand state before calling corresponding motion services to achieve robot control.
- Balance Stand: In the 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 the special action execution state, other motion control services will be suspended first, waiting for the current action to complete and enter the balance stand state before taking effect again.
Robot state switching mechanism;
High-Level Motion Control Interface
Robot high-level motion control services can be divided into basic motion control and trick action control.
- In basic motion control services, you can call corresponding interfaces to switch robot walking gaits according to different terrain scenarios and task requirements.
- In trick action control services, you can call corresponding interfaces to achieve robot built-in special tricks, such as Celebrate, handshake, greeting, etc.
Gait Switching
Current Gait | Gait Switching Process | Diagram |
---|---|---|
Recovery Stand | ![]() | |
Balance Stand | ![]() | |
Arm Swing Walk | ![]() | |
Humanoid Walk | ![]() |
Trick Execution
Trick | Trick Execution Process | Diagram |
---|---|---|
Welcome | ![]() | |
Shake Head | ![]() | |
Greeting (Left Hand) | ![]() | |
Greeting (Right Hand) | ![]() | |
Handshake (Left Hand) | ![]() | |
Handshake (Right Hand) | ![]() | |
Turn Left Introduction | ![]() | |
Turn Right Introduction | ![]() |