Skip to content

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 Namemotion.get_OVC() -> tuple[float, StatusCodeEnum]
DescriptionGet the current OVC Overall Velocity Coefficient of the robot, which ranges from 0 to 1
Request ParametersNo parameters
Return Valuefloat: Velocity ratio, ranging from 0 to 1
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.1.2 Get OAC Overall Acceleration Coefficient

Method Namemotion.get_OAC() -> tuple[float, StatusCodeEnum]
DescriptionGet the current OAC Overall Acceleration Coefficient of the robot, which ranges from 0 to 1.2
Request ParametersNo parameters
Return Valuefloat: Acceleration ratio, ranging from 0 to 1.2
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.1.3 Get Current TF Tool Coordinate System Number

Method Namemotion.get_TF() -> tuple[int, StatusCodeEnum]
DescriptionGet the current TF tool coordinate system number used by the robot, valid range 0~50
Request ParametersNo parameters
Return Valueint: Tool coordinate system number
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.1.4 Get Current UF User Coordinate System Number

Method Namemotion.get_UF() -> tuple[int, StatusCodeEnum]
DescriptionGet the current UF user coordinate system number used by the robot, valid range 0~50
Request ParametersNo parameters
Return Valueint: User coordinate system number
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.1.5 Get Current TCS Teaching Coordinate System

Method Namemotion.get_TCS() -> tuple[TCSType, StatusCodeEnum]
DescriptionGet the current TCS teaching coordinate system used by the robot, refer to TCSType for details
Request ParametersNo parameters
Return ValueTCSType: Teaching coordinate system number
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/set_param.py
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 Namemotion.set_OVC( value : float) -> StatusCodeEnum
DescriptionSet the OVC Overall Velocity Coefficient of the robot
Request Parametersvalue : float, velocity ratio in the range (0, 1], i.e., greater than 0 and no more than 1
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.2.2 Set OAC Overall Acceleration Coefficient

Method Namemotion.set_OAC( value : float) -> StatusCodeEnum
DescriptionSet the OAC Overall Acceleration Coefficient of the robot
Request Parametersvalue : float, acceleration ratio in the range (0.01, 1.2]
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.2.3 Set Current TF Tool Coordinate System

Method Namemotion.set_TF( value : int) -> StatusCodeEnum
DescriptionSet the current TF tool coordinate system used by the robot
Request Parametersvalue : int, tool coordinate system number, valid range 0~50
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.2.4 Set Current UF User Coordinate System

Method Namemotion.set_UF( value : int) -> StatusCodeEnum
DescriptionSet the current UF user coordinate system used by the robot
Request Parametersvalue : int, user coordinate system number, valid range 0~50
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.2.5 Set Current TCS Teaching Coordinate System

Method Namemotion.set_TCS( value : TCSType) -> StatusCodeEnum
DescriptionSet the current TCS teaching coordinate system used by the robot, refer to TCSType for details
Request Parametersvalue : TCSType, TCS teaching coordinate system
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/get_param.py
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 Namemotion.convert_cart_to_joint( pose : MotionPose, uf_index : int = 0, tf_index : int = 0) -> tuple[MotionPose, StatusCodeEnum]
DescriptionConvert pose data from Cartesian coordinates to joint coordinates
Request Parameterspose : 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 ValueMotionPose: Robot pose
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

4.2.4 Convert Joint Pose to Cartesian Pose

Method Namemotion.convert_joint_to_cart( pose : MotionPose, uf_index : int = 0, tf_index : int = 0) -> tuple[MotionPose, StatusCodeEnum]
DescriptionConvert joint coordinates to Cartesian coordinates
Request Parameterspose : MotionPose Robot's pose in joint coordinates
uf_index : int User coordinate system ID
tf_index : int Tool coordinate system ID
Return ValueMotionPose: Robot pose
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/convert_pose.py
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 Namemotion.move_joint( pose : MotionPose, vel : float = 1, acc : float = 1) -> StatusCodeEnum
DescriptionMove the robot end effector to a specified position using the fastest path
Request Parameterspose : 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 ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/move_joint.py
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 Namemotion.move_line( pose : MotionPose, vel : float = 100, acc : float = 1) -> StatusCodeEnum
DescriptionMove the robot end effector in a straight line to a specified position
Request Parameterspose : 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 ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/move_line.py
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 Namemotion.move_circle( pose1 : MotionPose, pose2 : MotionPose, vel : float = 100, acc : float = 1.0) -> StatusCodeEnum
DescriptionMove the robot end effector in a circular path to a specified position
Request Parameterspose1 : 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 ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/move_circle.py
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 Namemotion.get_current_pose( pose_type : PoseType, uf_index : int = 0, tf_index : int = 0) -> tuple[MotionPose, StatusCodeEnum]
DescriptionGet the current pose of the robot, which can be in Cartesian or joint coordinate system
Request Parameterspose_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 ValueMotionPose: Robot pose
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/get_current_pose.py
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 Namemotion.get_DH_param() -> tuple[list[DHparam], StatusCodeEnum]
DescriptionGet the robot's DH parameters
Request ParametersNo parameters
Return Valuelist(DHparam): List of DH parameters
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

