Skip to content

4.7 Trajectory Control

Overview

The Trajectory module offers a full-cycle interface for offline trajectory execution, trajectory/path recording, conversion, and replay. It lets you designate a trajectory file, start/stop the robot along that trajectory, perform CSV-to-trajectory format conversion inside the controller, and supports host-side trajectory logging, status queries, and path-planner parameter configuration—making it easy to reproduce complex trajectories and create custom motions.

4.7.1 Set the Offline Trajectory File to Execute

Method Nametrajectory.set_offline_trajectory_file( path : str) -> StatusCodeEnum
DescriptionSets the offline trajectory file to execute.
Request Parameterspath : str Name of the offline trajectory file (for example: A.trajectory ).
File format is a plain text file:
- Line 1: 6 → number of axes; 0.001 → time interval between points (s); 8093 → total number of trajectory points.
- Line 2: Initial positions of the 6 axes.
- Lines 3–8095: Trajectory points including position, velocity, acceleration, torque feedforward, do_port , and do_state for the 6 axes.
- do_port : DO port used (1–24).
- do_port = -1 : no IO signal is triggered at this point.
- do_port = 1 and do_state = 1 : do1 is set ON at this point.
- do_port = 1 and do_state = 0 : do1 is set OFF at this point.
Return ValueStatusCodeEnum: Result of the function execution.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.2 Move to the Starting Point at a Safe Speed

Method Nametrajectory.prepare_offline_trajectory() -> StatusCodeEnum
DescriptionMoves the robot to the starting point of the offline trajectory at a safe speed.
Request ParametersNone
Return ValueStatusCodeEnum: Result of the function execution.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.3 Start Executing the Offline Trajectory

Method Nametrajectory.execute_offline_trajectory() -> StatusCodeEnum
DescriptionStarts executing the offline trajectory program.
Request ParametersNone
Return ValueStatusCodeEnum: Result of the function execution.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.4 Trajectory File Conversion

Method Nametrajectory.transform_csv_to_trajectory( file_name : str, separator : str = " ", io_flag : str = "2")
DescriptionConverts a trajectory CSV file to the controller trajectory format and stores it in the controller's trajectory directory.
Request Parametersfile_name : str CSV trajectory file name, without the .csv suffix.
separator : " " (space) or "," (comma). When space, the converted file uses the .trajectory suffix; when comma, the converted file uses the .csv suffix.
io_flag : If 1 , generated IO info uses defaults ( do_port = -1 , do_state = 0 ); if 2 , use user-specified IO info.
Return Valuestr: Path of the converted trajectory file
StatusCodeEnum: Result of the function execution.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.5 Query Trajectory File Conversion Status

Method Nametrajectory.check_transform_status( file_name : str) -> tuple[TransformStatusEnum, StatusCodeEnum]
DescriptionQueries the current status of the trajectory file conversion.
Request Parametersfile_name : str Path returned by transform_csv_to_trajectory .
Return ValueTransformStatusEnum: Conversion status
StatusCodeEnum: Result of the function execution.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

