7.1 Motion Control Section
Section titled “7.1 Motion Control Section”7.1.1 Overview
Section titled “7.1.1 Overview”The A2 Lite robot comes pre-installed with a motion control program, allowing users to directly control the robot’s movement by sending high-level linear and angular velocity commands. There is no need to develop low-level control models for walking and other functions. Additionally, the joints for the upper limbs and neck are open to direct HAL layer hardware interfaces.
By default, the low-level control interface for the lower limb joint motors is not open; only high-level speed commands can be used for overall control. If you need to develop your own motion control algorithms to replace the Agibot factory-installed algorithms, please contact the business or customer project manager to obtain the motion control development and deployment guide.
The Agibot motion control program is designed with a state machine that switches between different models and opens different upper limb control interfaces based on the current state. The state machine is shown in the following diagram:

Descriptions of each state are as follows:
| Action Type | Action Code | Chinese Name | Detailed Description | Callable Interfaces |
|---|---|---|---|---|
| Safety Action | DEFAULT | Default Mode | The default action after the motion control starts. | |
| Position Control Action | RL_JOINT_DEFAULT | Reinforced Standing Mode | The robot stands with reinforced position control, standing with straight legs. | |
| Position Control Action | PASSIVE_UPPER_BODY_JOINT_SERVO | Lower Limb Passive, Upper Limb Servo Mode | The lower limbs are not enabled, and the arms can receive external joint servo commands. | T2 |
| Position Control Action | SIT_DOWN | Sitting Mode | The lower limbs perform the action, while the upper limbs remain stationary, coordinating with a chair to sit down. | |
| Position Control Action | STAND_UP | Standing Up Mode | The lower limbs perform the action, while the upper limbs remain stationary, coordinating with a chair to stand up. | |
| Force Control Action | RL_LOCOMOTION_DEFAULT | Reinforced Walking Mode | A human-like walking mode trained through reinforcement learning, where the arms swing during walking. | T1 |
| Force Control Action | RL_LOCOMOTION_ARM_EXT_JOINT_SERVO | Reinforced Walking with Upper Limb Servo Mode | The lower limbs walk or stand in a human-like manner, while the upper limbs accept external joint servo commands, performing actions during walking or standing (using a full-body control reinforcement model for better stability). | T1, T2 |
| Force Control Action | RL_WHOLE_BODY_EXT_JOINT_SERVO | Full-Body Action with Upper Limb Servo Mode | Similar to RL_LOCOMOTION_ARM_EXT_JOINT_SERVO, but with additional control over waist movements. The A2 robot does not have actual degrees of freedom in the waist, so waist movements are achieved through leg motor coordination. | T1, T2, T3 |
| Force Control Action | RL_WHOLE_BODY_DANCE | Full-Body Dance Mode | Can perform specified full-body dance actions. | S1 |
It is generally not recommended to switch between non-force control states using the program. Only switching between force control states is recommended. Other state transitions, which involve lifting and lowering the robot, should be performed manually.### 7.1.2 State Machine Switching and Query RPC Interface
| Interface Name | pb:/aimdk.protocol.McActionService/SetAction |
|---|---|
| Function Overview | Switch the motion control state machine |
| Interface Type | HTTP JSON RPC |
| URL | http://127.0.0.1:56322/rpc/aimdk.protocol.McActionService/SetAction |
| Input Parameters |
|
| Output Parameters |
|
| Example Script | examples/motion_control/SetAction.py |
| Notes |
|
| Interface Name | pb:/aimdk.protocol.McActionService/GetAction |
|---|---|
| Function Overview | Query the motion control state machine |
| Interface Type | HTTP JSON RPC |
| URL | http://127.0.0.1:56322/rpc/aimdk.protocol.McActionService/GetAction |
| Input Parameters | |
| Output Parameters |
|
| Example Script | example/mc/actions.py |
| Notes |
|
Generally, the above two interfaces are used together, as shown in the following code example:
def ensure_action(action_name: str, retries=3, retry_interval=1.0, mc_ip: str = "127.0.0.1"): try: for i in range(retries): if get_action(mc_ip) == action_name: return True set_action(action_name, mc_ip) time.sleep(0.1 if i == 0 else retry_interval) except Exception as e: print(f"Failed to set action: {e}") return False return False7.1.3 Locomotion Control Command Topic Interface
Section titled “7.1.3 Locomotion Control Command Topic Interface”| Interface Name | /motion/control/locomotion_velocity |
|---|---|
| Function Overview | Locomotion control command |
| Interface Type | ROS2 Topic |
| Input Parameters |
|
| Example Script | examples/motion_control/walk.py |
| Notes |
|
| Interface Name | /motion/control/move_waist |
|---|---|
| Function Overview | Waist control instruction |
| Interface Type | ROS2 Topic |
| Input Parameters |
|
| Example Script | examples/motion_control/move_waist.py |
| Notes |
|
7.1.5 Neck Control Instruction and State Topic Interfaces
Section titled “7.1.5 Neck Control Instruction and State Topic Interfaces”| Interface Name | /motion/control/neck_joint_command |
|---|---|
| Function Overview | Neck control instruction |
| Interface Type | ROS2 Topic |
| Input Parameters | sensor_msgs::msg::JointState
|
| Example Script | examples/motion_control/neck.py |
| Notes |
|
| Interface Name | /motion/control/neck_joint_state |
|---|---|
| Function Overview | Neck state topic |
| Interface Type | ROS2 Topic |
| Output Parameters | sensor_msgs::msg::JointState
|
| Example Script | examples/motion_control/joint_state.py |
| Notes |
|
The above neck control topic interface is suitable for scenarios requiring continuous and precise control of the neck angle, such as remote operation, and can only be called in JOINT_SERVO mode. For certain scenarios where simple control to a specific angle is needed, the following RPC interface can be used.
| Interface Name | pb:/aimdk.protocol.McMotionService/SetNeckCommand |
|---|---|
| Function Overview | Set neck command |
| Interface Type | HTTP JSON RPC |
| URL | http://127.0.0.1:56322/rpc/aimdk.protocol.McMotionService/SetNeckCommand |
| Input Parameters |
|
| Output Parameters |
|
| Example Script | examples/motion_control/SetNeckCommand.py |
| Notes |
|
| Interface Name | pb:/aimdk.protocol.McMotionService/GetNeckState |
|---|---|
| Function Overview | Get neck state |
| Interface Type | HTTP JSON RPC |
| URL | http://127.0.0.1:56322/rpc/aimdk.protocol.McMotionService/GetNeckState |
| Input Parameters | |
| Output Parameters |
|
| Example Script | examples/motion_control/GetNeckState.py |
| Notes | This interface has no Action restrictions. |
| Interface Name | /motion/control/arm_joint_command |
|---|---|
| Function Overview | Arm joint control command |
| Interface Type | ROS2 Topic |
| Input Parameters | sensor_msgs::msg::JointState
|
| Example Script | examples/motion_control/arm.py |
| Notes |
|
| Interface Name | /motion/control/arm_joint_state |
|---|---|
| Function Overview | Arm joint state topic |
| Interface Type | ROS2 Topic |
| Output Parameters | sensor_msgs::msg::JointState
|
| Example Script | examples/motion_control/joint_state.py |
| Notes | This interface has no Action restrictions |
| Interface Name | pb:/aimdk.protocol.McDataService/GetJointState |
|---|---|
| Function Overview | Retrieve the state of upper and lower limb joints |
| Interface Type | HTTP JSON RPC |
| URL | http://127.0.0.1:56322/rpc/aimdk.protocol.McMotionService/GetJointState |
| Input Parameters | |
| Output Parameters | |
| Example Script | examples/motion_control/GetJointState.py |
| Notes | This interface has no Action restrictions |
| Interface Name | pb:/aimdk.protocol.McMotionService/GetDanceTypeList |
|---|---|
| Function Overview | Retrieve the list of supported full-body dances |
| Interface Type | HTTP JSON RPC |
| URL | http://127.0.0.1:56322/rpc/aimdk.protocol.McMotionService/GetDanceTypeList |
| Input Parameters | |
| Output Parameters |
|
| Example Script | examples/motion_control/GetDanceTypeList.py |
| Notes |
|
7.1.10 Full-Body Dance Playback RPC Interface
Section titled “7.1.10 Full-Body Dance Playback RPC Interface”| Interface Name | pb:/aimdk.protocol.McMotionService/SelectDanceType |
|---|---|
| Function Overview | Full-body dance playback |
| Interface Type | HTTP JSON RPC |
| URL | http://127.0.0.1:56322/rpc/aimdk.protocol.McMotionService/SelectDanceType |
| Input Parameters |
|
| Output Parameters |
|
| Example Script | examples/motion_control/SelectDanceType.py |
| Notes |
|