Links

xarm_api

xArm-Python-SDK API Documentation (V1.13.8): class XArmAPI in module xarm.wrapper.xarm_api

class XArmAPI


Attributes


angles
Servo angles Note: 1. If self.default_is_radian is True, the returned value is in radians
:return: [angle1(° or rad), angle2(° or rad), ..., anglen7(° or rad)]
arm
XArm interface implementation class instance, do not use (compatibility is not guaranteed)
axis
Axis number, only available in socket way and enable_report is True and report_type is 'rich'
cgpio_states
Controller gpio state
:return: states states[0]: contorller gpio module state states[0] == 0: normal states[0] == 1:wrong states[0] == 6:communication failure states[1]: controller gpio module error code states[1] == 0: normal states[1] != 0:error code states[2]: digital input functional gpio state Note: digital-i-input functional gpio state = states[2] >> i & 0x01 states[3]: digital input configuring gpio state Note: digital-i-input configuring gpio state = states[3] >> i & 0x01 states[4]: digital output functional gpio state Note: digital-i-output functional gpio state = states[4] >> i & 0x01 states[5]: digital output configuring gpio state Note: digital-i-output configuring gpio state = states[5] >> i & 0x01 states[6]: analog-0 input value states[7]: analog-1 input value states[8]: analog-0 output value states[9]: analog-1 output value states[10]: digital input functional info, [digital-0-input-functional-mode, ... digital-7-input-functional-mode] states[11]: digital output functional info, [digital-0-output-functional-mode, ... digital-7-output-functional-mode]
cmd_num
Number of command caches in the controller
collision_sensitivity
The sensitivity value of collision, only available in socket way and enable_report is True and report_type is 'rich'
:return: 0~5
connected
Connection status
control_box_sn
Control box sn
core
Core layer API, set only for advanced developers, please do not use Ex: self.core.move_line(...) self.core.move_lineb(...) self.core.move_joint(...) ...
count
Counter val
currents
Servos electric current
:return: [servo-1-current, ..., servo-7-current]
default_is_radian
The default unit is radians or not
device_type
Device type, only available in socket way and enable_report is True and report_type is 'rich'
error_code
Controller error code. See the Controller Error Code Documentation for details.
ft_ext_force
The external force detection value of the Six-axis Force Torque Sensor after filtering, load and offset compensation
ft_raw_force
The direct reading of the Six-axis Force Torque Sensor at the end, without any processing
gpio_reset_config
The gpio reset enable config :return: [cgpio_reset_enable, tgpio_reset_enable]
gravity_direction
gravity direction, only available in socket way and enable_report is True and report_type is 'rich' :return:
has_err_warn
Contorller have an error or warning or not
:return: True/False
has_error
Controller have an error or not
has_warn
Controller have an warnning or not
is_simulation_robot
Is simulation robot not not
joint_acc_limit
Joint acceleration limit, only available in socket way and enable_report is True and report_type is 'rich' Note: 1. If self.default_is_radian is True, the returned value is in radians
:return: [min_joint_acc(°/s^2 or rad/s^2), max_joint_acc(°/s^2 or rad/s^2)]
joint_jerk
Joint jerk Note: 1. If self.default_is_radian is True, the returned value is in radians
:return: jerk (°/s^3 or rad/s^3)
joint_speed_limit
Joint speed limit, only available in socket way and enable_report is True and report_type is 'rich' Note: 1. If self.default_is_radian is True, the returned value is in radians
:return: [min_joint_speed(°/s or rad/s), max_joint_speed(°/s or rad/s)]
joints_torque
Joints torque, only available in socket way and enable_report is True and report_type is 'rich'
:return: [joint-1, ....]
last_used_angles
The last used servo angles, default value of parameter angle of interface set_servo_angle Note: 1. If self.default_is_radian is True, the returned value is in radians 2. self.set_servo_angle(servo_id=1, angle=75) < == > self.set_servo_angle(angle=[75] + self.last_used_angles[1:]) 3. self.set_servo_angle(servo_id=5, angle=30) < == > self.set_servo_angle(angle=self.last_used_angles[:4] + [30] + self.last_used_angles[5:])
:return: [angle1(° or rad), angle2(° or rad), ..., angle7(° or rad)]
last_used_joint_acc
The last used joint acceleration, default value of parameter mvacc of interface set_servo_angle Note: 1. If self.default_is_radian is True, the returned value is in radians
:return: acceleration (°/s^2 or rad/s^2)
last_used_joint_speed
The last used joint speed, default value of parameter speed of interface set_servo_angle Note: 1. If self.default_is_radian is True, the returned value is in radians
:return: speed (°/s or rad/s)
last_used_position
The last used cartesion position, default value of parameter x/y/z/roll/pitch/yaw of interface set_position Note: 1. If self.default_is_radian is True, the returned value (only roll/pitch/yaw) is in radians 2. self.set_position(x=300) < == > self.set_position(x=300, *last_used_position[1:]) 2. self.set_position(roll=-180) < == > self.set_position(x=self.last_used_position[:3], roll=-180, *self.last_used_position[4:])
:return: [x(mm), y(mm), z(mm), roll(° or rad), pitch(° or rad), yaw(° or rad)]
last_used_tcp_acc
The last used cartesion acceleration, default value of parameter mvacc of interface set_position/move_circle
:return: acceleration (mm/s^2)
last_used_tcp_speed
The last used cartesion speed, default value of parameter speed of interface set_position/move_circle
:return: speed (mm/s)
master_id
Master id, only available in socket way and enable_report is True and report_type is 'rich'
mode
xArm mode,only available in socket way and enable_report is True
:return: 0: position control mode 1: servo motion mode 2: joint teaching mode 3: cartesian teaching mode (invalid) 4: joint velocity control mode 5: cartesian velocity control mode 6: joint online trajectory planning mode 7: cartesian online trajectory planning mode
motor_brake_states
Motor brake state list, only available in socket way and enable_report is True and report_type is 'rich' Note: For a robot with a number of axes n, only the first n states are valid, and the latter are reserved.
:return: [motor-1-brake-state, ..., motor-7-brake-state, reserved] motor-{i}-brake-state: 0: enable 1: disable
motor_enable_states
Motor enable state list, only available in socket way and enable_report is True and report_type is 'rich' Note: For a robot with a number of axes n, only the first n states are valid, and the latter are reserved.
:return: [motor-1-enable-state, ..., motor-7-enable-state, reserved] motor-{i}-enable-state: 0: disable 1: enable
only_check_result
position
Cartesion position Note: 1. If self.default_is_radian is True, the returned value (only roll/pitch/yaw) is in radians
return: [x(mm), y(mm), z(mm), roll(° or rad), pitch(° or rad), yaw(° or rad)]
position_aa
The pose represented by the axis angle pose Note: 1. If self.default_is_radian is True, the returned value (only roll/pitch/yaw) is in radians
:return: [x(mm), y(mm), z(mm), rx(° or rad), ry(° or rad), rz(° or rad)]
realtime_joint_speeds
The real time speed of joint motion, only available if version > 1.2.11
:return: [joint-1-speed(°/s or rad/s), ...., joint-7-speed(°/s or rad/s)]
realtime_tcp_speed
The real time speed of tcp motion, only available if version > 1.2.11
:return: real time speed (mm/s)
robotiq_status
The last state value obtained
Note: 1. Successfully call the robotiq related interface with wait parameter (when the parameter wait = True is set) will update this value 2. Successfully calling interface robotiq_get_status will partially or completely update this value
:return status dict { 'gOBJ': 0, # Object detection status, is a built-in feature that provides information on possible object pick-up 'gSTA': 0, # Gripper status, returns the current status & motion of the Gripper fingers 'gGTO': 0, # Action status, echo of the rGTO bit(go to bit) 'gACT': 0, # Activation status, echo of the rACT bit(activation bit) 'kFLT': 0, # Echo of the requested position for the Gripper 'gFLT': 0, # Fault status 'gPR': 0, # Echo of the requested position for the Gripper 'gPO': 0, # Actual position of the Gripper obtained via the encoders 'gCU': 0, # The current is read instantaneously from the motor drive } Note: -1 means never updated
self_collision_params
Self collision params
:return: params params[0]: self collision detection or not params[1]: self collision tool type params[2]: self collision model params
servo_codes
Servos status and error_code :return: [ [servo-1-status, servo-1-code], ..., [servo-7-status, servo-7-code], [tool-gpio-status, tool-gpio-code] ]
slave_id
Slave id, only available in socket way and enable_report is True and report_type is 'rich'
sn
xArm sn
state
xArm state
:return: 1: in motion 2: sleeping 3: suspended 4: stopping
tcp_acc_limit
Tcp acceleration limit, only available in socket way and enable_report is True and report_type is 'rich'
:return: [min_tcp_acc(mm/s^2), max_tcp_acc(mm/s^2)]
tcp_jerk
Tcp jerk
:return: jerk (mm/s^3)
tcp_load
xArm tcp load, only available in socket way and enable_report is True and report_type is 'rich'
:return: [weight, center of gravity] such as: [weight(kg), [x(mm), y(mm), z(mm)]]
tcp_offset
Cartesion position offset, only available in socket way and enable_report is True Note: 1. If self.default_is_radian is True, the returned value(roll_offset/pitch_offset/yaw_offset) is in radians
:return: [x_offset(mm), y_offset(mm), z_offset(mm), roll_offset(° or rad), pitch_offset(° or rad), yaw_offset(° or rad)]
tcp_speed_limit
Tcp speed limit, only available in socket way and enable_report is True and report_type is 'rich'
:return: [min_tcp_speed(mm/s), max_tcp_speed(mm/s)]
teach_sensitivity
The sensitivity value of drag and teach, only available in socket way and enable_report is True and report_type is 'rich'
:return: 1~5
temperatures
Motor temperature, only available if version > 1.2.11
:return: [motor-1-temperature, ..., motor-7-temperature]
version
xArm version
version_number
Frimware version number
:return: (major_version_number, minor_version_number, revision_version_number)
voltages
Servos voltage
:return: [servo-1-voltage, ..., servo-7-voltage]
warn_code
Controller warn code. See the Controller Warn Code Documentation for details.
world_offset
Base coordinate offset, only available if version > 1.2.11
Note: 1. If self.default_is_radian is True, the returned value(roll_offset/pitch_offset/yaw_offset) is in radians
:return: [x_offset(mm), y_offset(mm), z_offset(mm), roll_offset(° or rad), pitch_offset(° or rad), yaw_offset(° or rad)]

Methods


def _init_(self, port=None, is_radian=False, do_not_open=False, **kwargs):
The API wrapper of xArm Note: Orientation of attitude angle roll: rotate around the X axis pitch: rotate around the Y axis yaw: rotate around the Z axis
:param port: ip-address(such as '192.168.1.185') Note: this parameter is required if parameter do_not_open is False :param is_radian: set the default unit is radians or not, default is False Note: (aim of design) 1. Default value for unified interface parameters 2: Unification of the external unit system 3. For compatibility with previous interfaces Note: the conversion of degree (°) and radians (rad) * 1 rad == 57.29577951308232 ° * 1 ° == 0.017453292519943295 rad * 1 rad/s == 57.29577951308232 °/s * 1 °/s == 0.017453292519943295 rad/s * 1 rad/s^2 == 57.29577951308232 °/s^2 * 1 °/s^2 == 0.017453292519943295 rad/s^2 * 1 rad/s^3 == 57.29577951308232 °/s^3 * 1 °/s^3 == 0.017453292519943295 rad/s^3 Note: This parameter determines the value of the property self.default_is_radian Note: This parameter determines the default value of the interface with the is_radian/input_is_radian/return_is_radian parameter The list of affected interfaces is as follows: 1. method: get_position 2. method: set_position 3. method: get_servo_angle 4. method: set_servo_angle 5. method: set_servo_angle_j 6. method: move_gohome 7. method: reset 8. method: set_tcp_offset 9. method: set_joint_jerk 10. method: set_joint_maxacc 11. method: get_inverse_kinematics 12. method: get_forward_kinematics 13. method: is_tcp_limit 14. method: is_joint_limit 15. method: get_params 16: method: move_arc_lines 17: method: move_circle 18: method: set_servo_cartesian Note: This parameter determines the default return type for some interfaces (such as the position, velocity, and acceleration associated with the return angle arc). The affected attributes are as follows: 1. property: position 2. property: last_used_position 3. property: angles 4. property: last_used_angles 5. property: last_used_joint_speed 6. property: last_used_joint_acc 7. property: tcp_offset :param do_not_open: do not open, default is False, if true, you need to manually call the connect interface. :param kwargs: keyword parameters, generally do not need to set axis: number of axes, required only when using a serial port connection, default is 7 baudrate: serial baudrate, invalid, reserved. timeout: serial timeout, invalid, reserved. filters: serial port filters, invalid, reserved. check_tcp_limit: check the tcp param value out of limit or not, default is False Note: only check the param roll/pitch/yaw of the interface set_position/move_arc_lines check_joint_limit: check the joint param value out of limit or not, default is True Note: only check the param angle of the interface set_servo_angle and the param angles of the interface set_servo_angle_j check_cmdnum_limit: check the cmdnum out of limit or not, default is True max_cmdnum: max cmdnum, default is 512 Note: only available in the param check_cmdnum_limit is True check_is_ready: check if the arm is ready to move or not, default is True Note: only available if firmware_version < 1.5.20
def calibrate_tcp_coordinate_offset(self, four_points, is_radian=None):
Four-point method to calibrate tool coordinate system position offset Note: 1. only available if firmware_version >= 1.6.9
:param four_points: a list of four teaching coordinate positions [x, y, z, roll, pitch, yaw] :param is_radian: the roll/pitch/yaw value of the each point in radians or not, default is self.default_is_radian :return: tuple((code, xyz_offset)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. xyz_offset: calculated xyz(mm) TCP offset, [x, y, z]
def calibrate_tcp_orientation_offset(self, rpy_be, rpy_bt, input_is_radian=None, return_is_radian=None):
An additional teaching point to calibrate the tool coordinate system attitude offset Note: 1. only available if firmware_version >= 1.6.9
:param rpy_be: the rpy value of the teaching point without TCP offset [roll, pitch, yaw] :param rpy_bt: the rpy value of the teaching point with TCP offset [roll, pitch, yaw] :param input_is_radian: the roll/pitch/yaw value of rpy_be and rpy_bt in radians or not, default is self.default_is_radian :param return_is_radian: the roll/pitch/yaw value of result in radians or not, default is self.default_is_radian :return: tuple((code, rpy_offset)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. rpy_offset: calculated rpy TCP offset, [roll, pitch, yaw]
def calibrate_user_coordinate_offset(self, rpy_ub, pos_b_uorg, is_radian=None):
An additional teaching point determines the position offset of the user coordinate system. Note: 1. only available if firmware_version >= 1.6.9
:param rpy_ub: the confirmed offset of the base coordinate system in the user coordinate system [roll, pitch, yaw], which is the result of calibrate_user_orientation_offset() :param pos_b_uorg: the position of the teaching point in the base coordinate system [x, y, z], if the arm cannot reach the target position, the user can manually input the position of the target in the base coordinate. :param is_radian: the roll/pitch/yaw value of rpy_ub in radians or not, default is self.default_is_radian :return: tuple((code, xyz_offset)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. xyz_offset: calculated xyz(mm) user offset, [x, y, z]
def calibrate_user_orientation_offset(self, three_points, mode=0, trust_ind=0, input_is_radian=None, return_is_radian=None):
Three-point method teaches user coordinate system posture offset Note: 1. only available if firmware_version >= 1.6.9
Note: First determine a point in the working space, move along the desired coordinate system x+ to determine the second point, and then move along the desired coordinate system y+ to determine the third point. Note that the x+ direction is as accurate as possible. If the y+ direction is not completely perpendicular to x+, it will be corrected in the calculation process.
:param three_points: a list of teaching TCP coordinate positions [x, y, z, roll, pitch, yaw] :param input_is_radian: the roll/pitch/yaw value of the each point in radians or not, default is self.default_is_radian :param return_is_radian: the roll/pitch/yaw value of result in radians or not, default is self.default_is_radian :return: tuple((code, rpy_offset)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. rpy_offset: calculated rpy user offset, [roll, pitch, yaw]
def check_verification(self):
check verification
:return: tuple((code, status)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. status: 0: verified other: not verified
def clean_bio_gripper_error(self):
Clean the error code of the bio gripper
:return: code code: See the API Code Documentation for details.
def clean_conf(self):
Clean current config and restore system default settings Note: 1. This interface will clear the current settings and restore to the original settings (system default settings)
:return: code code: See the API Code Documentation for details.
def clean_error(self):
Clean the error, need to be manually enabled motion(arm.motion_enable(True)) and set state(arm.set_state(state=0))after clean error
:return: code code: See the API Code Documentation for details.
def clean_gripper_error(self, **kwargs):
Clean the gripper error
:return: code code: See the API Code Documentation for details.
def clean_linear_track_error(self):
Clean the linear track error Note: 1. only available if firmware_version >= 1.8.0
:return: code code: See the API Code Documentation for details.
def clean_warn(self):
Clean the warn
:return: code code: See the API Code Documentation for details.
def close_bio_gripper(self, speed=0, wait=True, timeout=5, **kwargs):
Close the bio gripper
:param speed: speed value, default is 0 (not set the speed) :param wait: whether to wait for the bio gripper motion complete, default is True :param timeout: maximum waiting time(unit: second), default is 5, only available if wait=True
:return: code code: See the API Code Documentation for details.
def close_lite6_gripper(self):
Close the gripper of Lite6 series robotic arms Note: 1. only available if firmware_version >= 1.10.0 2. this API can only be used on Lite6 series robotic arms
:return: code code: See the API Code Documentation for details.
def config_cgpio_reset_when_stop(self, on_off):
Config the Controller GPIO reset the digital output when the robot is in stop state
:param on_off: True/False :return: code code: See the API Code Documentation for details.
def config_force_control(self, coord, c_axis, f_ref, limits, **kwargs):
Set force control parameters through the Six-axis Force Torque Sensor. Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:param coord: task frame. 0: base frame. 1: tool frame. :param c_axis: a 6d vector of 0s and 1s. 1 means that robot will be compliant in the corresponding axis of the task frame. :param f_ref: the forces/torques the robot will apply to its environment. The robot adjusts its position along/about compliant axis in order to achieve the specified force/torque. :param limits: for compliant axes, these values are the maximum allowed tcp speed along/about the axis. :return: code code: See the API Code Documentation for details.
def config_tgpio_reset_when_stop(self, on_off):
Config the Tool GPIO reset the digital output when the robot is in stop state
:param on_off: True/False :return: code code: See the API Code Documentation for details.
def connect(self, port=None, baudrate=None, timeout=None, axis=None, **kwargs):
Connect to xArm
:param port: port name or the ip address, default is the value when initializing an instance :param baudrate: baudrate, only available in serial way, default is the value when initializing an instance :param timeout: timeout, only available in serial way, default is the value when initializing an instance :param axis: number of axes, required only when using a serial port connection, default is 7
def delete_blockly_app(self, name):
Delete blockly app
:param name: blockly app name
:return: code code: See the API Code Documentation for details.
def delete_trajectory(self, name):
Delete trajectory
:param name: trajectory name
:return: code code: See the API Code Documentation for details.
def disconnect(self):
Disconnect
def emergency_stop(self):
Emergency stop (set_state(4) -> motion_enable(True) -> set_state(0)) Note: 1. This interface does not automatically clear the error. If there is an error, you need to handle it according to the error code.
def ft_sensor_app_get(self):
Get force mode Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:return: tuple((code, app_code)) code: See the API Code Documentation for details. app_code: 0: non-force mode 1: impedance control mode 2: force control mode
def ft_sensor_app_set(self, app_code):
Set robot to be controlled in force mode. (Through the Six-axis Force Torque Sensor) Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:param app_code: force mode. 0: non-force mode 1: impendance control 2: force control :return: code code: See the API Code Documentation for details.
def ft_sensor_cali_load(self, iden_result_list, association_setting_tcp_load=False, **kwargs):
Write the load offset parameters identified by the Six-axis Force Torque Sensor Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported) 3. starting from SDK v1.11.0, the centroid unit is millimeters (originally meters)
:param iden_result_list: [mass(kg), x_centroid(mm), y_centroid(mm), z_centroid(mm), Fx_offset, Fy_offset, Fz_offset, Tx_offset, Ty_offset, Tz_ffset] :param association_setting_tcp_load: whether to convert the parameter to the corresponding tcp load and set, default is False Note: If True, the value of tcp load will be modified :return: code code: See the API Code Documentation for details.
def ft_sensor_enable(self, on_off):
Used for enabling and disabling the use of the Six-axis Force Torque Sensor measurements in the controller. Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:param on_off: enable or disable F/T data sampling. :return: code code: See the API Code Documentation for details.
def ft_sensor_iden_load(self):
Identification the tcp load with the the Six-axis Force Torque Sensor Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported) 3. starting from SDK v1.11.0, the centroid unit is millimeters (originally meters)
:return: tuple((code, load)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. load: [mass(kg), x_centroid(mm), y_centroid(mm), z_centroid(mm), Fx_offset, Fy_offset, Fz_offset, Tx_offset, Ty_offset, Tz_ffset]
def ft_sensor_set_zero(self):
Set the current state to the zero point of the Six-axis Force Torque Sensor Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:return: code code: See the API Code Documentation for details.
def get_allow_approx_motion(self):
Obtain whether to enable approximate solutions to avoid certain singularities Note: 1. only available if firmware_version >= 1.9.0
:return: code code: See the API Code Documentation for details.
def get_base_board_version(self, board_id=10):
 Get base board version
:param board_id: int :return: : (code, version) code: See the API Code Documentation for details.
def get_bio_gripper_error(self):
Get the error code of the bio gripper
:return: tuple((code, error_code)) code: See the API Code Documentation for details. error_code: See the Bio Gripper Error Code Documentation for details.
def get_bio_gripper_status(self):
Get the status of the bio gripper
:return: tuple((code, status)) code: See the API Code Documentation for details. status: status status & 0x03 == 0: stop status & 0x03 == 1: motion status & 0x03 == 2: catch status & 0x03 == 3: error (status >> 2) & 0x03 == 0: not enabled (status >> 2) & 0x03 == 1: enabling (status >> 2) & 0x03 == 2: enabled
def get_cgpio_analog(self, ionum=None):
Get the analog value of the specified Controller GPIO :param ionum: 0 or 1 or None(both 0 and 1), default is None :return: tuple((code, value or value list)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_cgpio_digital(self, ionum=None):
Get the digital value of the specified Controller GPIO
:param ionum: 015 or None(both 015), default is None :return: tuple((code, value or value list)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_cgpio_state(self):
Get the state of the Controller GPIO :return: code, states code: See the API Code Documentation for details. states: [...] states[0]: contorller gpio module state states[0] == 0: normal states[0] == 1:wrong states[0] == 6:communication failure states[1]: controller gpio module error code states[1] == 0: normal states[1] != 0:error code states[2]: digital input functional gpio state Note: digital-i-input functional gpio state = states[2] >> i & 0x0001 states[3]: digital input configuring gpio state Note: digital-i-input configuring gpio state = states[3] >> i & 0x0001 states[4]: digital output functional gpio state Note: digital-i-output functional gpio state = states[4] >> i & 0x0001 states[5]: digital output configuring gpio state Note: digital-i-output configuring gpio state = states[5] >> i & 0x0001 states[6]: analog-0 input value states[7]: analog-1 input value states[8]: analog-0 output value states[9]: analog-1 output value states[10]: digital input functional info, [digital-0-input-functional-mode, ... digital-15-input-functional-mode] states[11]: digital output functional info, [digital-0-output-functional-mode, ... digital-15-output-functional-mode]
def get_checkset_default_baud(self, type_):
Get the checkset baud value
:param type_: checkset type 1: xarm gripper 2: bio gripper 3: robotiq gripper 4: linear track :return: tuple((code, baud)) code: See the API Code Documentation for details. baud: the checkset baud value
def get_cmdnum(self):
Get the cmd count in cache :return: tuple((code, cmd_num)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_dh_params(self):
Get the DH parameters Note: 1. only available if firmware_version >= 2.0.0
:return: tuple((code, dh_params)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. dh_params: DH parameters dh_params[0:4]: DH parameters of Joint-1 dh_params[4:8]: DH parameters of Joint-2 ... dh_params[24:28]: DH parameters of Joint-7
def get_err_warn_code(self, show=False, lang='en'):
Get the controller error and warn code
:param show: show the detail info if True :param lang: show language, en/cn, degault is en, only available if show is True :return: tuple((code, [error_code, warn_code])), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. error_code: See the Controller Error Code Documentation for details. warn_code: See the Controller Error Code Documentation for details.
def get_forward_kinematics(self, angles, input_is_radian=None, return_is_radian=None):
Get forward kinematics
:param angles: [angle-1, angle-2, ..., angle-n], n is the number of axes of the arm :param input_is_radian: the param angles value is in radians or not, default is self.default_is_radian :param return_is_radian: the returned value is in radians or not, default is self.default_is_radian :return: tuple((code, pose)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. pose: [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)] or [] Note: the roll/pitch/yaw value is radians if return_is_radian is True, else °
def get_ft_sensor_config(self):
Get the config of the Six-axis Force Torque Sensor Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported) :return: tuple((code, config)) code: See the API Code Documentation for details. config: [...], the config of the Six-axis Force Torque Sensor, only when code is 0, the returned result is correct. [0] ft_app_status: force mode 0: non-force mode 1: impendance control 2: force control [1] ft_is_started: ft sensor is enable or not [2] ft_type: ft sensor type [3] ft_id: ft sensor id [4] ft_freq: ft sensor frequency [5] ft_mass: load mass [6] ft_dir_bias: reversed [7] ft_centroid: [x_centroid,y_centroid,z_centroid] [8] ft_zero: [Fx_offset,Fy_offset,Fz_offset,Tx_offset,Ty_offset,Tz_ffset] [9] imp_coord: task frame of impendance control mode. 0: base frame. 1: tool frame. [10] imp_c_axis: a 6d vector of 0s and 1s. 1 means that robot will be impedance in the corresponding axis of the task frame. [11] M: mass. (kg) [12] K: stiffness coefficient. [13] B: damping coefficient. invalid. Note: the value is set to 2sqrt(MK) in controller. [14] f_coord: task frame of force control mode. 0: base frame. 1: tool frame. [15] f_c_axis: a 6d vector of 0s and 1s. 1 means that robot will be impedance in the corresponding axis of the task frame. [16] f_ref: the forces/torques the robot will apply to its environment. The robot adjusts its position along/about compliant axis in order to achieve the specified force/torque. [17] f_limits: reversed. [18] kp: proportional gain [19] ki: integral gain. [20] kd: differential gain. [21] xe_limit: 6d vector. for compliant axes, these values are the maximum allowed tcp speed along/about the axis. mm/s
def get_ft_sensor_data(self):
Get the data of the Six-axis Force Torque Sensor Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:return: tuple((code, exe_ft)) code: See the API Code Documentation for details. ft_data: only when code is 0, the returned result is correct. Note: The external force detection value of the Six-axis Force Torque Sensor after filtering, load and offset compensation
def get_ft_sensor_error(self):
Get the error code of the Six-axis Force Torque Sensor Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:return: tuple((code, error)) code: See the API Code Documentation for details. error: See the Six-axis Force Torque Sensor Error Code Documentation for details.
def get_gripper_err_code(self, **kwargs):
Get the gripper error code
:return: tuple((code, err_code)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. err_code: See the Gripper Error Code Documentation for details.
def get_gripper_position(self, **kwargs):
Get the gripper position
:return: tuple((code, pos)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_gripper_version(self):
Get gripper version, only for debug
:return: (code, version) code: See the API Code Documentation for details.
def get_harmonic_type(self, servo_id=1):
Get harmonic type, only for debug
:return: (code, type) code: See the API Code Documentation for details.
def get_hd_types(self):
Get harmonic types, only for debug
:return: (code, types) code: See the API Code Documentation for details.
def get_initial_point(self):
Get the initial point from studio
:return: tuple((code, point)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. point: initial point, [J1, J2, ..., J7]
def get_inverse_kinematics(self, pose, input_is_radian=None, return_is_radian=None):
Get inverse kinematics
:param pose: [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)] Note: the roll/pitch/yaw unit is radian if input_is_radian is True, else ° :param input_is_radian: the param pose value(only roll/pitch/yaw) is in radians or not, default is self.default_is_radian :param return_is_radian: the returned value is in radians or not, default is self.default_is_radian :return: tuple((code, angles)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. angles: [angle-1(rad or °), angle-2, ..., angle-(Number of axes)] or [] Note: the returned angle value is radians if return_is_radian is True, else °
def get_is_moving(self):
Check xArm is moving or not :return: True/False
def get_joint_states(self, is_radian=None, num=3):
Get the joint states Note: 1. only available if firmware_version >= 1.9.0
:param is_radian: the returned value(position and velocity) is in radians or not, default is self.default_is_radian :return: tuple((code, [position, velocity, effort])), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. position: the angles of joints, like [angle-1, ..., angle-7] velocity: the velocities of joints, like [velo-1, ..., velo-7] effort: the efforts of joints, like [effort-1, ..., effort-7]
def get_joints_torque(self):
Get joints torque
:return: tuple((code, joints_torque)) code: See the API Code Documentation for details. joints_torque: joints torque
def get_linear_track_error(self):
Get the error code of the linear track Note: 1. only available if firmware_version >= 1.8.0
:return: tuple((code, error)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. error: See the Linear Motor Error Code Documentation for details.
def get_linear_track_is_enabled(self):
Get the linear track is enabled or not Note: 1. only available if firmware_version >= 1.8.0
:return: tuple((code, status)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. status: 0: linear track is not enabled 1: linear track is enabled
def get_linear_track_on_zero(self):
Get the linear track is on zero positon or not Note: 1. only available if firmware_version >= 1.8.0
:return: tuple((code, status)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. status: 0: linear track is not on zero 1: linear track is on zero
def get_linear_track_pos(self):
Get the pos of the linear track Note: 1. only available if firmware_version >= 1.8.0
:return: tuple((code, position)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. position: position
def get_linear_track_registers(self, **kwargs):
Get the status of the linear track Note: 1. only available if firmware_version >= 1.8.0
:return: tuple((code, status)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. status: status, like { 'pos': 0, 'status': 0, 'error': 0, 'is_enabled': 0, 'on_zero': 0, 'sci': 1, 'sco': [0, 0], }
def get_linear_track_sci(self):
Get the sci1 value of the linear track Note: 1. only available if firmware_version >= 1.8.0
:return: tuple((code, sci1)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_linear_track_sco(self):
Get the sco value of the linear track Note: 1. only available if firmware_version >= 1.8.0
:return: tuple((code, sco)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. sco: [sco0, sco1]
def get_linear_track_status(self):
Get the status of the linear track Note: 1. only available if firmware_version >= 1.8.0
:return: tuple((code, status)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. status: status status & 0x00: motion finish status & 0x01: in motion status & 0x02: has stop
def get_mount_direction(self):
Get the mount degrees from studio
:return: tuple((code, degrees)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. degrees: mount degrees, [tilt angle, rotate angle]
def get_pose_offset(self, pose1, pose2, orient_type_in=0, orient_type_out=0, is_radian=None):
Calculate the pose offset of two given points
:param pose1: [x(mm), y(mm), z(mm), roll/rx(rad or °), pitch/ry(rad or °), yaw/rz(rad or °)] :param pose2: [x(mm), y(mm), z(mm), roll/rx(rad or °), pitch/ry(rad or °), yaw/rz(rad or °)] :param orient_type_in: input attitude notation, 0 is RPY(roll/pitch/yaw) (default), 1 is axis angle(rx/ry/rz) :param orient_type_out: notation of output attitude, 0 is RPY (default), 1 is axis angle :param is_radian: the roll/rx/pitch/ry/yaw/rz of pose1/pose2/return_pose is radian or not :return: tuple((code, pose)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. pose: [x(mm), y(mm), z(mm), roll/rx(rad or °), pitch/ry(rad or °), yaw/rz(rad or °)]
def get_position(self, is_radian=None):
Get the cartesian position Note: 1. If the value(roll/pitch/yaw) you want to return is an radian unit, please set the parameter is_radian to True ex: code, pos = arm.get_position(is_radian=True)
:param is_radian: the returned value (only roll/pitch/yaw) is in radians or not, default is self.default_is_radian :return: tuple((code, [x, y, z, roll, pitch, yaw])), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_position_aa(self, is_radian=None):
Get the pose represented by the axis angle pose
:param is_radian: the returned value (only rx/ry/rz) is in radians or not, default is self.default_is_radian :return: tuple((code, [x, y, z, rx, ry, rz])), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_reduced_mode(self):
Get reduced mode
Note: 1. This interface relies on Firmware 1.2.0 or above
:return: tuple((code, mode)) code: See the API Code Documentation for details. mode: 0 or 1, 1 means that the reduced mode is turned on. 0 means that the reduced mode is not turned on
def get_reduced_states(self, is_radian=None):
Get states of the reduced mode
Note: 1. This interface relies on Firmware 1.2.0 or above
:param is_radian: the max_joint_speed of the states is in radians or not, default is self.default_is_radian :return: tuple((code, states)) code: See the API Code Documentation for details. states: [....] if version > 1.2.11: states: [ reduced_mode_is_on, [reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min], reduced_max_tcp_speed, reduced_max_joint_speed, joint_ranges([joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]), safety_boundary_is_on, collision_rebound_is_on, ] if version <= 1.2.11: states: [ reduced_mode_is_on, [reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min], reduced_max_tcp_speed, reduced_max_joint_speed, ]
def get_report_tau_or_i(self):
Get the reported torque or electric current
:return: tuple((code, tau_or_i)) code: See the API Code Documentation for details. tau_or_i: 0: torque 1: electric current
def get_robot_sn(self):
Get the xArm sn
:return: tuple((code, sn)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_safe_level(self):
Get safe level
:return: tuple((code, safe_level)) code: See the API Code Documentation for details. safe_level: safe level
def get_servo_angle(self, servo_id=None, is_radian=None, is_real=False):
Get the servo angle Note: 1. If the value you want to return is an radian unit, please set the parameter is_radian to True ex: code, angles = arm.get_servo_angle(is_radian=True) 2. If you want to return only the angle of a single joint, please set the parameter servo_id ex: code, angle = arm.get_servo_angle(servo_id=2) 3. This interface is only used in the base coordinate system.
:param servo_id: 1-(Number of axes), None(8), default is None :param is_radian: the returned value is in radians or not, default is self.default_is_radian :return: tuple((code, angle list if servo_id is None or 8 else angle)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_servo_debug_msg(self, show=False, lang='en'):
Get the servo debug msg, used only for debugging
:param show: show the detail info if True :param lang: language, en/cn, default is en :return: tuple((code, servo_info_list)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_servo_version(self, servo_id=1):
Get servo version, only for debug
:param servo_id: servo id(1~7) :return: (code, version) code: See the API Code Documentation for details.
def get_state(self):
Get state
:return: tuple((code, state)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. state: 1: in motion 2: sleeping 3: suspended 4: stopping
def get_tgpio_analog(self, ionum=None):
Get the analog value of the specified Tool GPIO :param ionum: 0 or 1 or None(both 0 and 1), default is None :return: tuple((code, value or value list)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_tgpio_digital(self, ionum=None):
Get the digital value of the specified Tool GPIO
:param ionum: 0 or 1 or None(both 0 and 1), default is None :return: tuple((code, value or value list)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def get_tgpio_modbus_baudrate(self):
Get the modbus baudrate of the tool gpio
:return: tuple((code, baudrate)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. baudrate: the modbus baudrate of the tool gpio
def get_tgpio_version(self):
Get tool gpio version, only for debug
:return: (code, version) code: See the API Code Documentation for details.
def get_trajectories(self):
get the trajectories
Note: 1. This interface relies on xArmStudio 1.2.0 or above 2. This interface relies on Firmware 1.2.0 or above
:return: tuple((code, trajectories)) code: See the API Code Documentation for details. trajectories: [{ 'name': name, # The name of the trajectory 'duration': duration, # The duration of the trajectory (seconds) }]
def get_trajectory_rw_status(self):
Get trajectory read/write status
:return: (code, status) code: See the API Code Documentation for details. status: 0: no read/write 1: loading 2: load success 3: load failed 4: saving 5: save success 6: save failed
def get_vacuum_gripper(self):
Get vacuum gripper state
:return: tuple((code, state)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. state: suction cup state 0: suction cup is off 1: suction cup is on
def get_version(self):
Get the xArm firmware version
:return: tuple((code, version)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details.
def getset_tgpio_modbus_data(self, datas, min_res_len=0, host_id=9, is_transparent_transmission=False, use_503_port=False, **kwargs):
Send the modbus data to the tool gpio
:param datas: data_list :param min_res_len: the minimum length of modbus response data. Used to check the data length, if not specified, no check :param host_id: host_id, default is 9 (TGPIO_HOST_ID) 9: END RS485 10: CONTROLLER RS485 :param is_transparent_transmission: whether to choose transparent transmission, default is False Note: only available if firmware_version >= 1.11.0 :param use_503_port: whether to use port 503 for communication, default is False Note: if it is True, it will connect to 503 port for communication when it is used for the first time, which is generally only useful for transparent transmission. Note: only available if firmware_version >= 1.11.0
:return: tuple((code, modbus_response)) code: See the API Code Documentation for details. modbus_response: modbus response data
def iden_joint_friction(self, sn=None):
Identification the friction Note: 1. only available if firmware_version >= 1.9.0
:param sn: sn value :return: tuple((code, result)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. result: 0: success -1: failure
def iden_tcp_load(self, estimated_mass=0):
Identification the tcp load with current Note: 1. only available if firmware_version >= 1.8.0
:param estimated_mass: estimated mass Note: this parameter is only available on the lite6 model manipulator, and this parameter must be specified for the lite6 model manipulator :return: tuple((code, load)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. load: [mass,x_centroid,y_centroid,z_centroid]
def is_joint_limit(self, joint, is_radian=None):
Check the joint angle is in limit
:param joint: [angle-1, angle-2, ..., angle-n], n is the number of axes of the arm :param is_radian: angle value is radians or not, default is self.default_is_radian :return: tuple((code, limit)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. limit: True/False/None, limit or not, or failed
def is_tcp_limit(self, pose, is_radian=None):
Check the tcp pose is in limit
:param pose: [x, y, z, roll, pitch, yaw] :param is_radian: roll/pitch/yaw value is radians or not, default is self.default_is_radian :return: tuple((code, limit)), only when code is 0, the returned result is correct. code: See the API Code Documentation for details. limit: True/False/None, limit or not, or failed
def load_trajectory(self, filename, wait=True, timeout=None, **kwargs):
Load the trajectory
Note: 1. This interface relies on Firmware 1.2.0 or above
:param filename: The name of the trajectory to load :param wait: Whether to wait for loading, default is True :param timeout: Timeout waiting for loading to complete :return: code code: See the API Code Documentation for details.
def mask_write_holding_register(self, addr, and_mask, or_mask):
(Standard Modbus TCP) Mask Write Holding Register (0x16)
:param addr: register address :param and_mask: mask to be AND with :param or_mask: mask to be OR with :return: See the API Code Documentation for details. Note: code 129~144 means modbus tcp exception, the actual modbus tcp exception code is (code-0x80), refer to Standard Modbus TCP
def motion_enable(self, enable=True, servo_id=None):
Motion enable
:param enable:True/False :param servo_id: 1-(Number of axes), None(8) :return: code code: See the API Code Documentation for details.
def move_arc_lines(self, paths, is_radian=None, times=1, first_pause_time=0.1, repeat_pause_time=0, automatic_calibration=True, speed=None, mvacc=None, mvtime=None, wait=False):
Continuous linear motion with interpolation. Note: 1. If an error occurs, it will return early. 2. If the emergency_stop interface is called actively, it will return early. 3. The last_used_position/last_used_tcp_speed/last_used_tcp_acc will be modified. 4. The last_used_angles/last_used_joint_speed/last_used_joint_acc will not be modified.
:param paths: cartesian path list 1. Specify arc radius: [[x, y, z, roll, pitch, yaw, radius], ....] 2. Do not specify arc radius (radius=0): [[x, y, z, roll, pitch, yaw], ....] 3. If you want to plan the continuous motion,set radius>0.
:param is_radian: roll/pitch/yaw of paths are in radians or not, default is self.default_is_radian :param times: repeat times, 0 is infinite loop, default is 1 :param first_pause_time: sleep time at first, purpose is to cache the commands and plan continuous motion, default is 0.1s :param repeat_pause_time: interval between repeated movements, unit: (s)second :param automatic_calibration: automatic calibration or not, default is True :param speed: move speed (mm/s, rad/s), default is self.last_used_tcp_speed :param mvacc: move acceleration (mm/s^2, rad/s^2), default is self.last_used_tcp_acc :param mvtime: 0, reserved :param wait: whether to wait for the arm to complete, default is False
def move_circle(self, pose1, pose2, percent, speed=None, mvacc=None, mvtime=None, is_radian=None, wait=False, timeout=None, is_tool_coord=False, is_axis_angle=False, **kwargs):
The motion calculates the trajectory of the space circle according to the three-point coordinates. The three-point coordinates are (current starting point, pose1, pose2).
:param pose1: cartesian position, [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)] :param pose2: cartesian position, [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)] :param percent: the percentage of arc length and circumference of the movement :param speed: move speed (mm/s, rad/s), default is self.last_used_tcp_speed :param mvacc: move acceleration (mm/s^2, rad/s^2), default is self.last_used_tcp_acc :param mvtime: 0, reserved :param is_radian: roll/pitch/yaw value is radians or not, default is self.default_is_radian :param wait: whether to wait for the arm to complete, default is False :param timeout: maximum waiting time(unit: second), default is None(no timeout), only valid if wait is True :param is_tool_coord: is tool coord or not, default is False, only available if firmware_version >= 1.11.100 :param is_axis_angle: is axis angle or not, default is False, only available if firmware_version >= 1.11.100 :param kwargs: reserved :return: code code: See the API Code Documentation for details. code < 0: the last_used_tcp_speed/last_used_tcp_acc will not be modified code >= 0: the last_used_tcp_speed/last_used_tcp_acc will be modified
def move_gohome(self, speed=None, mvacc=None, mvtime=None, is_radian=None, wait=False, timeout=None, **kwargs):
Move to go home (Back to zero), the API will modify self.last_used_position and self.last_used_angles value Warnning: without limit detection Note: 1. The API will change self.last_used_position value into [201.5, 0, 140.5, -180, 0, 0] 2. The API will change self.last_used_angles value into [0, 0, 0, 0, 0, 0, 0] 3. If you want to wait for the robot to complete this action and then return, please set the parameter wait to True. ex: code = arm.move_gohome(wait=True) 4. This interface does not modify the value of last_used_angles/last_used_joint_speed/last_used_joint_acc
:param speed: gohome speed (unit: rad/s if is_radian is True else °/s), default is 50 °/s :param mvacc: gohome acceleration (unit: rad/s^2 if is_radian is True else °/s^2), default is 5000 °/s^2 :param mvtime: reserved :param is_radian: the speed and acceleration are in radians or not, default is self.default_is_radian :param wait: whether to wait for the arm to complete, default is False :param timeout: maximum waiting time(unit: second), default is None(no timeout), only valid if wait is True :return: code code: See the API Code Documentation for details.
def open_bio_gripper(self, speed=0, wait=True, timeout=5, **kwargs):
Open the bio gripper
:param speed: speed value, default is 0 (not set the speed) :param wait: whether to wait for the bio gripper motion complete, default is True :param timeout: maximum waiting time(unit: second), default is 5, only available if wait=True
:return: code code: See the API Code Documentation for details.
def open_lite6_gripper(self):
Open the gripper of Lite6 series robotic arms Note: 1. only available if firmware_version >= 1.10.0 2. this API can only be used on Lite6 series robotic arms
:return: code code: See the API Code Documentation for details.
def playback_trajectory(self, times=1, filename=None, wait=True, double_speed=1, **kwargs):
Playback trajectory
Note: 1. This interface relies on Firmware 1.2.0 or above
:param times: Number of playbacks, 1. Only valid when the current position of the arm is the end position of the track, otherwise it will only be played once. :param filename: The name of the trajectory to play back 1. If filename is None, you need to manually call the load_trajectory to load the trajectory. :param wait: whether to wait for the arm to complete, default is False :param double_speed: double speed, only support 1/2/4, default is 1, only available if version > 1.2.11 :return: code code: See the API Code Documentation for details.
def read_coil_bits(self, addr, quantity):
(Standard Modbus TCP) Read Coils (0x01)
:param addr: the starting address of the register to be read :param quantity: number of registers :return: tuple((code, bits)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. Note: code 129~144 means modbus tcp exception, the actual modbus tcp exception code is (code-0x80), refer to Standard Modbus TCP
def read_holding_registers(self, addr, quantity, is_signed=False):
(Standard Modbus TCP) Read Holding Registers (0x03)
:param addr: the starting address of the register to be read :param quantity: number of registers :param is_signed: whether to convert the read register value into a signed form :return: tuple((code, bits)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. Note: code 129~144 means modbus tcp exception, the actual modbus tcp exception code is (code-0x80), refer to Standard Modbus TCP
def read_input_bits(self, addr, quantity):
(Standard Modbus TCP) Read Discrete Inputs (0x02)
:param addr: the starting address of the register to be read :param quantity: number of registers :return: tuple((code, bits)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. Note: code 129~144 means modbus tcp exception, the actual modbus tcp exception code is (code-0x80), refer to Standard Modbus TCP
def read_input_registers(self, addr, quantity, is_signed=False):
(Standard Modbus TCP) Read Input Registers (0x04)
:param addr: the starting address of the register to be read :param quantity: number of registers :param is_signed: whether to convert the read register value into a signed form :return: tuple((code, bits)) only when code is 0, the returned result is correct. code: See the API Code Documentation for details. Note: code 129~144 means modbus tcp exception, the actual modbus tcp exception code is (code-0x80), refer to Standard Modbus TCP
def register_cmdnum_changed_callback(self, callback=None):
Register the cmdnum changed callback, only available if enable_report is True
:param callback: callback data: { "cmdnum": cmdnum } :return: True/False
def register_connect_changed_callback(self, callback=None):
Register the connect status changed callback
:param callback: callback data: { "connected": connected, "reported": reported, } :return: True/False
def register_count_changed_callback(self, callback=None):
Register the counter value changed callback, only available if enable_report is True
:param callback: callback data: { "count": counter value } :return: True/False
def register_error_warn_changed_callback(self, callback=None):
Register the error code or warn code changed callback, only available if enable_report is True
:param callback: callback data: { "error_code": error_code, "warn_code": warn_code, } :return: True/False
def register_feedback_callback(self, callback=None):
Register the callback of feedback Note: 1. only available if firmware_version >= 2.1.0
:param callback: callback data: bytes data data[0:2]: transaction id, (Big-endian conversion to unsigned 16-bit integer data), command ID corresponding to the feedback, consistent with issued instructions Note: this can be used to distinguish which instruction the feedback belongs to data[4:6]: feedback_length, feedback_length == len(data) - 6, (Big-endian conversion to unsigned 16-bit integer data) data[8]: feedback type 1: the motion task starts executing 2: the motion task execution ends or motion task is discarded(usually when the distance is too close to be planned) 4: the non-motion task is triggered data[9]: feedback funcode, command code corresponding to feedback, consistent with issued instructions Note: this can be used to distinguish what instruction the feedback belongs to data[10:12]: feedback taskid, (Big-endian conversion to unsigned 16-bit integer data) data[12]: feedback code, execution status code, generally only meaningful when the feedback type is end, normally 0, 2 means discarded data[13:21]: feedback us, (Big-endian conversion to unsigned 64-bit integer data), time when feedback triggers (microseconds) Note: this time is the corresponding controller system time when the feedback is triggered :return: True/False
def register_iden_progress_changed_callback(self, callback=None):
Register the Identification progress value changed callback, only available if enable_report is True
:param callback: callback data: { "progress": progress value } :return: True/False
def register_mode_changed_callback(self, callback=None):
Register the mode changed callback, only available if enable_report is True and the connect way is socket
:param callback: callback data: { "mode": mode, } :return: True/False
def register_mtable_mtbrake_changed_callback(self, callback=None):
Register the motor enable states or motor brake states changed callback, only available if enable_report is True and the connect way is socket
:param callback: callback data: { "mtable": [motor-1-motion-enable, motor-2-motion-enable, ...], "mtbrake": [motor-1-brake-enable, motor-1-brake-enable,...], } :return: True/False
def register_report_callback(self, callback=None, report_cartesian=True, report_joints=True, report_state=True, report_error_code=True, report_warn_code=True, report_mtable=True, report_mtbrake=True, report_cmd_num=True):
Register the report callback, only available if enable_report is True
:param callback: callback data: { 'cartesian': [], # if report_cartesian is True 'joints': [], # if report_joints is True 'error_code': 0, # if report_error_code is True 'warn_code': 0, # if report_warn_code is True 'state': state, # if report_state is True 'mtbrake': mtbrake, # if report_mtbrake is True, and available if enable_report is True and the connect way is socket 'mtable': mtable, # if report_mtable is True, and available if enable_report is True and the connect way is socket 'cmdnum': cmdnum, # if report_cmd_num is True } :param report_cartesian: report cartesian or not, default is True :param report_joints: report joints or not, default is True :param report_state: report state or not, default is True :param report_error_code: report error or not, default is True :param report_warn_code: report warn or not, default is True :param report_mtable: report motor enable states or not, default is True :param report_mtbrake: report motor brake states or not, default is True :param report_cmd_num: report cmdnum or not, default is True :return: True/False
def register_report_location_callback(self, callback=None, report_cartesian=True, report_joints=True):
Register the report location callback, only available if enable_report is True
:param callback: callback data: { "cartesian": [x, y, z, roll, pitch, yaw], ## if report_cartesian is True "joints": [angle-1, angle-2, angle-3, angle-4, angle-5, angle-6, angle-7], ## if report_joints is True } :param report_cartesian: report or not, True/False, default is True :param report_joints: report or not, True/False, default is True :return: True/False
def register_state_changed_callback(self, callback=None):
Register the state status changed callback, only available if enable_report is True
:param callback: callback data: { "state": state, } :return: True/False
def register_temperature_changed_callback(self, callback=None):
Register the temperature changed callback, only available if enable_report is True
:param callback: callback data: { "temperatures": [servo-1-temperature, ...., servo-7-temperature] } :return: True/False
def release_cmdnum_changed_callback(self, callback=None):
Release the cmdnum changed callback
:param callback: :return: True/False
def release_connect_changed_callback(self, callback=None):
Release the connect changed callback
:param callback: :return: True/False
def release_count_changed_callback(self, callback=None):
Release the counter value changed callback
:param callback: :return: True/False
def release_error_warn_changed_callback(self, callback=None):
Release the error warn changed callback
:param callback: :return: True/False
def release_feedback_callback(self, callback=None):
Release the callback of feedback Note: 1. only available if firmware_version >= 2.1.0
:param callback: :return: True/False
def release_iden_progress_changed_callback(self, callback=None):
Release the Identification progress value changed callback
:param callback: :return: True/False
def release_mode_changed_callback(self, callback=None):
Release the mode changed callback
:param callback: :return: True/False
def release_mtable_mtbrake_changed_callback(self, callback=None):
Release the motor enable states or motor brake states changed callback
:param callback: :return: True/False
def release_report_callback(self, callback=None):
Release the report callback
:param callback: :return: True/False
def release_report_location_callback(self, callback=None):
Release the location report callback
:param callback: :return: True/False
def release_state_changed_callback(self, callback=None):
Release the state changed callback
:param callback: :return: True/False
def release_temperature_changed_callback(self, callback=None):
Release the temperature changed callback
:param callback: :return: True/False
def reset(self, speed=None, mvacc=None, mvtime=None, is_radian=None, wait=False, timeout=None):
Reset the xArm Warnning: without limit detection Note: 1. If there are errors or warnings, this interface will clear the warnings and errors. 2. If not ready, the api will auto enable motion and set state 3. This interface does not modify the value of last_used_angles/last_used_joint_speed/last_used_joint_acc
:param speed: reset speed (unit: rad/s if is_radian is True else °/s), default is 50 °/s :param mvacc: reset acceleration (unit: rad/s^2 if is_radian is True else °/s^2), default is 5000 °/s^2 :param mvtime: reserved :param is_radian: the speed and acceleration are in radians or not, default is self.default_is_radian :param wait: whether to wait for the arm to complete, default is False :param timeout: maximum waiting time(unit: second), default is None(no timeout), only valid if wait is True
def robotiq_close(self, speed=255, force=255, wait=True, timeout=5, **kwargs):
Close the robotiq gripper
:param speed: gripper speed between 0 and 255 :param force: gripper force between 0 and 255 :param wait: whether to wait for the robotiq motion to complete, default is True :param timeout: maximum waiting time(unit: second), default is 3, only available if wait=True
:return: tuple((code, robotiq_response)) code: See the API Code Documentation for details. robotiq_response: See the robotiq documentation
def robotiq_get_status(self, number_of_registers=3):
Reading the status of robotiq gripper
:param number_of_registers: number of registers, 1/2/3, default is 3 number_of_registers=1: reading the content of register 0x07D0 number_of_registers=2: reading the content of register 0x07D0/0x07D1 number_of_registers=3: reading the content of register 0x07D0/0x07D1/0x07D2 Note: register 0x07D0: Register GRIPPER STATUS register 0x07D1: Register FAULT STATUS and register POSITION REQUEST ECHO register 0x07D2: Register POSITION and register CURRENT :return: tuple((code, robotiq_response)) code: See the API Code Documentation for details. robotiq_response: See the robotiq documentation
def robotiq_open(self, speed=255, force=255, wait=True, timeout=5, **kwargs):
Open the robotiq gripper
:param speed: gripper speed between 0 and 255 :param force: gripper force between 0 and 255 :param wait: whether to wait for the robotiq motion to complete, default is True :param timeout: maximum waiting time(unit: second), default is 5, only available if wait=True
:return: tuple((code, robotiq_response)) code: See the API Code Documentation for details. robotiq_response: See the robotiq documentation
def robotiq_reset(self):
Reset the robotiq gripper (clear previous activation if any)
:return: tuple((code, robotiq_response)) code: See the API Code Documentation for details. robotiq_response: See the robotiq documentation
def robotiq_set_activate(self, wait=True, timeout=3):
If not already activated. Activate the robotiq gripper
:param wait: whether to wait for the robotiq activate complete, default is True :param timeout: maximum waiting time(unit: second), default is 3, only available if wait=True
:return: tuple((code, robotiq_response)) code: See the API Code Documentation for details. robotiq_response: See the robotiq documentation
def robotiq_set_position(self, pos, speed=255, force=255, wait=True, timeout=5, **kwargs):
Go to the position with determined speed and force.
:param pos: position of the gripper. Integer between 0 and 255. 0 being the open position and 255 being the close position. :param speed: gripper speed between 0 and 255 :param force: gripper force between 0 and 255 :param wait: whether to wait for the robotion motion complete, default is True :param timeout: maximum waiting time(unit: second), default is 5, only available if wait=True
:return: tuple((code, robotiq_response)) code: See the API Code Documentation for details. robotiq_response: See the robotiq documentation
def run_blockly_app(self, path, **kwargs):
Run the app generated by xArmStudio software :param path: app path
def run_gcode_file(self, path, **kwargs):
Run the gcode file :param path: gcode file path
def save_conf(self):
Save config Note: 1. This interface can record the current settings and will not be lost after the restart. 2. The clean_conf interface can restore system default settings
:return: code code: See the API Code Documentation for details.
def save_record_trajectory(self, filename, wait=True, timeout=5, **kwargs):
Save the trajectory you just recorded
Note: 1. This interface relies on Firmware 1.2.0 or above
:param filename: The name to save 1. Only strings consisting of English or numbers are supported, and the length is no more than 50. 2. The trajectory is saved in the controller box. 3. This action will overwrite the trajectory with the same name 4. Empty the trajectory in memory after saving, so repeated calls will cause the recorded trajectory to be covered by an empty trajectory. :param wait: Whether to wait for saving, default is True :param timeout: Timeout waiting for saving to complete :return: code code: See the API Code Documentation for details.
def send_cmd_sync(self, command=None):
Send cmd and wait (only waiting the cmd response, not waiting for the movement) Note: 1. Some command depends on self.default_is_radian
:param command: 'G1': 'set_position(MoveLine): G1 X{x} Y{y} Z{z} A{roll} B{pitch} C{yaw} F{speed} Q{acc} T{mvtime}' 'G2': 'move_circle: G2 X{x1} Y{y1} Z{z1} A{roll1} B{pitch1} C{yaw1} I{x2} J{y2} K{z2} L{roll2} M{pitch2} N{yaw2} F{speed} Q{acc} T{mvtime}' 'G4': 'set_pause_time: G4 T{second}' 'G7': 'set_servo_angle: G7 I{servo_1} J{servo_2} K{servo_3} L{servo_4} M{servo_5} N{servo_6} O{servo_7} F{speed} Q{acc} T{mvtime}' 'G8': 'move_gohome: G8 F{speed} Q{acc} T{mvtime}' 'G9': 'set_position(MoveArcLine): G9 X{x} Y{y} Z{z} A{roll} B{pitch} C{yaw} R{radius} F{speed} Q{acc} T{mvtime}' 'G11': 'set_servo_angle_j: G11 I{servo_1} J{servo_2} K{servo_3} L{servo_4} M{servo_5} N{servo_6} O{servo_7} F{speed} Q{acc} T{mvtime}' 'H1': 'get_version: H1' 'H11': 'motion_enable: H11 I{servo_id} V{enable}' 'H12': 'set_state: H12 V{state}' 'H13': 'get_state: H13' 'H14': 'get_cmdnum: H14' 'H15': 'get_err_warn_code: H15' 'H16': 'clean_error: H16' 'H17': 'clean_warn: H17' 'H18': 'set_servo_attach/set_servo_detach: H18 I{servo_id} V{1: enable(detach), 0: disable(attach)}' 'H19': 'set_mode: H19 V{mode}' 'H31': 'set_tcp_jerk: H31 V{jerk(mm/s^3)}' 'H32': 'set_tcp_maxacc: H32 V{maxacc(mm/s^2)}' 'H33': 'set_joint_jerk: H33 V{jerk(°/s^3 or rad/s^3)}' 'H34': 'set_joint_maxacc: H34 {maxacc(°/s^2 or rad/s^2)}' 'H35': 'set_tcp_offset: H35 X{x} Y{y} Z{z} A{roll} B{pitch} C{yaw}' 'H36': 'set_tcp_load: H36 I{weight} J{center_x} K{center_y} L{center_z}' 'H37': 'set_collision_sensitivity: H37 V{sensitivity}' 'H38': 'set_teach_sensitivity: H38 V{sensitivity}' 'H39': 'clean_conf: H39' 'H40': 'save_conf: H40' 'H41': 'get_position: H41' 'H42': 'get_servo_angle: H42' 'H43': 'get_inverse_kinematics: H43 X{x} Y{y} Z{z} A{roll} B{pitch} C{yaw}' 'H44': 'get_forward_kinematics: H44 I{servo_1} J{servo_2} K{servo_3} L{servo_4} M{servo_5} N{servo_6} O{servo_7}' 'H45': 'is_joint_limit: H45 I{servo_1} J{servo_2} K{servo_3} L{servo_4} M{servo_5} N{servo_6} O{servo_7}' 'H46': 'is_tcp_limit: H46 X{x} Y{y} Z{z} A{roll} B{pitch} C{yaw}' 'H51': 'set_gravity_direction: H51 X{x} Y{y} Z{z}' 'H106': 'get_servo_debug_msg: H106' 'M116': 'set_gripper_enable: M116 V{enable}' 'M117': 'set_gripper_mode: M117 V{mode}' 'M119': 'get_gripper_position: M119' 'M120': 'set_gripper_position: M120 V{pos}' 'M121': 'set_gripper_speed: M116 V{speed}' 'M125': 'get_gripper_err_code: M125' 'M126': 'clean_gripper_error: M126' 'M131': 'get_tgpio_digital: M131' 'M132': 'set_tgpio_digital: M132 I{ionum} V{value}' 'M133': 'get_tgpio_analog, default ionum=0: M133 I{ionum=0}' 'M134': 'get_tgpio_analog, default ionum=1: M134 I{ionum=1}' 'C131': 'get_cgpio_digital: C131' 'C132': 'get_cgpio_analog, default ionum=0: C132 I{ionum=0}' 'C133': 'get_cgpio_analog, default ionum=1: C133 I{ionum=1}' 'C134': 'set_cgpio_digital: C134 I{ionum} V{value}' 'C135': 'set_cgpio_analog, default ionum=0: C135 I{ionum=0} V{value}' 'C136': 'set_cgpio_analog, default ionum=1: C136 I{ionum=1} V{value}' 'C137': 'set_cgpio_digital_input_function: C137 I{ionum} V{fun}' 'C138': 'set_cgpio_digital_output_function: C138 I{ionum} V{fun}' 'C139': 'get_cgpio_state: C139' :return: code or tuple((code, ...)) code: See the API Code Documentation for details.
def send_hex_cmd(self, datas, **kwargs):
Hexadecimal communication protocol instruction
:param datas: Hexadecimal data_list :param timeout: timeout: wait timeout, seconds, default is 10s. :return : Hexadecimal data_list or code code: See the API Code Documentation for details. Note: code 129~144 means modbus tcp exception, the actual modbus tcp exception code is (code-0x80), refer to Standard Modbus TCP
def set_allow_approx_motion(self, on_off):
Settings allow to avoid overspeed near some singularities using approximate solutions Note: 1. only available if firmware_version >= 1.9.0
:param on_off: allow or not, True means allow, default is False
:return: code code: See the API Code Documentation for details.
def set_baud_checkset_enable(self, enable):
Enable auto checkset the baudrate of the end IO board or not Note: only available in the API of gripper/bio/robotiq/linear_track. :param enable: True/False :return: code code: See the API Code Documentation for details.
def set_bio_gripper_enable(self, enable=True, wait=True, timeout=3):
If not already enabled. Enable the bio gripper
:param enable: enable or not :param wait: whether to wait for the bio gripper enable complete, default is True :param timeout: maximum waiting time(unit: second), default is 3, only available if wait=True
:return: code code: See the API Code Documentation for details.
def set_bio_gripper_speed(self, speed):
Set the speed of the bio gripper
:param speed: speed
:return: code code: See the API Code Documentation for details.
def set_cartesian_velo_continuous(self, on_off):
Set cartesian motion velocity continuous Note: 1. only available if firmware_version >= 1.9.0
:param on_off: continuous or not, True means continuous, default is False
:return: code code: See the API Code Documentation for details.
def set_cgpio_analog(self, ionum, value):
Set the analog value of the specified Controller GPIO
:param ionum: 0 or 1 :param value: value :return: code code: See the API Code Documentation for details.
def set_cgpio_analog_with_xyz(self, ionum, value, xyz, fault_tolerance_radius):
Set the analog value of the specified Controller GPIO when the robot has reached the specified xyz position
:param ionum: 0 ~ 1 :param value: value :param xyz: position xyz, as [x, y, z] :param fault_tolerance_radius: fault tolerance radius :return: code code: See the API Code Documentation for details.
def set_cgpio_digital(self, ionum, value, delay_sec=None):
Set the digital value of the specified Controller GPIO
:param ionum: 0~15 :param value: value :param delay_sec: delay effective time from the current start, in seconds, default is None(effective immediately) :return: code code: See the API Code Documentation for details.
def set_cgpio_digital_input_function(self, ionum, fun):
Set the digital input functional mode of the Controller GPIO :param ionum: 0~15 :param fun: functional mode 0: general input 1: external emergency stop 2: protection reset 11: offline task 12: teaching mode 13: reduced mode 14: enable arm :return: code code: See the API Code Documentation for details.
def set_cgpio_digital_output_function(self, ionum, fun):
Set the digital output functional mode of the specified Controller GPIO :param ionum: 0~15 :param fun: functionnal mode 0: general output 1: emergency stop 2: in motion 11: has error 12: has warn 13: in collision 14: in teaching 15: in offline task 16: in reduced mode 17: is enabled 18: emergency stop is pressed :return: code code: See the API Code Documentation for details.
def set_cgpio_digital_with_xyz(self, ionum, value, xyz, fault_tolerance_radius):
Set the digital value of the specified Controller GPIO when the robot has reached the specified xyz position
:param ionum: 0 ~ 15 :param value: value :param xyz: position xyz, as [x, y, z] :param fault_tolerance_radius: fault tolerance radius :return: code code: See the API Code Documentation for details.
def set_checkset_default_baud(self, type_, baud):
Set the checkset baud value
:param type_: checkset type 1: xarm gripper 2: bio gripper 3: robotiq gripper 4: linear track :param baud: checkset baud value, less than or equal to 0 means disable checkset :return: code code: See the API Code Documentation for details.
def set_collision_rebound(self, on):
Set the collision rebound,turn on/off collision rebound
Note: 1. This interface relies on Firmware 1.2.11 or above
:param on: True/False :return: code code: See the API Code Documentation for details.
def set_collision_sensitivity(self, value, wait=True):
Set the sensitivity of collision
Note: 1. Do not use if not required 2. If not saved, it will be lost after reboot 3. The save_conf interface can record the current settings and will not be lost after the restart. 4. The clean_conf interface can restore system default settings
:param value: sensitivity value, 0~5 :param wait: reversed :return: code code: See the API Code Documentation for details.
def set_collision_tool_model(self, tool_type, *args, **kwargs):
Set the geometric model of the end effector for self collision detection :param tool_type: the geometric model type 0: No end effector, no additional parameters required 1: xArm Gripper, no additional parameters required 2: xArm Vacuum Gripper, no additional parameters required 3: xArm Bio Gripper, no additional parameters required 4: Robotiq-2F-85 Gripper, no additional parameters required 5: Robotiq-2F-140 Gripper, no additional parameters required 21: Cylinder, need additional parameters radius, height self.set_collision_tool_model(21, radius=45, height=137) :param radius: the radius of cylinder, (unit: mm) :param height: the height of cylinder, (unit: mm) 22: Cuboid, need additional parameters x, y, z self.set_collision_tool_model(22, x=234, y=323, z=23) :param x: the length of the cuboid in the x coordinate direction, (unit: mm) :param y: the length of the cuboid in the y coordinate direction, (unit: mm) :param z: the length of the cuboid in the z coordinate direction, (unit: mm) :param args: additional parameters :param kwargs: additional parameters :return: code code: See the API Code Documentation for details.
def set_counter_increase(self, val=1):
Set counter plus value, only support plus 1
:param val: reversed :return: code code: See the API Code Documentation for details.
def set_counter_reset(self):
Reset counter value
:return: code code: See the API Code Documentation for details.
def set_dh_params(self, dh_params, flag=0):
Set the DH parameters Note: 1. only available if firmware_version >= 2.0.0 2. this interface is only provided for users who need to use external DH parameters, ordinary users should not try to modify DH parameters.
:param dh_params: DH parameters :param flag: 0: Use the set DH parameters, but do not write to the configuration file 1: Use the set DH parameters and write to the configuration file 2: Use the set DH parameters and delete the DH parameters of the configuration file 3: Use the default DH parameters, but will not delete the DH parameters of the configuration file 4: Use the default DH parameters and delete the DH parameters of the configuration file :return: code code: See the API Code Documentation for details.
def set_feedback_type(self, feedback_type):
Set the feedback type Note: 1. only available if firmware_version >= 2.1.0 2. only works in position mode 3. the setting will only affect subsequent tasks and will not affect previously cached tasks 4. only valid for the current connection
:param feedback_type: 0: disable feedback 1: feedback when the motion task starts executing 2: feedback when the motion task execution ends or motion task is discarded(usually when the distance is too close to be planned) 4: feedback when the non-motion task is triggered :return: code code: See the API Code Documentation for details.
def set_fence_mode(self, on):
Set the fence mode,turn on/off fense mode
Note: 1. This interface relies on Firmware 1.2.11 or above
:param on: True/False :return: code code: See the API Code Documentation for details.
def set_force_control_pid(self, kp, ki, kd, xe_limit, **kwargs):
Set force control pid parameters through the Six-axis Force Torque Sensor. Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:param kp: proportional gain. :param ki: integral gain. :param kd: differential gain. :param xe_limit: 6d vector. for compliant axes, these values are the maximum allowed tcp speed along/about the axis. mm/s :return: code code: See the API Code Documentation for details.
def set_gravity_direction(self, direction, wait=True):
Set the direction of gravity
Note: 1. Do not use if not required 2. If not saved, it will be lost after reboot 3. The save_conf interface can record the current settings and will not be lost after the restart. 4. The clean_conf interface can restore system default settings
:param direction: direction of gravity, such as [x(mm), y(mm), z(mm)] :param wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting :return: code code: See the API Code Documentation for details.
def set_gripper_enable(self, enable, **kwargs):
Set the gripper enable
:param enable: enable or not Note: such as code = arm.set_gripper_enable(True) #turn on the Gripper :return: code code: See the API Code Documentation for details.
def set_gripper_mode(self, mode, **kwargs):
Set the gripper mode
:param mode: 0: location mode Note: such as code = arm.set_gripper_mode(0) :return: code code: See the API Code Documentation for details.
def set_gripper_position(self, pos, wait=False, speed=None, auto_enable=False, timeout=None, **kwargs):
Set the gripper position
:param pos: pos :param wait: wait or not, default is False :param speed: speed,unit:r/min :param auto_enable: auto enable or not, default is False :param timeout: wait time, unit:second, default is 10s :return: code code: See the API Code Documentation for details.
def set_gripper_speed(self, speed, **kwargs):
Set the gripper speed
:param speed: :return: code code: See the API Code Documentation for details.
def set_impedance(self, coord, c_axis, M, K, B, **kwargs):
Set all parameters of impedance control through the Six-axis Force Torque Sensor. Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:param coord: task frame. 0: base frame. 1: tool frame. :param c_axis: a 6d vector of 0s and 1s. 1 means that robot will be impedance in the corresponding axis of the task frame. :param M: mass. (kg) :param K: stiffness coefficient. :param B: damping coefficient. invalid. Note: the value is set to 2sqrt(MK) in controller. :return: code code: See the API Code Documentation for details.
def set_impedance_config(self, coord, c_axis):
Set impedance control parameters of impedance control through the Six-axis Force Torque Sensor. Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:param coord: task frame. 0: base frame. 1: tool frame. :param c_axis: a 6d vector of 0s and 1s. 1 means that robot will be impedance in the corresponding axis of the task frame. :return: code code: See the API Code Documentation for details.
def set_impedance_mbk(self, M, K, B, **kwargs):
Set mbk parameters of impedance control through the Six-axis Force Torque Sensor. Note: 1. only available if firmware_version >= 1.8.3 2. the Six-axis Force Torque Sensor is required (the third party is not currently supported)
:param M: mass. (kg) :param K: stiffness coefficient. :param B: damping coefficient. invalid. Note: the value is set to 2sqrt(MK) in controller. :return: code code: See the API Code Documentation for details.
def set_initial_point(self, point):
Set the initial point
:param point: initial point, [J1, J2, ..., J7]
:return: code code: See the API Code Documentation for details.
def set_joint_jerk(self, jerk, is_radian=None):
Set the jerk of Joint space Note: 1. Do not use if not required 2. If not saved, it will be lost after reboot 3. The save_conf interface can record the current settings and will not be lost after the restart. 4. The clean_conf interface can restore system default settings
:param jerk: jerk (°/s^3 or rad/s^3) :param is_radian: the jerk in radians or not, default is self.default_is_radian :return: code code: See the API Code Documentation for details.
def set_joint_maxacc(self, acc, is_radian=None):
Set the max acceleration of Joint space
Note: 1. Do not use if not required 2. If not saved, it will be lost after reboot 3. The save_conf interface can record the current settings and will not be lost after the restart. 4. The clean_conf interface can restore system default settings
:param acc: max acceleration (°/s^2 or rad/s^2) :param is_radian: the jerk in radians or not, default is self.default_is_radian :return: code code: See the API Code Documentation for details.
def set_linear_track_back_origin(self, wait=True, **kwargs):
Set the linear track go back to the origin position Note: 1. only available if firmware_version >= 1.8.0 2. only useful when powering on for the first time 3. this operation must be performed at the first power-on :param wait: wait to motion finish or not, default is True :param kwargs: auto_enable: enable after back to origin or not, default is True :return: code code: See the API Code Documentation for details.
def set_linear_track_