trajectory/offline_trajectory.py
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 离线轨迹使用示例 / Example of offline trajectory usage
"""

import time

from Agilebot import Arm, RobotStatusEnum, ServoStatusEnum, StatusCodeEnum

# [ZH] 初始化捷勃特机器人
# [EN] Initialize the robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to the robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if the connection is successful
if ret == StatusCodeEnum.OK:
    print("机器人连接成功 / Robot connected successfully")
else:
    print(f"机器人连接失败,错误代码 / Robot connection failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 设置离线轨迹文件
# [EN] Set the offline trajectory file
ret = arm.trajectory.set_offline_trajectory_file("test_torque.trajectory")
if ret == StatusCodeEnum.OK:
    print("设置离线轨迹文件成功 / Set offline trajectory file successful")
else:
    print(f"设置离线轨迹文件失败,错误代码 / Set offline trajectory file failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 准备进行离线轨迹运行
# [EN] Prepare for offline trajectory execution
ret = arm.trajectory.prepare_offline_trajectory()
if ret == StatusCodeEnum.OK:
    print("准备离线轨迹运行成功 / Prepare offline trajectory execution successful")
else:
    print(f"准备离线轨迹运行失败,错误代码 / Prepare offline trajectory execution failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 等待控制器到位
# [EN] Wait for the controller to be ready
while True:
    robot_status, ret = arm.get_robot_status()
    if ret == StatusCodeEnum.OK:
        print("获取机器人状态成功 / Get robot status successful")
    else:
        print(f"获取机器人状态失败,错误代码 / Get robot status failed, error code: {ret.errmsg}")
        arm.disconnect()
        exit(1)
    print(f"robot_status arm: {robot_status}")
    servo_status, ret = arm.get_servo_status()
    if ret == StatusCodeEnum.OK:
        print("获取伺服状态成功 / Get servo status successful")
    else:
        print(f"获取伺服状态失败,错误代码 / Get servo status failed, error code: {ret.errmsg}")
        arm.disconnect()
        exit(1)
    print(f"伺服状态 / Servo status: {servo_status}")
    if robot_status == RobotStatusEnum.ROBOT_IDLE and servo_status == ServoStatusEnum.SERVO_IDLE:
        break
    time.sleep(2)

# [ZH] 执行离线轨迹
# [EN] Execute the offline trajectory
ret = arm.trajectory.execute_offline_trajectory()
if ret == StatusCodeEnum.OK:
    print("执行离线轨迹成功 / Execute offline trajectory successful")
else:
    print(f"执行离线轨迹失败,错误代码 / Execute offline trajectory failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from the robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")

4.7.6 Start Recording Trajectory

Method Nametrajectory.trajectory_record_begin( name : str) -> StatusCodeEnum
DescriptionInstructs the robot to start recording a trajectory.
Parametersname : trajectory program name.
ReturnStatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.7 Stop Recording Trajectory

Method Nametrajectory.trajectory_record_finish( name : str) -> StatusCodeEnum
DescriptionInstructs the robot to stop recording a trajectory.
Parametersname : trajectory program name.
ReturnStatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.8 Start Replaying Trajectory

Method Nametrajectory.trajectory_replay_start( name : str) -> StatusCodeEnum
DescriptionInstructs the robot to start replaying a trajectory.
Parametersname : trajectory program name.
ReturnStatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.9 Stop Replaying Trajectory

Method Nametrajectory.trajectory_replay_stop( name : str) -> StatusCodeEnum
DescriptionInstructs the robot to stop replaying a trajectory.
Parametersname : trajectory program name.
ReturnStatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.10 Delete Trajectory

Method Nametrajectory.trajectory_record_delete( name : str) -> StatusCodeEnum
DescriptionDeletes the specified trajectory stored in the robot.
Parametersname : trajectory program name.
ReturnStatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.11 Get List of Recorded Trajectories

Method Nametrajectory.get_trajectory_record_list() -> tuple[list[str], StatusCodeEnum]
DescriptionRetrieves the list of recorded trajectories available for replay.
ParametersNone
Return[list[str]]: list of trajectory program names.
StatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.7.12 Get Starting Pose of a Recorded Trajectory

Method Nametrajectory.get_trajectory_record_start_pose( name : str) -> tuple[MotionPose, StatusCodeEnum]
DescriptionRetrieves the starting pose of a recorded trajectory.
Parametersname : trajectory program name.
ReturnMotionPose: Starting pose of the trajectory.
StatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

trajectory/trajectory_record.py
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 轨迹记录相关使用示例 / Example of real-time trajectory records usage
"""

import time

from Agilebot import Arm, RobotStatusEnum, ServoStatusEnum, StatusCodeEnum
from Agilebot.IR.A.hardware_state import HardwareState, HWState

# [ZH] 初始化捷勃特机器人
# [EN] Initialize the robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to the robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if the connection is successful
if ret == StatusCodeEnum.OK:
    print("机器人连接成功 / Robot connected successfully")