4.2.10 Set the Robot's DH Parameters

Method Namemotion.set_DH_param( dh_list : list[DHparam]) -> StatusCodeEnum
DescriptionSet the robot's DH parameters
Request Parametersdh_list : list(DHparam) List of DH parameters
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

Example Code

motion/DH_param.py
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 Namemotion.get_drag_set() -> tuple[DragStatus, StatusCodeEnum]
DescriptionGet the current robot axis lock status, which only applies to teaching movements
Request ParametersNo parameters
Return ValueDragStatus: Axis lock status, True indicates the axis is movable, False indicates it is locked
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

Example Code

motion/get_drag_set.py
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 Namemotion.set_drag_set( drag_status : DragStatus) -> StatusCodeEnum
DescriptionSet the current robot axis lock status, which only applies to teaching movements
Request Parametersdrag_statusDragStatus Lock status of each axis, default is all True: unlocked state
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

Example Code

motion/set_drag_set.py
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 Namemotion.enable_drag( drag_state : bool) -> StatusCodeEnum
DescriptionEnable or disable dragging for the robot
Request Parametersdrag_state :bool Whether the robot is allowed to drag, True indicates entering drag mode, False indicates exiting drag mode
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

Example Code

motion/enable_drag.py
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 Namemotion.enter_position_control() -> StatusCodeEnum
DescriptionEnter real-time position control mode to allow precise position control of the robot
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result
NoteAfter entering real-time control mode, control commands must be sent via UDP
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

4.2.15 Exit Real-Time Position Control Mode

Method Namemotion.exit_position_control() -> StatusCodeEnum
DescriptionExit real-time position control mode and return to the default robot control state
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result
NoteAfter exiting, the robot will no longer accept real-time control commands
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

4.2.16 Set UDP Feedback Parameters

Method Namemotion.set_udp_feedback_params( flag : bool, ip : str, interval : int, feedback_type : int, DO_list : list[int] = None) -> StatusCodeEnum
DescriptionConfigure the UDP feedback parameters for pushing data to a specified IP address
Request Parametersflag :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 ValueStatusCodeEnum: Function execution result
NoteParameter settings are only effective when the UDP data pushing function is enabled
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

Example Code

motion/UDP_feedback_position_control.py
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

NameFieldDescription
RIst: Cartesian PositionXX-direction value in the tool coordinate system, in millimeters
YY-direction value in the tool coordinate system, in millimeters
ZZ-direction value in the tool coordinate system, in millimeters
ARotation around the X-axis in the tool coordinate system, in degrees
BRotation around the Y-axis in the tool coordinate system, in degrees
CRotation around the Z-axis in the tool coordinate system, in degrees
AIPos: Joint PositionA1-A6Values of the six joints, in degrees
EIPos: Additional Axis DataEIPosAdditional axis data
WristBtnState: Wrist Button StateButton State1 = Button pressed, 0 = Button released
DragModelDrag button state
RecordJointTeaching record button state
PauseResumePause/Resume button state
Digout: DO OutputDigoutState of digital output (DO)
ProgramStatus: Program StatusProgIdProgram ID
StatusInterpreter execution status:
0 = INTERPRETER_IDLE
1 = INTERPRETER_EXECUTE
2 = INTERPRETER_PAUSED
XPathProgram fragment return value, in the format program_name:line_number
IPOC: TimestampIPOCTimestamp

4.2.17 Get the Robot's Soft Limits

