Skip to content

7.2 Action Playback Section

The A2 Lite provides basic preset action playback capabilities, with some preset actions pre-installed on the machine (additional actions can be recorded using remote operation devices to meet more personalized needs; for more information, please refer to the relevant documentation on remote operation). The list of default preset actions is as follows:

双手挥手/双手挥手
右手挥手/右手挥手
右手握手/右手握手
右手握手_长/右手握手_长
向右张望/1758103570432482028
向左张望/1758103588180395683
左手挥手/左手挥手
左手握手/左手握手
左手握手_长/左手握手_长
摆拍_我是大力士/摆拍_我是大力士
敬礼/敬礼
环顾四周/1758103607745291736
看双手/1758104272873252746
看右手/1758104294863353043
看右臂/1758103484383524451
看左手/175810431583786588
看左臂/1758103505321711264

The above action files are located in the x86 directory /agibot/data/resources/default/motion/motion_player/default. Custom recorded actions should be placed in the /agibot/data/resources/default/motion/motion_player/custom directory. The above list is obtained by specifying the following command in the corresponding directory:

Terminal window
find . -name "*.db" -type f | sed 's|^\./\([^/]*\)/\(.*\)\.db|\1/\2|' | sort

The specific action effects can be viewed using the motion control simulation provided in subsequent chapters or directly on the real machine.

Onboard action playback is handled by the motion_player module, which controls the arm and neck joints in JOINT_SERVO mode. The basic control principle involves reading and parsing the specified action file, playing the action file at 100 Hz, and sending /motion/control/arm_joint_command and /motion/control/neck_joint_command to the motion control module, which then performs the corresponding actions.

Interface Name pb:/aimdk.protocol.MotionCommandService/SendMotionCommand
Function Summary Play the specified action file
Interface Type HTTP JSON RPC
URL http://127.0.0.1:56444/rpc/aimdk.protocol.MotionCommandService/SendMotionCommand
Input Parameters
{
  "motion_id": "/agibot/data/resources/default/motion/motion_player/default/Wave Both Hands/Wave Both Hands",
  "duration_ms": 10000,
  "cmd_end": true,
  "cmd_pause": false,
  "cmd_reset": false
}
  • motion_id: Absolute path of the action file, up to the last .db file, without the .db suffix, for example:

    • /agibot/data/resources/default/motion/motion_player/default/Wave Both Hands/Wave Both Hands
  • duration_ms: An invalid field, leave it as is

  • cmd_end: Whether to automatically return to the initial posture after the action is executed, true indicates automatic reset, false indicates no automatic reset

  • cmd_pause: Action pause flag, true indicates pause, which will stop sending control signals to the robot, generally not used

  • cmd_reset: Reset flag, true indicates reset, false indicates no reset. The reset operation will reset the current action state to the initial state

Output Parameters
{
  "header": {
    "code": "0",
    "msg": "",
    "timestamp": {
      "seconds": "1762851946",
      "nanos": 693223585,
      "ms_since_epoch": "0"
    },
    "trace_id": "",
    "domin": ""
  },
  "state": "CommonState_SUCCESS"
}
  • state: Call request status
Example Script examples/motion_player/send_motion_id.sh
Notes This interface call code is T2, and can only be called under the JOINT_SERVO suffix motion control Action

7.2.3 Action Playback Status Query RPC Interface

