Skip to content

Repository files navigation

xArm-Python-SDK

PyPI Downloads

Overview

xArm Python SDK

Caution

  • Please keep away from the robot arm to avoid personal injury or equipment damage.
  • Make sure to do a safety assessment before moving to prevent collisions.
  • Protect the arm before unlocking the joint.

Installation

you can run examples without installation. Only Python 3 is supported.

  • Install from source code
    • download
      git clone https://github.com/xArm-Developer/xArm-Python-SDK.git
      cd xArm-Python-SDK
    • install
      • install with build
        pip install build
        python -m build
        pip install dist/xarm_python_sdk-1.16.0-py3-none-any.whl
      • install with source code
        pip install .
  • Install from pypi
    pip install xarm-python-sdk

Doc

Update Summary

  • 1.18.3/1.18.4

    • Added BytesData for data conversion
    • Added data structure for report data
    • Update the reported data for port 30002
    • Increase execution speed by adding parameter to reduce the number of checks performed by the gripper APIs
  • 1.17.0/1.17.1

    • Change some API names
  • 1.16.0

    • Added parameter to support get raw data of the Six-axis Force Torque Sensor
    • Added an interface to control xArm Gripper G2
    • Optimize the interface for controlling BIO Gripper G2
    • Extend the get_joint_states interface
  • 1.15.0

    • Added the Six-axis Force Torque Sensor collision detection related interfaces
    • Added support for the new version of BIO Gripper control interface
  • 1.14.7

    • Fixed the problem that single joint or direction movement fails in some cases (valid from firmware 2.5.0)
    • Added standard ModbusTcp client and Gcode client
    • GPIO control supports immediate execution
    • Support new version of vacuum gripper
    • Support the studio-2.5.0 blockly project conversion to python

API Change List

OLD API NAMENEW API NAMESDK VERSION
set_tgpio_modbus_timeoutset_rs485_timeout1.17.1
get_tgpio_modbus_timeoutget_rs485_timeout1.17.1
set_tgpio_modbus_baudrateset_rs485_baudrate1.17.1
get_tgpio_modbus_baudrateget_rs485_baudrate1.17.1
getset_tgpio_modbus_dataset_rs485_data1.17.1
set_impedanceset_ft_sensor_admittance_parameters1.17.0
set_impedance_mbkset_ft_sensor_admittance_parameters1.17.0
set_impedance_configset_ft_sensor_admittance_parameters1.17.0
set_force_control_pidset_ft_sensor_force_parameters1.17.0
config_force_controlset_ft_sensor_force_parameters1.17.0
ft_sensor_set_zeroset_ft_sensor_zero1.17.0
ft_sensor_iden_loadiden_ft_sensor_load_offset1.17.0
ft_sensor_cali_loadset_ft_sensor_load_offset1.17.0
ft_sensor_enableset_ft_sensor_enable1.17.0
ft_sensor_app_setset_ft_sensor_mode1.17.0
ft_sensor_app_getget_ft_sensor_mode1.17.0
get_linear_track_registersget_linear_motor_registers1.17.0
get_linear_track_posget_linear_motor_pos1.17.0
get_linear_track_statusget_linear_motor_status1.17.0
get_linear_track_errorget_linear_motor_error1.17.0
get_linear_track_is_enabledget_linear_motor_is_enabled1.17.0
get_linear_track_on_zeroget_linear_motor_on_zero1.17.0
get_linear_track_sciget_linear_motor_sci1.17.0
get_linear_track_scoget_linear_motor_sco1.17.0
clean_linear_track_errorclean_linear_motor_error1.17.0
set_linear_track_enableset_linear_motor_enable1.17.0
set_linear_track_speedset_linear_motor_speed1.17.0
set_linear_track_back_originset_linear_motor_back_origin1.17.0
set_linear_track_posset_linear_motor_pos1.17.0
set_linear_track_stopset_linear_motor_stop1.17.0
shutdown_systemsystem_control1.13.3
get_suction_cupget_vacuum_gripper1.5.0
set_suction_cupset_vacuum_gripper1.5.0
get_ikget_inverse_kinematics1.0.0
get_fkget_forward_kinematics1.0.0
set_sleep_timeset_pause_time1.0.0
get_gpio_digitalget_tgpio_digital1.0.0
set_gpio_digitalset_tgpio_digital1.0.0
get_gpio_analogget_tgpio_analog1.0.0