Method Namemotion.get_user_soft_limit() -> tuple[list[list[float]], StatusCodeEnum]
DescriptionGet the current soft limits of the robot
Request ParametersNone
Return ValueList(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 versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/get_user_soft_limit.py
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 Namemotion.payload.get_current_payload() -> tuple[int, StatusCodeEnum]
DescriptionGet the current activated payload ID
Request ParametersNone
Return Valueint: Payload ID
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/get_current_payload.py
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 Namemotion.payload.get_payload_by_id( payload_id : int) -> tuple[PayloadInfo, StatusCodeEnum]
DescriptionGet the payload information by the specified ID
Request Parameterspayload_id : int The specified payload ID
Return ValuePayloadInfo: Payload information
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/get_payload_by_id.py
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 Namemotion.payload.set_current_payload( payload_id : int) -> StatusCodeEnum
DescriptionActivate the payload by the specified ID
Request Parameterspayload_id : int The specified payload ID
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/set_current_payload.py
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 Namemotion.payload.add_payload( payload_info : PayloadInfo) -> StatusCodeEnum
DescriptionAdd a user-defined payload to the robot controller
Request Parameterspayload_info : PayloadInfo User-defined payload information
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/add_payload.py
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 Namemotion.payload.delete_payload( payload_id : int) -> StatusCodeEnum
DescriptionDelete a user-defined payload from the controller
Request Parameterspayload_id : int The specified payload ID
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+
NoteNote: 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

motion/delete_payload.py
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 Namemotion.payload.update_payload( payload_info : PayloadInfo) -> StatusCodeEnum
DescriptionUpdate the information of an existing user-defined payload
Request Parameterspayload_info : PayloadInfo User-defined updated payload information
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/update_payload.py
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 Namemotion.payload.get_all_payload() -> tuple[list, StatusCodeEnum]
DescriptionGet all payload information
Request ParametersNone
Return Valuelist : List of all payload information
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

Example Code

motion/get_all_payload.py
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 Namemotion.payload.check_axis_three_horizontal() -> tuple[float, StatusCodeEnum]
DescriptionCheck if Axis 3 is horizontal
Request ParametersNone
Return Valuefloat: The horizontal angle of Axis 3, in degrees
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported
NoteThe horizontal angle must be between -1 and 1 to proceed with payload identification

4.2.18.9 Get Payload Identification State

Method Namemotion.payload.get_payload_identify_state() -> tuple[PayloadIdentifyState, StatusCodeEnum]
DescriptionGet the state of payload identification
Request ParametersNone
Return ValuePayloadIdentifyState The state of payload identification
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

4.2.18.10 Start Payload Identification

Method Namemotion.payload.start_payload_identify( weight : float, angle : float) -> StatusCodeEnum
DescriptionStart payload identification
Request Parametersweight : float Payload weight (use -1 for unknown weight);
angle : float Allowed rotation angle of Axis 6 (30-90 degrees)
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported
NoteThe robot must enter the payload identification state before starting payload identification

4.2.18.11 Get Payload Identification Result

Method Namemotion.payload.payload_identify_result() -> tuple[PayloadInfo, StatusCodeEnum]
DescriptionGet the result of payload identification
Request ParametersNone
Return ValuePayloadInfo: The result of payload identification
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

4.2.18.12 Start Interference Check for Payload Identification

Method Namemotion.payload.interference_check_for_payload_identify( weight : float, angle : float) -> StatusCodeEnum
DescriptionStart interference check for payload identification
Request Parametersweight : float Payload weight;
angle : float Rotation angle of Axis 6 (30-90 degrees)
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

4.2.18.13 Enter Payload Identification State

Method Namemotion.payload.payload_identify_start() -> StatusCodeEnum
DescriptionEnter payload identification state
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

4.2.18.14 Exit Payload Identification State

Method Namemotion.payload.payload_identify_done() -> StatusCodeEnum
DescriptionExit payload identification state
Request ParametersNone
Return ValueStatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

4.2.18.15 Complete Payload Identification Process

Method Namemotion.payload.payload_identify( weight : float, angle : float) -> tuple[PayloadInfo, StatusCodeEnum]
DescriptionComplete payload identification process, including all the interfaces mentioned above. For general payload identification without special requirements, this interface is sufficient.
Request Parametersweight : float Payload weight (use -1 for unknown weight);
angle : float Rotation angle of Axis 6 (30-90 degrees)
Return ValuePayloadInfo: Payload identification result
StatusCodeEnum: Function execution result
Compatible robot software versionCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported
NoteThe 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

motion/payload_identify.py
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")