5.1.7 LinkCraft Actions
Note
X2 EDU does not support the features in this section. This section applies only to X2 Ultra and X2 Ultra(new version).
About LinkCraft
LinkCraft is AgiBot’s action creation and management platform for creating, editing, debugging, and deploying robot actions. After actions created on LinkCraft are deployed to the robot, you can use the ROS interfaces described in this section to retrieve the deployed resource list and trigger single-robot or multi-robot group playback.
For platform-side usage, refer to the LinkCraft User Manual.
Interface Description
Service Name |
Data Type |
Description |
|---|---|---|
|
|
Retrieve the list of resources on the robot |
|
|
Play the specified LinkCraft action resource |
|
|
Group control time synchronization |
GetRobotResourcesros2-srv @ app_proxy/srv/GetRobotResources.srv# Retrieve the list of resources on the robot # Service name: /aimdk_5Fmsgs/srv/GetRobotResources # Request CommonRequest header # Request header --- # Response CommonResponse header # Response header RobotResource[] robot_resources # List of on-robot resources
RobotResourceros2-msg @ app_proxy/msg/RobotResource.msgstring resource_key # Unique resource identifier CurrentVersion current_version # Current version info
CurrentVersionros2-msg @ app_proxy/msg/CurrentVersion.msgstring version # Version number string name # Resource name string[] files # Resource file list uint64 download_timestamp_seconds # Resource download timestamp
ExecuteActionResourceros2-srv @ app_proxy/srv/ExecuteActionResource.srv# Play a LinkCraft action # Service name: /aimdk_5Fmsgs/srv/ExecuteActionResource # Request CommonRequest header # Request header string resource_key # Unique resource identifier (from GetRobotResources) string resource_version # Resource version SlaveDevice[] slaves # Slave device list (fill in slave IPs for group control; may be empty for single-robot playback) string meta # Extension parameters in JSON format --- CommonResponse header # Response header; header.header.code == 0 means success
SlaveDeviceros2-msg @ app_proxy/msg/SlaveDevice.msgstring ip # Slave device IP address
metafield format:Scenario
meta Value
Single-robot full-body action (onnx)
{"resource_type": "BODY_MONTION"}Single-robot arm action
{"resource_type": "ARM_MONTION"}Group-control full-body action (onnx)
{"control_type": "GROUP_CONTROL","resource_type": "BODY_MONTION"}Group-control arm action
{"control_type": "GROUP_CONTROL","resource_type": "ARM_MONTION"}When
resource_keycontainsonnx, it is a full-body action; otherwise, it is an arm action.Optional fields the
metamay also carry in group-control scenarios:if_play_master(bool, defaulttrue): whether to play on the master device. When set tofalse, only the slave devices play; the master device does not act.
Check
header.messagefor the actual result.header.status.valueis alwaysFAILURE(2)in the current firmware due to an implementation issue and cannot be used to determine success.Single-robot playback:
header.messageInterface Description
Play successPlayback succeeded
No valid resource files foundNo valid resource files found in resource directory
The robot is playingRobot is playing; cannot trigger a new task
The robot is in a faulty stateRobot is in a faulty state
The robot is not in ready postureRobot is not in ready posture
MC ROS service not readyMotion control ROS service not ready
Audio ROS service not readyAudio ROS service not ready
Face ROS service not readyFace ROS service not ready
Trigger MC ROS service error: <exception_desc>Motion control ROS service call exception (
<exception_desc>is the runtime-specific exception message)Trigger Audio ROS service error: <exception_desc>Audio ROS service call exception (same as above)
Trigger Face ROS service error: <exception_desc>Face ROS service call exception (same as above)
Trigger interaction errorFailed to call interaction playback interface
Bad requestInvalid request parameters
Error processing play item <N>: <exception_desc>Internal exception while processing play item (
<N>is the play item index,<exception_desc>is the runtime-specific exception message)No time sync result for slave device <ip>Slave device has not completed time sync during group control (
<ip>is the slave IP)<exception_desc>Unexpected exception during processing (content is the string representation of a Python exception; depends on the specific exception type and cannot be enumerated)
Group-control playback (partial slave failure):
header.messageis a JSON string containing details of each failed slave device, in the following format:{ "10.0.1.41": { "sn": "robot_serial_number", "error_code": 412, "error_msg": "The robot is playing" } }
where the key is the failed slave device’s IP (as provided by the user in the
slavesfield),snis the device’s serial number, anderror_codeanderror_msgare the specific error code and description for that device’s playback failure.Possible values of
error_codein the JSON:error_codeInterface Description
400
Invalid request parameters
401
Failed to call interaction playback interface
402
Robot is not in ready posture
403
Dangerous/damaging robot motion (reserved)
404
Resource not found (reserved)
405
Robot is in a faulty state
406
Motion control ROS service not ready
407
Audio ROS service not ready
408
Face ROS service not ready
409
Motion control ROS service call exception
410
Audio ROS service call exception
411
Face ROS service call exception
412
Robot is playing
413
Slave device without time sync (reserved)
450
Group control task failure (reserved)
500
Internal server error
503
Service unavailable (reserved)
Parsing example:
import json if header.message == "Play success": print("Playback succeeded") else: try: details = json.loads(header.message) for ip, info in details.items(): print(f"Slave {ip}: error_code {info['error_code']}, {info['error_msg']}") except json.JSONDecodeError: print(f"Playback failed: {header.message}")
GroupControlTimeSyncros2-srv @ app_proxy/srv/GroupControlTimeSync.srv# Group control time synchronization # Service name: /aimdk_5Fmsgs/srv/GroupControlTimeSync # Request CommonRequest header # Request header SlaveDevice[] slaves # Group-control slave node list --- # Response CommonResponse header # Response header int32 error_code # Error code; 0 means success string error_msg # Error message
Call this interface before group-control playback to complete multi-robot time synchronization.
error_code0 means synchronization succeeded; 1 means failure (error_msgcontains details of the failed slave devices).
Programming Examples
For detailed programming examples and code descriptions, see:
C++ Examples:
Python Examples:
Caution
As standard ROS DO NOT handle cross-host service (request-response) well, please refer to SDK examples to use open interfaces in a robust way (with protection mechanisms e.g. exception safety and retransmission)
While the robot is in Stable Standing Mode or Locomotion Mode, DO NOT launch ROS nodes in rapid bulk (no more than 2 nodes per second is recommended), as a large number of nodes joining DDS discovery within a short period causes communication congestion and degrades motion control real-time performance, which may cause the robot to lose balance and fall