Before running the example, please modify the IP in robot.conf to corresponding IP you want to control.

  • 2001-move_joint --> xarm5 --- xarm6 --- xarm7
  • 2002-move_joint --> xarm5 --- xarm6 --- xarm7
  • 2003-move_joint --> xarm5 --- xarm6 --- xarm7
  • 2004-move_joint --> xarm5 --- xarm6 --- xarm7
  • 2005-move_arc_joint --> xarm5 --- xarm6 --- xarm7
  • Import

    fromxarm.wrapperimportXArmAPIarm=XArmAPI('COM5')
    arm=XArmAPI('192.168.1.113')
    arm=XArmAPI('192.168.1.113', do_not_open=False)
    arm=XArmAPI('192.168.1.113', is_radian=False)
  • Connect/Disconnect

    arm.connect(...)
    arm.disconnect()
  • Move

    arm.reset(...)
    arm.set_position(...)
    arm.set_servo_angle(...)
    arm.set_servo_angle_j(...)
    arm.set_servo_cartesian(...)
    arm.move_gohome(...)
    arm.move_circle(...)
    arm.emergency_stop()
    arm.set_position_aa(...)
    arm.set_servo_cartesian_aa(...)
    arm.vc_set_joint_velocity(...)
    arm.vc_set_cartesian_velocity(...)
  • Set

    arm.set_servo_attach(...)
    arm.set_servo_detach(...)
    arm.set_state(...)
    arm.set_mode(...)
    arm.motion_enable(...)
    arm.set_pause_time(...)
  • Get

    arm.get_version()
    arm.get_state()
    arm.get_is_moving()
    arm.get_cmdnum()
    arm.get_err_warn_code()
    arm.get_position(...)
    arm.get_servo_angle(...)
    arm.get_position_aa(...)
    arm.get_pose_offset(...)
  • Setting

    arm.set_tcp_offset(...)
    arm.set_tcp_jerk(...)
    arm.set_tcp_maxacc(...)
    arm.set_joint_jerk(...)
    arm.set_joint_maxacc(...)
    arm.set_tcp_load(...)
    arm.set_collision_sensitivity(...)
    arm.set_teach_sensitivity(...)
    arm.set_gravity_direction(...)
    arm.config_tgpio_reset_when_stop(...)
    arm.config_cgpio_reset_when_stop(...)
    arm.set_report_tau_or_i(...)
    arm.set_self_collision_detection(...)
    arm.set_collision_tool_model(...)
    arm.clean_conf()
    arm.save_conf()
  • Gripper/Gripper G2

    arm.set_gripper_enable(...)
    arm.set_gripper_mode(...)
    arm.set_gripper_speed(...)
    arm.set_gripper_position(...)
    arm.get_gripper_position()
    arm.get_gripper_err_code()
    arm.clean_gripper_error()
    # only Gripper G2arm.get_gripper_g2_position()
    arm.set_gripper_g2_position(...)
  • BIO Gripper

    arm.set_bio_gripper_enable(...)
    arm.set_bio_gripper_speed(...)
    arm.open_bio_gripper(...)
    arm.close_bio_gripper(...)
    arm.get_bio_gripper_status()
    arm.get_bio_gripper_error()
    arm.clean_bio_gripper_error()
    # only BIO Gripper G2arm.get_bio_gripper_g2_position()
    arm.set_bio_gripper_g2_position(...)
  • RobotIQ Gripper

    arm.robotiq_reset()
    arm.robotiq_set_activate(...)
    arm.robotiq_set_position(...)
    arm.robotiq_open(...)
    arm.robotiq_close(...)
    arm.robotiq_get_status(...)
  • Modbus of the RS485

    arm.set_rs485_timeout(...)
    arm.get_rs485_timeout(...)
    arm.set_rs485_baudrate(...)
    arm.get_rs485_baudrate(...)
    arm.set_rs485_data(...)
  • GPIO

    # Tool GPIOarm.get_tgpio_digital(...)
    arm.set_tgpio_digital(...)
    arm.get_tgpio_analog(...)
    arm.set_tgpio_digital_with_xyz(...)
    # Controller GPIOarm.get_cgpio_digital(...)
    arm.get_cgpio_analog(...)
    arm.set_cgpio_digital(...)
    arm.set_cgpio_analog(...)
    arm.set_cgpio_digital_input_function(...)
    arm.set_cgpio_digital_output_function(...)
    arm.get_cgpio_state()
    arm.set_cgpio_digital_with_xyz(...)
    arm.set_cgpio_analog_with_xyz(...)
  • Linear Motor

    arm.get_linear_motor_pos()
    arm.get_linear_motor_status()
    arm.get_linear_motor_error()
    arm.get_linear_motor_is_enabled()
    arm.get_linear_motor_on_zero()
    arm.get_linear_motor_sci()
    arm.get_linear_motor_sco()
    arm.clean_linear_motor_error(...)
    arm.set_linear_motor_enable(...)
    arm.set_linear_motor_speed(...)
    arm.set_linear_motor_back_origin(...)
    arm.set_linear_motor_pos(...)
    arm.set_linear_motor_stop(...)
  • FT Sensor

    arm.set_ft_sensor_enable(...)
    arm.set_ft_sensor_mode(...)
    arm.get_ft_sensor_mode(...)
    arm.set_ft_sensor_zero(...)
    arm.iden_ft_sensor_load_offset(...)
    arm.set_ft_sensor_load_offset(...)
    arm.set_ft_sensor_admittance_parameters(...)
    arm.set_ft_sensor_force_parameters(...)
    arm.get_ft_sensor_data(...)
    arm.get_ft_sensor_config(...)
    arm.get_ft_sensor_error(...)
  • Other

    arm.set_pause_time(...)
    arm.system_control(...)
    arm.clean_error()
    arm.clean_warn()
    arm.set_counter_reset()
    arm.set_counter_increase(...)
  • Register/Release

    arm.register_report_callback(...)
    arm.register_report_location_callback(...)
    arm.register_connect_changed_callback(callback)
    arm.register_state_changed_callback(callback)
    arm.register_mode_changed_callback(callback)
    arm.register_mtable_mtbrake_changed_callback(callback)
    arm.register_error_warn_changed_callback(callback)
    arm.register_cmdnum_changed_callback(callback)
    arm.register_temperature_changed_callback(callback)
    arm.register_count_changed_callback(callback)
    arm.release_report_callback(callback)
    arm.release_report_location_callback(callback)
    arm.release_connect_changed_callback(callback)
    arm.release_state_changed_callback(callback)
    arm.release_mode_changed_callback(callback)
    arm.release_mtable_mtbrake_changed_callback(callback)
    arm.release_error_warn_changed_callback(callback)
    arm.release_cmdnum_changed_callback(callback)
    arm.release_temperature_changed_callback(callback)
    arm.release_count_changed_callback(callback)
  • Property

    arm.connectedarm.default_is_radianarm.versionarm.positionarm.last_used_positionarm.tcp_speed_limitarm.tcp_acc_limitarm.last_used_tcp_speedarm.last_used_tcp_accarm.anglesarm.joint_speed_limitarm.joint_acc_limitarm.last_used_anglesarm.last_used_joint_speedarm.last_used_joint_accarm.tcp_offsetarm.statearm.modearm.joints_torquearm.tcp_loadarm.collision_sensitivityarm.teach_sensitivityarm.motor_brake_statesarm.motor_enable_statesarm.has_err_warnarm.has_errorarm.has_warnarm.error_codearm.warn_codearm.cmd_numarm.device_typearm.axisarm.gravity_directionarm.gpio_reset_configarm.countarm.temperaturesarm.voltagesarm.currentsarm.cgpio_states

About

Python SDK for UFACTORY robots, 850, xArm5/6/7, and Lite6.

Topics

Resources

Stars

320 stars

Watchers

17 watching

Forks

Releases

Packages

Used by

Contributors

Languages