4.2 Robot Motion Control and Status
Overview
The Motion class is the core object for motion control of Jiebote robots. It provides a unified interface for setting speed/acceleration parameters, coordinate systems, point conversion, trajectory motion, drag-to-teach, real-time control, and payload management.
Typical workflow: after the Arm connection is established, obtain the Motion instance via arm.motion .
4.2.1 Get Robot Parameters
4.2.1.1 Get OVC Overall Velocity Coefficient
| Method Name | motion.get_OVC() -> tuple[float, StatusCodeEnum] |
|---|---|
| Description | Get the current OVC Overall Velocity Coefficient of the robot, which ranges from 0 to 1 |
| Request Parameters | No parameters |
| Return Value | float: Velocity ratio, ranging from 0 to 1 StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.1.2 Get OAC Overall Acceleration Coefficient
| Method Name | motion.get_OAC() -> tuple[float, StatusCodeEnum] |
|---|---|
| Description | Get the current OAC Overall Acceleration Coefficient of the robot, which ranges from 0 to 1.2 |
| Request Parameters | No parameters |
| Return Value | float: Acceleration ratio, ranging from 0 to 1.2 StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.1.3 Get Current TF Tool Coordinate System Number
| Method Name | motion.get_TF() -> tuple[int, StatusCodeEnum] |
|---|---|
| Description | Get the current TF tool coordinate system number used by the robot, valid range 0~50 |
| Request Parameters | No parameters |
| Return Value | int: Tool coordinate system number StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.1.4 Get Current UF User Coordinate System Number
| Method Name | motion.get_UF() -> tuple[int, StatusCodeEnum] |
|---|---|
| Description | Get the current UF user coordinate system number used by the robot, valid range 0~50 |
| Request Parameters | No parameters |
| Return Value | int: User coordinate system number StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.1.5 Get Current TCS Teaching Coordinate System
| Method Name | motion.get_TCS() -> tuple[TCSType, StatusCodeEnum] |
|---|---|
| Description | Get the current TCS teaching coordinate system used by the robot, refer to TCSType for details |
| Request Parameters | No parameters |
| Return Value | TCSType: Teaching coordinate system number StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 全局参数设置示例 / Example of system parameter setting
"""
from Agilebot import Arm, StatusCodeEnum, TCSType
# [ZH] 初始化捷勃特机器人
# [EN] Initialize the Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to the Agilebot 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 robot parameters
ret = arm.motion.set_OVC(0.7)
if ret == StatusCodeEnum.OK:
print("设置全局速度比率成功 / Set global velocity ratio successful")
else:
print(f"设置全局速度比率失败,错误代码 / Set global velocity ratio failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
ret = arm.motion.set_OAC(0.7)
if ret == StatusCodeEnum.OK:
print("设置全局加速度比率成功 / Set global acceleration ratio successful")
else:
print(f"设置全局加速度比率失败,错误代码 / Set global acceleration ratio failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
ret = arm.motion.set_TCS(TCSType.TOOL)
if ret == StatusCodeEnum.OK:
print("设置示教坐标系类型成功 / Set teaching coordinate system type successful")
else:
print(f"设置示教坐标系类型失败,错误代码 / Set teaching coordinate system type failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
ret = arm.motion.set_UF(0)
if ret == StatusCodeEnum.OK:
print("设置用户坐标系成功 / Set user coordinate system successful")
else:
print(f"设置用户坐标系失败,错误代码 / Set user coordinate system failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
ret = arm.motion.set_TF(0)
if ret == StatusCodeEnum.OK:
print("设置工具坐标系成功 / Set tool coordinate system successful")
else:
print(f"设置工具坐标系失败,错误代码 / Set tool coordinate system failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from the Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.2 Set Robot Parameters
4.2.2.1 Set OVC Overall Velocity Coefficient
| Method Name | motion.set_OVC( value : float) -> StatusCodeEnum |
|---|---|
| Description | Set the OVC Overall Velocity Coefficient of the robot |
| Request Parameters | value : float, velocity ratio in the range (0, 1], i.e., greater than 0 and no more than 1 |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.2.2 Set OAC Overall Acceleration Coefficient
| Method Name | motion.set_OAC( value : float) -> StatusCodeEnum |
|---|---|
| Description | Set the OAC Overall Acceleration Coefficient of the robot |
| Request Parameters | value : float, acceleration ratio in the range (0.01, 1.2] |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.2.3 Set Current TF Tool Coordinate System
| Method Name | motion.set_TF( value : int) -> StatusCodeEnum |
|---|---|
| Description | Set the current TF tool coordinate system used by the robot |
| Request Parameters | value : int, tool coordinate system number, valid range 0~50 |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.2.4 Set Current UF User Coordinate System
| Method Name | motion.set_UF( value : int) -> StatusCodeEnum |
|---|---|
| Description | Set the current UF user coordinate system used by the robot |
| Request Parameters | value : int, user coordinate system number, valid range 0~50 |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.2.5 Set Current TCS Teaching Coordinate System
| Method Name | motion.set_TCS( value : TCSType) -> StatusCodeEnum |
|---|---|
| Description | Set the current TCS teaching coordinate system used by the robot, refer to TCSType for details |
| Request Parameters | value : TCSType, TCS teaching coordinate system |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 全局参数获取示例 / Example of system parameter acquisition
"""
from Agilebot import Arm, StatusCodeEnum, TCSType
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Get robot parameters and print
res, ret = arm.motion.get_OVC()
if ret == StatusCodeEnum.OK:
print("获取全局速度比率成功 / Get global velocity ratio successful")
else:
print(f"获取全局速度比率失败,错误代码 / Get global velocity ratio failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
print(f"全局速度比率 / Global velocity ratio: {res}")
res, ret = arm.motion.get_OAC()
if ret == StatusCodeEnum.OK:
print("获取全局加速度比率成功 / Get global acceleration ratio successful")
else:
print(f"获取全局加速度比率失败,错误代码 / Get global acceleration ratio failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
print(f"全局加速度比率 / Global acceleration ratio: {res}")
res, ret = arm.motion.get_TCS()
if ret == StatusCodeEnum.OK:
print("获取示教坐标系类型成功 / Get teaching coordinate system type successful")
else:
print(f"获取示教坐标系类型失败,错误代码 / Get teaching coordinate system type failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
print(f"示教坐标系类型 / Teaching coordinate system type: {TCSType(res).name}")
res, ret = arm.motion.get_UF()
if ret == StatusCodeEnum.OK:
print("获取用户坐标系成功 / Get user coordinate system successful")
else:
print(f"获取用户坐标系失败,错误代码 / Get user coordinate system failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
print(f"用户坐标系 / User coordinate system: {res}")
res, ret = arm.motion.get_TF()
if ret == StatusCodeEnum.OK:
print("获取工具坐标系成功 / Get tool coordinate system successful")
else:
print(f"获取工具坐标系失败,错误代码 / Get tool coordinate system failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
print(f"工具坐标系 / Tool coordinate system: {res}")
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.3 Convert Cartesian Pose to Joint Pose
| Method Name | motion.convert_cart_to_joint( pose : MotionPose, uf_index : int = 0, tf_index : int = 0) -> tuple[MotionPose, StatusCodeEnum] |
|---|---|
| Description | Convert pose data from Cartesian coordinates to joint coordinates |
| Request Parameters | pose : MotionPose Robot pose in Cartesian coordinates (PoseType.CART). If posture is not provided, the SDK automatically finds a feasible posture uf_index : int User coordinate system ID tf_index : int Tool coordinate system ID |
| Return Value | MotionPose: Robot pose StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
4.2.4 Convert Joint Pose to Cartesian Pose
| Method Name | motion.convert_joint_to_cart( pose : MotionPose, uf_index : int = 0, tf_index : int = 0) -> tuple[MotionPose, StatusCodeEnum] |
|---|---|
| Description | Convert joint coordinates to Cartesian coordinates |
| Request Parameters | pose : MotionPose Robot's pose in joint coordinates uf_index : int User coordinate system ID tf_index : int Tool coordinate system ID |
| Return Value | MotionPose: Robot pose StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 转换关节值坐标使用示例 / Example of converting joint coordinates
"""
from Agilebot import Arm, MotionPose, PoseType, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Initialize pose
motion_pose = MotionPose()
motion_pose.pt = PoseType.CART
motion_pose.cartData.position.x = 221.5
motion_pose.cartData.position.y = -494.1
motion_pose.cartData.position.z = 752.0
motion_pose.cartData.position.a = -89.1
motion_pose.cartData.position.b = 31.6
motion_pose.cartData.position.c = -149.3
# [ZH] 转换关节值坐标
# [EN] Convert to joint coordinates
joint_pose, ret = arm.motion.convert_cart_to_joint(motion_pose)
if ret == StatusCodeEnum.OK:
print("转换关节值坐标成功 / Convert to joint coordinates successful")
else:
print(f"转换关节值坐标失败,错误代码 / Convert to joint coordinates failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果位姿
# [EN] Print result pose
print(f"位姿类型 / Pose type: {joint_pose.pt}")
print(
f"轴位置 / Axis position: \n"
f"J1:{joint_pose.joint.j1}\n"
f"J2:{joint_pose.joint.j2}\n"
f"J3:{joint_pose.joint.j3}\n"
f"J4:{joint_pose.joint.j4}\n"
f"J5:{joint_pose.joint.j5}\n"
f"J6:{joint_pose.joint.j6}"
)
# [ZH] 转换笛卡尔坐标
# [EN] Convert to Cartesian coordinates
cart_pose, ret = arm.motion.convert_joint_to_cart(joint_pose)
if ret == StatusCodeEnum.OK:
print("转换笛卡尔坐标成功 / Convert to Cartesian coordinates successful")
else:
print(f"转换笛卡尔坐标失败,错误代码 / Convert to Cartesian coordinates failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果位姿
# [EN] Print result pose
print(f"位姿类型 / Pose type: {cart_pose.pt}")
print(
f"笛卡尔位置 / Cartesian position: \n"
f"X:{cart_pose.cartData.position.x}\n"
f"Y:{cart_pose.cartData.position.y}\n"
f"Z:{cart_pose.cartData.position.z}\n"
f"A:{cart_pose.cartData.position.a}\n"
f"B:{cart_pose.cartData.position.b}\n"
f"C:{cart_pose.cartData.position.c}"
)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.5 Move the Robot End Effector to a Specified Position
| Method Name | motion.move_joint( pose : MotionPose, vel : float = 1, acc : float = 1) -> StatusCodeEnum |
|---|---|
| Description | Move the robot end effector to a specified position using the fastest path |
| Request Parameters | pose : MotionPose Coordinates of a point in Cartesian or joint coordinate system vel : float Velocity of movement, ranging from 0 to 1, representing a multiple of the maximum velocity acc : float Ranging from 0 to 1.2, representing a multiple of the maximum acceleration |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 关节运动使用示例 / Example of joint movement usage
"""
from Agilebot import Arm, MotionPose, PoseType, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize the Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to the Agilebot 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] Initialize pose
motion_pose = MotionPose()
motion_pose.pt = PoseType.JOINT
motion_pose.joint.j1 = 0
motion_pose.joint.j2 = 0
motion_pose.joint.j3 = 60
motion_pose.joint.j4 = 60
motion_pose.joint.j5 = 0
motion_pose.joint.j6 = 0
# [ZH] 发送运动请求
# [EN] Send motion request
ret = arm.motion.move_joint(motion_pose, vel=0.5, acc=0.5)
if ret == StatusCodeEnum.OK:
print("关节运动成功 / Joint motion successful")
else:
print(f"关节运动失败,错误代码 / Joint motion failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from the Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.6 Move the Robot End Effector in a Straight Line to a Specified Position
| Method Name | motion.move_line( pose : MotionPose, vel : float = 100, acc : float = 1) -> StatusCodeEnum |
|---|---|
| Description | Move the robot end effector in a straight line to a specified position |
| Request Parameters | pose : MotionPose Coordinates of a point in Cartesian or joint coordinate system vel : float Velocity of movement, ranging from 1 to 4000 mm/s, representing the end effector's movement speed acc : float Ranging from 0 to 1.2, representing a multiple of the maximum acceleration |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 直线运动使用示例 / Example of linear motion usage
"""
from Agilebot import Arm, MotionPose, PoseType, StatusCodeEnum
# [ZH] 初始化Arm类
# [EN] Initialize the Arm class
arm = Arm()
# [ZH] 连接控制器
# [EN] Connect to the controller
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] Initialize pose
motion_pose = MotionPose()
motion_pose.pt = PoseType.JOINT
motion_pose.joint.j1 = 0
motion_pose.joint.j2 = 0
motion_pose.joint.j3 = 60
motion_pose.joint.j4 = 60
motion_pose.joint.j5 = 0
motion_pose.joint.j6 = 0
# [ZH] 发送运动请求
# [EN] Send motion request
ret = arm.motion.move_line(motion_pose, vel=100, acc=0.5)
if ret == StatusCodeEnum.OK:
print("直线运动成功 / Line motion successful")
else:
print(f"直线运动失败,错误代码 / Line motion failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 结束后断开机器人连接
# [EN] Disconnect from the robot after completion
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.7 Move the Robot End Effector in a Circular Path to a Specified Position
| Method Name | motion.move_circle( pose1 : MotionPose, pose2 : MotionPose, vel : float = 100, acc : float = 1.0) -> StatusCodeEnum |
|---|---|
| Description | Move the robot end effector in a circular path to a specified position |
| Request Parameters | pose1 : MotionPose Intermediate point pose of the robot movement pose2 : MotionPose End point pose of the robot movement vel : float Velocity of movement, ranging from 1 to 4000 mm/s, representing the end effector's movement speed acc : float Ranging from 0 to 1.2, representing a multiple of the maximum acceleration |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 圆弧运动使用示例 / Example of circular arc motion usage
"""
import time
from Agilebot import Arm, MotionPose, PoseType, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Initialize pose
motion_pose = MotionPose()
motion_pose.pt = PoseType.CART
motion_pose.cartData.position.x = 377.000
motion_pose.cartData.position.y = 202.820
motion_pose.cartData.position.z = 507.155
motion_pose.cartData.position.c = 0
motion_pose.cartData.position.b = 0
motion_pose.cartData.position.a = 0
# [ZH] 运动到初始点
# [EN] Move to initial position
ret = arm.motion.move_joint(motion_pose)
if ret == StatusCodeEnum.OK:
print("运动到初始点成功 / Move to initial position successful")
else:
print(f"运动到初始点失败,错误代码 / Move to initial position failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 修改为运动中间点
# [EN] Modify to intermediate motion point
motion_pose.cartData.position.x = 488.300
motion_pose.cartData.position.y = 359.120
motion_pose.cartData.position.z = 507.155
# [ZH] 运动终点
# [EN] End position
motion_pose2 = MotionPose()
motion_pose2.pt = PoseType.CART
motion_pose2.cartData.position.x = 629.600
motion_pose2.cartData.position.y = 509.270
motion_pose2.cartData.position.z = 507.155
motion_pose2.cartData.position.c = 0
motion_pose2.cartData.position.b = 0
motion_pose2.cartData.position.a = 0
# [ZH] 等待运动结束
# [EN] Wait for motion to complete
time.sleep(10)
# [ZH] 开始运动
# [EN] Start motion
ret_code = arm.motion.move_circle(motion_pose, motion_pose2, vel=100)
if ret_code == StatusCodeEnum.OK:
print("圆弧运动成功 / Circle motion successful")
else:
print(f"圆弧运动失败,错误代码 / Circle motion failed, error code: {ret_code.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.8 Get the Current Pose of the Robot
| Method Name | motion.get_current_pose( pose_type : PoseType, uf_index : int = 0, tf_index : int = 0) -> tuple[MotionPose, StatusCodeEnum] |
|---|---|
| Description | Get the current pose of the robot, which can be in Cartesian or joint coordinate system |
| Request Parameters | pose_type :PoseType Pose type uf_index : When using PoseType.CART, the user coordinate system ID must be provided, default is 0 tf_index : When using PoseType.CART, the tool coordinate system ID must be provided, default is 0 |
| Return Value | MotionPose: Robot pose StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 当前关节位姿获取示例 / Example of current joint pose acquisition
"""
from Agilebot import Arm, PoseType, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Get current pose
motion_pose, ret = arm.motion.get_current_pose(PoseType.JOINT)
if ret == StatusCodeEnum.OK:
print("获取关节位姿成功 / Get joint pose successful")
else:
print(f"获取关节位姿失败,错误代码 / Get joint pose failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果位姿
# [EN] Print result pose
print(f"位姿类型 / Pose type: {motion_pose.pt}")
print(
f"轴位置 / Axis position:\n"
f"J1:{motion_pose.joint.j1}\n"
f"J2:{motion_pose.joint.j2}\n"
f"J3:{motion_pose.joint.j3}\n"
f"J4:{motion_pose.joint.j4}\n"
f"J5:{motion_pose.joint.j5}\n"
f"J6:{motion_pose.joint.j6}"
)
# [ZH] 获取当前位姿
# [EN] Get current pose
motion_pose, ret = arm.motion.get_current_pose(PoseType.CART, 0, 0)
if ret == StatusCodeEnum.OK:
print("获取笛卡尔位姿成功 / Get Cartesian pose successful")
else:
print(f"获取笛卡尔位姿失败,错误代码 / Get Cartesian pose failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果位姿
# [EN] Print result pose
print(f"位姿类型 / Pose type: {motion_pose.pt}")
print(
f"坐标位置 / Coordinate position:\n"
f"X:{motion_pose.cartData.position.x}\n"
f"Y:{motion_pose.cartData.position.y}\n"
f"Z:{motion_pose.cartData.position.z}\n"
f"A:{motion_pose.cartData.position.a}\n"
f"B:{motion_pose.cartData.position.b}\n"
f"C:{motion_pose.cartData.position.c}"
)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.9 Get the Robot's DH Parameters
| Method Name | motion.get_DH_param() -> tuple[list[DHparam], StatusCodeEnum] |
|---|---|
| Description | Get the robot's DH parameters |
| Request Parameters | No parameters |
| Return Value | list(DHparam): List of DH parameters StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): Not supported |
4.2.10 Set the Robot's DH Parameters
| Method Name | motion.set_DH_param( dh_list : list[DHparam]) -> StatusCodeEnum |
|---|---|
| Description | Set the robot's DH parameters |
| Request Parameters | dh_list : list(DHparam) List of DH parameters |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): Not supported |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: DH参数设置使用示例 / Example of DH parameter setting usage
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] 获取DH参数
# [EN] Get DH parameters
res, ret = arm.motion.get_DH_param()
if ret == StatusCodeEnum.OK:
print("获取DH参数成功 / Get DH parameters successful")
else:
print(f"获取DH参数失败,错误代码 / Get DH parameters failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 设置DH参数
# [EN] Set DH parameters
ret = arm.motion.set_DH_param(res)
if ret == StatusCodeEnum.OK:
print("设置DH参数成功 / Set DH parameters successful")
else:
print(f"设置DH参数失败,错误代码 / Set DH parameters failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
for param in res:
print(
f"DH参数的ID / DH parameter ID: {param.id}\n"
f"杆件长度 / Link length: {param.a}\n"
f"杆件扭角 / Link twist angle: {param.alpha}\n"
f"关节距离 / Joint distance: {param.d}\n"
f"关节转角 / Joint angle: {param.offset}"
)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.11 Get the Robot Axis Lock Status
| Method Name | motion.get_drag_set() -> tuple[DragStatus, StatusCodeEnum] |
|---|---|
| Description | Get the current robot axis lock status, which only applies to teaching movements |
| Request Parameters | No parameters |
| Return Value | DragStatus: Axis lock status, True indicates the axis is movable, False indicates it is locked StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): Not supported |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 拖动设置使用示例 / Example of drag Settings usage
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Get current axis lock status
drag_status, ret = arm.motion.get_drag_set()
if ret == StatusCodeEnum.OK:
print("获取拖动设置成功 / Get drag set successful")
else:
print(f"获取拖动设置失败,错误代码 / Get drag set failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
print(
f"当前X轴拖动状态 / Current X axis drag status: {drag_status.cart_status.x}\n"
f"当前Y轴拖动状态 / Current Y axis drag status: {drag_status.cart_status.y}\n"
f"当前Z轴拖动状态 / Current Z axis drag status: {drag_status.cart_status.z}"
)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.12 Set the Robot Axis Lock Status
| Method Name | motion.set_drag_set( drag_status : DragStatus) -> StatusCodeEnum |
|---|---|
| Description | Set the current robot axis lock status, which only applies to teaching movements |
| Request Parameters | drag_status :DragStatus Lock status of each axis, default is all True: unlocked state |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): Not supported |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 拖动状态设置实例 / Example of dragging status setting
"""
from Agilebot import Arm, DragStatus, StatusCodeEnum, TCSType
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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 teaching coordinate system
arm.motion.set_TCS(TCSType.BASE)
if ret == StatusCodeEnum.OK:
print("操作成功 / Operation successful")
else:
print(f"操作失败,错误代码 / Operation failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 设置要锁定的轴
# [EN] Set axes to be locked
drag_status = DragStatus()
drag_status.cart_status.x = False
drag_status.cart_status.y = False
# [ZH] 设置连续拖动开关
# [EN] Set continuous drag switch
drag_status.is_continuous_drag = True
# [ZH] 设置轴锁定状态
# [EN] Set axis lock status
ret = arm.motion.set_drag_set(drag_status)
if ret == StatusCodeEnum.OK:
print("设置拖动状态成功 / Set drag status successful")
else:
print(f"设置拖动状态失败,错误代码 / Set drag status failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
print(
f"当前X轴拖动状态 / Current X axis drag status: {drag_status.cart_status.x}\n"
f"当前Y轴拖动状态 / Current Y axis drag status: {drag_status.cart_status.y}\n"
f"当前Z轴拖动状态 / Current Z axis drag status: {drag_status.cart_status.z}"
)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.13 Enable Dragging for the Robot
| Method Name | motion.enable_drag( drag_state : bool) -> StatusCodeEnum |
|---|---|
| Description | Enable or disable dragging for the robot |
| Request Parameters | drag_state :bool Whether the robot is allowed to drag, True indicates entering drag mode, False indicates exiting drag mode |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): Not supported |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 拖动示教使用示例 / example of drag teaching usage
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Enter drag teaching mode
ret = arm.motion.enable_drag(True)
if ret == StatusCodeEnum.OK:
print("进入拖动示教成功 / Enter drag teaching successful")
else:
print(f"进入拖动示教失败,错误代码 / Enter drag teaching failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 退出拖动示教
# [EN] Exit drag teaching mode
ret = arm.motion.enable_drag(False)
if ret == StatusCodeEnum.OK:
print("退出拖动示教成功 / Exit drag teaching successful")
else:
print(f"退出拖动示教失败,错误代码 / Exit drag teaching failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.14 Enter Real-Time Position Control Mode
| Method Name | motion.enter_position_control() -> StatusCodeEnum |
|---|---|
| Description | Enter real-time position control mode to allow precise position control of the robot |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
| Note | After entering real-time control mode, control commands must be sent via UDP |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
4.2.15 Exit Real-Time Position Control Mode
| Method Name | motion.exit_position_control() -> StatusCodeEnum |
|---|---|
| Description | Exit real-time position control mode and return to the default robot control state |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
| Note | After exiting, the robot will no longer accept real-time control commands |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
4.2.16 Set UDP Feedback Parameters
| Method Name | motion.set_udp_feedback_params( flag : bool, ip : str, interval : int, feedback_type : int, DO_list : list[int] = None) -> StatusCodeEnum |
|---|---|
| Description | Configure the UDP feedback parameters for pushing data to a specified IP address |
| Request Parameters | flag :bool Whether to enable UDP data pushing; ip :str IP address of the receiver; interval :int Interval for sending data (unit: milliseconds); feedback_type :int Feedback data format (0: XML, 1: JSON, 2: PROTO); DO_list :list[int] List of DO signals to be obtained (up to ten, optional) |
| Return Value | StatusCodeEnum: Function execution result |
| Note | Parameter settings are only effective when the UDP data pushing function is enabled |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 实时位置控制模式使用示例 / Example of the real-time location control mode usage
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] 设置udp反馈参数
# [EN] Set UDP feedback parameters
ret = arm.motion.set_udp_feedback_params(True, "10.27.1.254", 20, 1, [0, 1, 2])
if ret == StatusCodeEnum.OK:
print("设置UDP反馈参数成功 / Set UDP feedback parameters successful")
else:
print(f"设置UDP反馈参数失败,错误代码 / Set UDP feedback parameters failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 进入实时位置控制模式
# [EN] Enter real-time position control mode
ret = arm.motion.enter_position_control()
if ret == StatusCodeEnum.OK:
print("进入实时位置控制模式成功 / Enter real-time position control mode successful")
else:
print(
f"进入实时位置控制模式失败,错误代码 / Enter real-time position control mode failed, error code: {ret.errmsg}"
)
arm.disconnect()
exit(1)
# [ZH] 在此插入发送UDP数据控制机器人代码
# [EN] Insert UDP data sending code to control robot here
# [ZH] 退出实时位置控制模式
# [EN] Exit real-time position control mode
ret = arm.motion.exit_position_control()
if ret == StatusCodeEnum.OK:
print("退出实时位置控制模式成功 / Exit real-time position control mode successful")
else:
print(f"退出实时位置控制模式失败,错误代码 / Exit real-time position control mode failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")Data Pushing Description
| Name | Field | Description |
|---|---|---|
| RIst: Cartesian Position | X | X-direction value in the tool coordinate system, in millimeters |
| Y | Y-direction value in the tool coordinate system, in millimeters | |
| Z | Z-direction value in the tool coordinate system, in millimeters | |
| A | Rotation around the X-axis in the tool coordinate system, in degrees | |
| B | Rotation around the Y-axis in the tool coordinate system, in degrees | |
| C | Rotation around the Z-axis in the tool coordinate system, in degrees | |
| AIPos: Joint Position | A1-A6 | Values of the six joints, in degrees |
| EIPos: Additional Axis Data | EIPos | Additional axis data |
| WristBtnState: Wrist Button State | Button State | 1 = Button pressed, 0 = Button released |
| DragModel | Drag button state | |
| RecordJoint | Teaching record button state | |
| PauseResume | Pause/Resume button state | |
| Digout: DO Output | Digout | State of digital output (DO) |
| ProgramStatus: Program Status | ProgId | Program ID |
| Status | Interpreter execution status: 0 = INTERPRETER_IDLE 1 = INTERPRETER_EXECUTE 2 = INTERPRETER_PAUSED | |
| XPath | Program fragment return value, in the format program_name:line_number | |
| IPOC: Timestamp | IPOC | Timestamp |
4.2.17 Get the Robot's Soft Limits
| Method Name | motion.get_user_soft_limit() -> tuple[list[list[float]], StatusCodeEnum] |
|---|---|
| Description | Get the current soft limits of the robot |
| Request Parameters | None |
| Return Value | List(List(float)): Robot soft limits information, the first layer of the list represents each axis, and the second layer represents the lower and upper limits of each axis StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 用户软限位设置获取示例 / Example of obtaining the user's soft limit setting
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Get current robot soft limit information
res, ret = arm.motion.get_user_soft_limit()
if ret == StatusCodeEnum.OK:
print("获取用户软限位成功 / Get user soft limit successful")
else:
print(f"获取用户软限位失败,错误代码 / Get user soft limit failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
print(f"当前机器人软限位信息 / Current robot soft limit information: {res}")
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.18 Payload-Related Interfaces
4.2.18.1 Get the Current Activated Payload ID
| Method Name | motion.payload.get_current_payload() -> tuple[int, StatusCodeEnum] |
|---|---|
| Description | Get the current activated payload ID |
| Request Parameters | None |
| Return Value | int: Payload ID StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 获取当前负载示例 / Example of get the current load
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Get current active payload
current_payload_id, ret = arm.motion.payload.get_current_payload()
if ret == StatusCodeEnum.OK:
print("获取当前负载成功 / Get current payload successful")
else:
print(f"获取当前负载失败,错误代码 / Get current payload failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
print(f"当前激活负载ID为 / Current active payload ID: {current_payload_id}")
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.18.2 Get Payload Information by Specified ID
| Method Name | motion.payload.get_payload_by_id( payload_id : int) -> tuple[PayloadInfo, StatusCodeEnum] |
|---|---|
| Description | Get the payload information by the specified ID |
| Request Parameters | payload_id : int The specified payload ID |
| Return Value | PayloadInfo: Payload information StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 根据ID获取负载参数示例 / Example of obtaining load parameters based on ID
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Get payload
res, ret = arm.motion.payload.get_payload_by_id(6)
if ret == StatusCodeEnum.OK:
print("获取负载成功 / Get payload successful")
else:
print(f"获取负载失败,错误代码 / Get payload failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
print(
f"负载ID / Payload ID: {res.id}\n"
f"负载质量 / Payload mass: {res.weight}\n"
f"负载注释 / Payload comment: {res.comment}\n"
f"负载质心 / Payload mass center: {res.mass_center.x}, {res.mass_center.y}, {res.mass_center.z}\n"
f"负载转动惯量 / Payload inertia moment: {res.inertia_moment.lx}, {res.inertia_moment.ly}, {res.inertia_moment.lz}\n"
)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.18.3 Activate Payload by Specified ID
| Method Name | motion.payload.set_current_payload( payload_id : int) -> StatusCodeEnum |
|---|---|
| Description | Activate the payload by the specified ID |
| Request Parameters | payload_id : int The specified payload ID |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 当前负载设置示例 / Example of the current load settings
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Activate payload by specified ID
ret = arm.motion.payload.set_current_payload(1)
if ret == StatusCodeEnum.OK:
print("设置当前负载成功 / Set current payload successful")
else:
print(f"设置当前负载失败,错误代码 / Set current payload failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.18.4 Add a User-Defined Payload to the Robot Controller
| Method Name | motion.payload.add_payload( payload_info : PayloadInfo) -> StatusCodeEnum |
|---|---|
| Description | Add a user-defined payload to the robot controller |
| Request Parameters | payload_info : PayloadInfo User-defined payload information |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 添加负载使用示例 / Example of Add load usage
"""
from Agilebot import Arm, PayloadInfo, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Initialize payload
new_payload = PayloadInfo()
new_payload.id = 6
new_payload.comment = "Test"
new_payload.weight = 5
new_payload.mass_center.x = -151
new_payload.mass_center.y = 1.0
new_payload.mass_center.z = 75
new_payload.inertia_moment.lx = 0.11
new_payload.inertia_moment.ly = 0.61
new_payload.inertia_moment.lz = 0.54
# [ZH] 添加负载
# [EN] Add payload
ret = arm.motion.payload.add_payload(new_payload)
if ret == StatusCodeEnum.OK:
print("添加负载成功 / Add payload successful")
else:
print(f"添加负载失败,错误代码 / Add payload failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.18.5 Delete the Payload Information by Specified ID
| Method Name | motion.payload.delete_payload( payload_id : int) -> StatusCodeEnum |
|---|---|
| Description | Delete a user-defined payload from the controller |
| Request Parameters | payload_id : int The specified payload ID |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
| Note | Note: The currently activated payload cannot be deleted. If you want to delete the activated payload, please activate another payload first and then delete the current one. |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 删除负载使用示例 / Example of delete the load usage
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] 删除指定ID负载
# [EN] Delete payload with specified ID
ret = arm.motion.payload.delete_payload(6)
if ret == StatusCodeEnum.OK:
print("删除负载成功 / Delete payload successful")
else:
print(f"删除负载失败,错误代码 / Delete payload failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
print("删除负载6成功 / Delete payload 6 successful")
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.18.6 Update an Existing Payload Information
| Method Name | motion.payload.update_payload( payload_info : PayloadInfo) -> StatusCodeEnum |
|---|---|
| Description | Update the information of an existing user-defined payload |
| Request Parameters | payload_info : PayloadInfo User-defined updated payload information |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 更新负载使用示例 / Example of updating the load
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Get payload
payload_info, ret_code = arm.motion.payload.get_payload_by_id(6)
payload_info.comment = "Test"
payload_info.weight = 10
payload_info.mass_center.x = -100
payload_info.mass_center.y = 10
payload_info.mass_center.z = 10
payload_info.inertia_moment.lx = 10
payload_info.inertia_moment.ly = 10
payload_info.inertia_moment.lz = 10
# [ZH] 更新负载
# [EN] Update payload
ret = arm.motion.payload.update_payload(payload_info)
if ret == StatusCodeEnum.OK:
print("更新负载成功 / Update payload successful")
else:
print(f"更新负载失败,错误代码 / Update payload failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
print(
f"负载ID / Payload ID: {payload_info.id}\n"
f"负载质量 / Payload mass: {payload_info.weight}\n"
f"负载质心 / Payload mass center: {payload_info.mass_center.x}, {payload_info.mass_center.y}, {payload_info.mass_center.z}\n"
f"负载转动惯量 / Payload inertia moment: {payload_info.inertia_moment.lx}, {payload_info.inertia_moment.ly}, {payload_info.inertia_moment.lz}\n"
f"负载注释 / Payload comment: {payload_info.comment}\n"
)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.18.7 Get All Payload Information
| Method Name | motion.payload.get_all_payload() -> tuple[list, StatusCodeEnum] |
|---|---|
| Description | Get all payload information |
| Request Parameters | None |
| Return Value | list : List of all payload information StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 所有负载获取示例 / Example of all load acquisition
"""
from Agilebot import Arm, StatusCodeEnum
# [ZH] 初始化Arm类
# [EN] Initialize Arm class
arm = Arm()
# [ZH] 连接控制器
# [EN] Connect to controller
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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] Get all payloads
res, ret = arm.motion.payload.get_all_payload()
if ret == StatusCodeEnum.OK:
print("获取所有负载成功 / Get all payloads successful")
else:
print(f"获取所有负载失败,错误代码 / Get all payloads failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 打印结果
# [EN] Print result
for payload in res:
print(f"负载ID / Payload ID: {payload[0]}\n负载注释 / Payload comment: {payload[1]}\n")
# [ZH] 结束后断开机器人连接
# [EN] Disconnect from robot after completion
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")4.2.18.8 Check if Axis 3 is Horizontal
| Method Name | motion.payload.check_axis_three_horizontal() -> tuple[float, StatusCodeEnum] |
|---|---|
| Description | Check if Axis 3 is horizontal |
| Request Parameters | None |
| Return Value | float: The horizontal angle of Axis 3, in degrees StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
| Note | The horizontal angle must be between -1 and 1 to proceed with payload identification |
4.2.18.9 Get Payload Identification State
| Method Name | motion.payload.get_payload_identify_state() -> tuple[PayloadIdentifyState, StatusCodeEnum] |
|---|---|
| Description | Get the state of payload identification |
| Request Parameters | None |
| Return Value | PayloadIdentifyState The state of payload identification StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
4.2.18.10 Start Payload Identification
| Method Name | motion.payload.start_payload_identify( weight : float, angle : float) -> StatusCodeEnum |
|---|---|
| Description | Start payload identification |
| Request Parameters | weight : float Payload weight (use -1 for unknown weight); angle : float Allowed rotation angle of Axis 6 (30-90 degrees) |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
| Note | The robot must enter the payload identification state before starting payload identification |
4.2.18.11 Get Payload Identification Result
| Method Name | motion.payload.payload_identify_result() -> tuple[PayloadInfo, StatusCodeEnum] |
|---|---|
| Description | Get the result of payload identification |
| Request Parameters | None |
| Return Value | PayloadInfo: The result of payload identification StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
4.2.18.12 Start Interference Check for Payload Identification
| Method Name | motion.payload.interference_check_for_payload_identify( weight : float, angle : float) -> StatusCodeEnum |
|---|---|
| Description | Start interference check for payload identification |
| Request Parameters | weight : float Payload weight; angle : float Rotation angle of Axis 6 (30-90 degrees) |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
4.2.18.13 Enter Payload Identification State
| Method Name | motion.payload.payload_identify_start() -> StatusCodeEnum |
|---|---|
| Description | Enter payload identification state |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
4.2.18.14 Exit Payload Identification State
| Method Name | motion.payload.payload_identify_done() -> StatusCodeEnum |
|---|---|
| Description | Exit payload identification state |
| Request Parameters | None |
| Return Value | StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
4.2.18.15 Complete Payload Identification Process
| Method Name | motion.payload.payload_identify( weight : float, angle : float) -> tuple[PayloadInfo, StatusCodeEnum] |
|---|---|
| Description | Complete payload identification process, including all the interfaces mentioned above. For general payload identification without special requirements, this interface is sufficient. |
| Request Parameters | weight : float Payload weight (use -1 for unknown weight); angle : float Rotation angle of Axis 6 (30-90 degrees) |
| Return Value | PayloadInfo: Payload identification result StatusCodeEnum: Function execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.2.0+ Industrial (Bronze): Not supported |
| Note | The returned payload can be added to the robot or written to an existing payload in the robot. The complete process steps are: 1. Move to the specified horizontal position and check if it is horizontal 2. Enter payload identification state 3. Start payload identification 4. Get the payload identification result 5. Exit payload identification state |
Example Code
py
#!python
"""
Copyright © 2016 Agilebot Robotics Ltd. All rights reserved.
Instruction: 负载识别使用示例 / Example of load identification usage
"""
import time
from Agilebot import Arm, MotionPose, PoseType, ServoStatusEnum, StatusCodeEnum
# [ZH] 初始化捷勃特机器人
# [EN] Initialize Agilebot robot
arm = Arm()
# [ZH] 连接捷勃特机器人
# [EN] Connect to Agilebot robot
ret = arm.connect("10.27.1.254")
# [ZH] 检查是否连接成功
# [EN] Check if 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)
motion_pose = MotionPose()
motion_pose.pt = PoseType.JOINT
motion_pose.joint.j1 = 0
motion_pose.joint.j2 = 0
motion_pose.joint.j3 = 0
motion_pose.joint.j4 = 0
motion_pose.joint.j5 = 0
motion_pose.joint.j6 = 0
# [ZH] 运动到指定点
# [EN] Move to specified position
code = arm.motion.move_joint(motion_pose)
if ret == StatusCodeEnum.OK:
print("运动到指定点成功 / Move to specified position successful")
else:
print(f"运动到指定点失败,错误代码 / Move to specified position failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
while True:
# [ZH] 获取伺服状态
# [EN] Get servo status
state, 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)
if state == ServoStatusEnum.SERVO_IDLE:
break
else:
time.sleep(1)
# [ZH] 开始负载测定并获取结果
# [EN] Start payload identification and get result
res, ret = arm.motion.payload.payload_identify(-1, 90)
if ret == StatusCodeEnum.OK:
print("负载识别成功 / Payload identification successful")
else:
print(f"负载识别失败,错误代码 / Payload identification failed, error code: {ret.errmsg}")
arm.disconnect()
exit(1)
# [ZH] 断开捷勃特机器人连接
# [EN] Disconnect from Agilebot robot
arm.disconnect()
print("机器人断开连接成功 / Robot disconnected successfully")