else:
    print(f"机器人连接失败,错误代码 / Robot connection failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 订阅轨迹记录状态
# [EN] Subscribe to the trajectory record status
hw_state = HardwareState("10.27.1.254")
hw_state.subscribe(topic_list=[HWState.TOPIC_TRAJECTORY_RECORDS_STATUS])

# [ZH] 开始记录轨迹
# [EN] Start recording trajectory
ret = arm.trajectory.trajectory_record_begin("test")
if ret == StatusCodeEnum.OK:
    print("开始轨迹记录成功 / Start trajectory record successful")
else:
    print(f"开始轨迹记录失败,错误代码 / Start trajectory record failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)
time.sleep(10)

res = hw_state.recv()
print(f"轨迹记录状态 / Trajectory record status: {res}")

# [ZH] 结束记录轨迹
# [EN] End recording trajectory
ret = arm.trajectory.trajectory_record_finish("test")
if ret == StatusCodeEnum.OK:
    print("结束轨迹记录成功 / End trajectory record successful")
else:
    print(f"结束轨迹记录失败,错误代码 / End trajectory record failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

res = hw_state.recv()
print(f"轨迹记录状态 / Trajectory record status: {res}")

# [ZH] 获取轨迹列表
# [EN] Get trajectory list
record_list, ret = arm.trajectory.get_trajectory_record_list()
if ret == StatusCodeEnum.OK:
    print("获取轨迹记录列表成功 / Get trajectory record list successful")
else:
    print(f"获取轨迹记录列表失败,错误代码 / Get trajectory record list failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)
assert "test" in record_list

# [ZH] 获取轨迹起始位姿
# [EN] Get trajectory start pose
pose, ret = arm.trajectory.get_trajectory_record_start_pose("test")
if ret == StatusCodeEnum.OK:
    print("获取轨迹起始位姿成功 / Get trajectory start pose successful")
else:
    print(f"获取轨迹起始位姿失败,错误代码 / Get trajectory start pose failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 移动到起始位姿
# [EN] Move to the start pose
ret = arm.motion.move_joint(pose)
if ret == StatusCodeEnum.OK:
    print("关节运动成功 / Joint motion successful")
else:
    print(f"关节运动失败,错误代码 / Joint motion failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 等待控制器到位
# [EN] Wait for the controller to be ready
while True:
    robot_status, ret = arm.get_robot_status()
    if ret == StatusCodeEnum.OK:
        print("获取机器人状态成功 / Get robot status successful")
    else:
        print(f"获取机器人状态失败,错误代码 / Get robot status failed, error code: {ret.errmsg}")
        arm.disconnect()
        exit(1)
    print(f"robot_status arm: {robot_status}")
    servo_status, ret = arm.get_servo_status()
    if ret == StatusCodeEnum.OK:
        print("获取伺服状态成功 / Get servo status successful")
    else:
        print(f"获取伺服状态失败,错误代码 / Get servo status failed, error code: {ret.errmsg}")
        arm.disconnect()
        exit(1)
    print(f"伺服状态 / Servo status: {servo_status}")
    if robot_status == RobotStatusEnum.ROBOT_IDLE and servo_status == ServoStatusEnum.SERVO_IDLE:
        break
    time.sleep(2)

# [ZH] 开始回放轨迹
# [EN] Start replay trajectory
ret = arm.trajectory.trajectory_replay_start("test")
if ret == StatusCodeEnum.OK:
    print("开始轨迹回放成功 / Start trajectory replay successful")
else:
    print(f"开始轨迹回放失败,错误代码 / Start trajectory replay failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

time.sleep(5)

# [ZH] 停止回放轨迹
# [EN] Stop replay trajectory
ret = arm.trajectory.trajectory_replay_stop("test")
if ret == StatusCodeEnum.OK:
    print("停止轨迹回放成功 / Stop trajectory replay successful")
else:
    print(f"停止轨迹回放失败,错误代码 / Stop trajectory replay failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 删除轨迹
# [EN] Delete trajectory
ret = arm.trajectory.trajectory_record_delete("test")
if ret == StatusCodeEnum.OK:
    print("删除轨迹记录成功 / Delete trajectory record successful")
else:
    print(f"删除轨迹记录失败,错误代码 / Delete trajectory record failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from the robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")

4.7.13 Start Recording Trajectory / Path

Method Nametrajectory.path_record_begin( name : str, comment : str, param : float, angle : float = 1) -> StatusCodeEnum
DescriptionStarts recording a trajectory table (.traj) or a path table (.path).
Parametersname : trajectory / path file name, must end with .traj or .path.
comment : description for the trajectory / path.
param :
- for .path tables: linear-motion distance threshold (mm).
- for .traj tables: recording interval (ms).
angle : rotational-angle threshold (°), only effective when name is a .path file.
ReturnStatusCodeEnum: execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.8.0.0+
Industrial (Bronze): not supported

4.7.14 Stop Recording Trajectory / Path

Method Nametrajectory.path_record_finish() -> StatusCodeEnum
DescriptionStops the current trajectory / path table recording.
Parametersnone
ReturnStatusCodeEnum: execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.8.0.0+
Industrial (Bronze): not supported

4.7.15 Get Starting Pose of a Trajectory / Path

Method Nametrajectory.get_path_start_pose( name : str) -> tuple[MotionPose, StatusCodeEnum]
DescriptionRetrieves the starting pose of the specified trajectory / path file.
Parametersname : trajectory / path file name.
ReturnMotionPose : Starting pose.
StatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.8.0.0+
Industrial (Bronze): not supported

4.7.16 Get Status of Trajectories / Paths

Method Nametrajectory.get_path_state( path_list : list[str]) -> tuple[dict[str, int], StatusCodeEnum]
DescriptionBatch-query the current status of trajectory / path files.
Parameterspath_list : list of trajectory / path file names to query.
Returndict[str, int] : mapping of file name → status code.
StatusCodeEnum: execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.8.0.0+
Industrial (Bronze): not supported

4.7.17 Set Path-Planner Parameters

Method Nametrajectory.set_path_planner_parameter( transition_time : float, scaling_factor : float) -> StatusCodeEnum
DescriptionConfigures path-planner parameters affecting motion smoothness and speed / acceleration distribution.
Parameterstransition_time : blending time, 0–1. Larger values yield smoother acceleration / deceleration.
scaling_factor : redistribution weight of path parameter s, 0–1:
- 0: uniform time scaling (equal-length segments).
- 1: linear scaling by maximum displacement (equal-velocity segments).
- 0.5: equal-acceleration scaling.
- 0.33: equal-jerk scaling (balanced).
ReturnStatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.8.0.0+
Industrial (Bronze): not supported

4.7.18 Get Path-Planner Parameters

Method Nametrajectory.get_path_planner_parameter() -> tuple[float, float, StatusCodeEnum]
DescriptionReads the current path-planner parameters.
Parametersnone
Returntransition_time : blending time, 0–1.
scaling_factor : redistribution weight, 0–1.
StatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.8.0.0+
Industrial (Bronze): not supported

4.7.19 Move Along a Trajectory / Path

Method Nametrajectory.move_path( name : str, vel : float = 100, acc : float = 1) -> StatusCodeEnum
DescriptionCommands the robot end-effector to move along the specified trajectory / path file.
Parametersname : trajectory / path file name.
vel : end-effector speed, 0–5000 mm/s.
acc : acceleration multiplier, 0–1.2.
ReturnStatusCodeEnum: Execution result of the function.
Compatible robot software versionCollaborative (Copper): v7.8.0.0+
Industrial (Bronze): not supported

Example Code

trajectory/path_record.py
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 路径记录相关使用示例 / Example of usage related to path records
"""

import time

from Agilebot import Arm, MoveMode, RobotStatusEnum, ServoStatusEnum, StatusCodeEnum

# [ZH] 初始化机械臂并连接到指定IP地址
# [EN] Initialize the robotic arm and connect to the specified IP address
arm = Arm()
ret = arm.connect("10.27.1.254")
if ret == StatusCodeEnum.OK:
    print("机器人连接成功 / Robot connected successfully")
else:
    print(f"机器人连接失败,错误代码 / Robot connection failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 开始记录轨迹,指定文件名、轨迹名、记录模式和覆盖选项
# [EN] Start trajectory recording, specifying filename, trajectory name, recording mode and overwrite option
ret = arm.trajectory.path_record_begin("test_path.path", "Path Test", 10, 1)
if ret == StatusCodeEnum.OK:
    print("开始路径记录成功 / Start path record successful")
else:
    print(f"开始路径记录失败,错误代码 / Start path record failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 检查记录状态,传入轨迹文件名列表
# [EN] Check recording status, passing in trajectory filename list
state, ret = arm.trajectory.get_path_state(["test_path.path"])
if ret == StatusCodeEnum.OK:
    print("获取路径状态成功 / Get path state successful")
else:
    print(f"获取路径状态失败,错误代码 / Get path state failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)
if state["test_path.path"] == 0:
    print("路径表记录中 / Path table recording in progress")

# [ZH] 示教运动
# [EN] Teaching motion
ret = arm.jogging.move(3, MoveMode.Continuous)
if ret == StatusCodeEnum.OK:
    print("点动运动成功 / Jogging movement successful")
else:
    print(f"点动运动失败,错误代码 / Jogging movement failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)
# 等待3秒,让机械臂持续运动
time.sleep(2)
# 停止机械臂运动
arm.jogging.stop()
time.sleep(2)
ret = arm.jogging.move(-3, MoveMode.Continuous)
if ret == StatusCodeEnum.OK:
    print("点动运动成功 / Jogging movement successful")
else:
    print(f"点动运动失败,错误代码 / Jogging movement failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)
# 等待3秒,让机械臂持续运动
time.sleep(2)
# 停止机械臂运动
arm.jogging.stop()
time.sleep(2)

# [ZH] 结束轨迹记录
# [EN] Finish trajectory recording
ret = arm.trajectory.path_record_finish()
if ret == StatusCodeEnum.OK:
    print("结束路径记录成功 / Finish path record successful")
else:
    print(f"结束路径记录失败,错误代码 / Finish path record failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 检查记录状态,传入轨迹文件名列表
# [EN] Check recording status, passing in trajectory filename list
state, ret = arm.trajectory.get_path_state(["test_path.path"])
if ret == StatusCodeEnum.OK:
    print("获取路径状态成功 / Get path state successful")
else:
    print(f"获取路径状态失败,错误代码 / Get path state failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)
if state["test_path.path"] == 1:
    print("路径表记录完成 / Path table recording completed")

# [ZH] 获取记录轨迹的起始位置姿态
# [EN] Get the starting position pose of the recorded trajectory
pose, ret = arm.trajectory.get_path_start_pose("test_path.path")
if ret == StatusCodeEnum.OK:
    print("获取路径起始位姿成功 / Get path start pose successful")
else:
    print(f"获取路径起始位姿失败,错误代码 / Get path start pose failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 移动到起始位姿
# [EN] Move to the start pose
ret = arm.motion.move_joint(pose)
if ret == StatusCodeEnum.OK:
    print("关节运动成功 / Joint motion successful")
else:
    print(f"关节运动失败,错误代码 / Joint motion failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 等待控制器到位
# [EN] Wait for the controller to be ready
while True:
    robot_status, ret = arm.get_robot_status()
    # [ZH] 检查机器人状态获取是否成功
    # [EN] Check if robot status acquisition is successful
    if ret == StatusCodeEnum.OK:
        print("获取机器人状态成功 / Get robot status successful")
    else:
        print(f"获取机器人状态失败,错误代码 / Get robot status failed, error code: {ret.errmsg}")
        arm.disconnect()
        exit(1)
    print(f"robot_status arm: {robot_status}")
    servo_status, ret = arm.get_servo_status()
    # [ZH] 检查伺服状态获取是否成功
    # [EN] Check if servo status acquisition is successful
    if ret == StatusCodeEnum.OK:
        print("获取伺服状态成功 / Get servo status successful")
    else:
        print(f"获取伺服状态失败,错误代码 / Get servo status failed, error code: {ret.errmsg}")
        arm.disconnect()
        exit(1)
    print(f"servo status arm: {servo_status}")
    if robot_status == RobotStatusEnum.ROBOT_IDLE and servo_status == ServoStatusEnum.SERVO_IDLE:
        break
    time.sleep(2)

# [ZH] 设置轨迹规划参数(速度比例和加速度比例)
# [EN] Set trajectory planning parameters (velocity ratio and acceleration ratio)
ret = arm.trajectory.set_path_planner_parameter(0.5, 0.3333333)
if ret == StatusCodeEnum.OK:
    print("设置路径规划参数成功 / Set path planner parameter successful")
else:
    print(f"设置路径规划参数失败,错误代码 / Set path planner parameter failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 获取轨迹规划参数以验证设置是否成功
# [EN] Get trajectory planning parameters to verify if the setting is successful
param1, param2, ret = arm.trajectory.get_path_planner_parameter()
if ret == StatusCodeEnum.OK:
    print("获取路径规划参数成功 / Get path planner parameter successful")
else:
    print(f"获取路径规划参数失败,错误代码 / Get path planner parameter failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)

# [ZH] 移动到记录的轨迹,指定轨迹文件名、速度和模式
# [EN] Move to the recorded trajectory, specifying trajectory filename, speed and mode
ret = arm.trajectory.move_path("test_path.path", 2000, 1)
if ret == StatusCodeEnum.OK:
    print("路径运动成功 / Path motion successful")
else:
    print(f"路径运动失败,错误代码 / Path motion failed, error code: {ret.errmsg}")
    arm.disconnect()
    exit(1)
time.sleep(3)

# [ZH] 断开与机械臂的连接
# [EN] Disconnect from the robotic arm
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")