Skip to content

Send the script to the robot for execution

Users can write scripts that conform to the BasScript syntax and send them to the robot for execution via this interface. It is recommended to generate these scripts programmatically to avoid errors from manual editing.

Interface Description

Function DescriptionSend Script
Interface Namegbt_interface/srv/SendScript
Interface DescriptionThis interface is used to send scripts to the robotic arm.
Start Serviceros2 launch gbt_driver gbt_service_server.launch.py robot_type:=<robot_type>
Usage Exampleros2 service call /gbt_driver/service_server/send_script gbt_interface/srv/SendScript "{script_name: 'test', script_content: 'SUB main\n MOVEJ PR[1] 100 SD 200.5\n RETURN\nEND'}"

Note:

  1. script_name : The name of the script (string).
  2. script_content : The content of the script (string).
  3. Ensure that parameters like PR[1] exist on the robot; otherwise, the script will fail to execute.
  4. robot_type defaults to "C5A" . Optional values: C7A , C12A , C16A .

Example usage:

python
bs = BasScript(name='bas_test')
ret = bs.move_joint(pose_type=MovePoseType.PR, pose_index=1, speed_type=SpeedType.VALUE, speed_value=100, smooth_type=SmoothType.SMOOTH_DISTANCE, smooth_distance=200.5)
bs.content.extend(["  RETURN", "END"])
script = "\n".join(bs.content[1:])

Detailed instructions for generating scripts are provided in the SDK documentation.

Direct Script Writing

bash
SUB main
  MOVEJ PR[1] 100 SD 200.5
  RETURN
END