Section titled “7.2.3 Action Playback Status Query RPC Interface”
Interface Name pb:/aimdk.protocol.MotionCommandService/GetMotionStatus
Function Summary Get the action playback status
Interface Type HTTP JSON RPC
URL http://127.0.0.1:56444/rpc/aimdk.protocol.MotionCommandService/GetMotionStatus
Input Parameters
{}
Output Parameters
{
  "header": {
    "code": "0",
    "msg": "",
    "timestamp": {
      "seconds": "1762852836",
      "nanos": 502608623,
      "ms_since_epoch": "0"
    },
    "trace_id": "",
    "domin": ""
  },
  "time_to_end_ms": "235",
  "status": "MotionCommandStatus_OPERATING",
  "is_neck_enable": true,
  "motion_id": "1Wave Hello"
}
  • time_to_end_ms: Time remaining until the end of the action, in milliseconds

  • status: Action playback status

    • MotionCommandStatus_IDLE: No action, idle
    • MotionCommandStatus_START: Action starts playing
    • MotionCommandStatus_OPERATING: Action is playing
    • MotionCommandStatus_PAUSE: State when calling the action playback interface with cmd_pause=true
    • MotionCommandStatus_STOP: State after calling DisableMotionPlayer
  • is_neck_enable: Whether the neck is controlled by the motion_player

  • motion_id: Action name

Example Script examples/motion_player/get_motion_status.sh
Notes This interface call code is T2, and can only be called under the JOINT_SERVO suffix motion control Action

7.2.4 Disable and Enable Action Playback Module RPC Interface

Section titled “7.2.4 Disable and Enable Action Playback Module RPC Interface”

The action playback module continuously sends /motion/control/arm_joint_command and /motion/control/neck_joint_command control instructions to the motion control module in JOINT_SERVO mode. If a secondary program also sends instructions, it can cause conflicts. You can use the following interfaces to disable and enable the action playback module.

Interface Name pb:/aimdk.protocol.MotionCommandService/DisableMotionPlayer
Function Summary Disable the action playback module, the process will not exit, and no instructions will be sent to the motion control module
Interface Type HTTP JSON RPC
URL http://127.0.0.1:56444/rpc/aimdk.protocol.MotionCommandService/DisableMotionPlayer
Input Parameters
{}
Output Parameters
{
  "state":"CommonState_SUCCESS"
}
  • state: Call request status
Example Script examples/motion_player/disable_motion_player.sh
Notes This interface has no call code restriction
Interface Name pb:/aimdk.protocol.MotionCommandService/EnableMotionPlayer
Function Summary Enable the action playback module, start continuously sending instructions to the motion control module
Interface Type HTTP JSON RPC
URL http://127.0.0.1:56444/rpc/aimdk.protocol.MotionCommandService/EnableMotionPlayer
Input Parameters
{}
Output Parameters
{
  "state":"CommonState_SUCCESS"
}
  • state: Call request status
Example Script examples/motion_player/enable_motion_player.sh
Notes This interface has no call code restriction

7.2.5 Disable and Enable Neck Control for Action Playback RPC Interface

Section titled “7.2.5 Disable and Enable Neck Control for Action Playback RPC Interface”

In some cases, it is necessary to disable the neck’s action playback function separately, thereby transferring control of the neck to a secondary program for head tracking, etc. You can use the following interfaces to disable and enable neck control for action playback.

Interface Name pb:/aimdk.protocol.MotionCommandService/DisableNeckMotionPlayer
Function Summary Disable the action playback module from controlling the neck motor, the process will not exit, and no neck instructions will be sent to the motion control module
Interface Type HTTP JSON RPC
URL http://127.0.0.1:56444/rpc/aimdk.protocol.MotionCommandService/DisableNeckMotionPlayer
Input Parameters
{}
Output Parameters
{
  "state":"CommonState_SUCCESS"
}
  • state: Call request status
Example Script examples/motion_player/disable_neck_motion_player.sh
Notes This interface has no call code restriction
Interface Name pb:/aimdk.protocol.MotionCommandService/EnableNeckMotionPlayer
Function Summary Enable the action playback module to control the neck, start continuously sending neck control instructions to the motion control module
Interface Type HTTP JSON RPC
URL http://127.0.0.1:56444/rpc/aimdk.protocol.MotionCommandService/EnableNeckMotionPlayer
Input Parameters
{}
Output Parameters
{
  "state":"CommonState_SUCCESS"
}
  • state: Call request status
Example Script examples/motion_player/enable_neck_motion_player.sh
Notes This interface has no call code restriction