xArm-C++-SDK API Documentation (V1.18.1)

May 21, 2026 · View on GitHub

Contents

Constructor

XArmAPI(const std::string &port = "", bool is_radian = DEFAULT_IS_RADIAN, bool do_not_open = false, bool check_tcp_limit = true, bool check_joint_limit = true, bool check_cmdnum_limit = true, bool check_robot_sn = false, bool check_is_ready = true, bool check_is_pause = true, int max_callback_thread_count = -1, int max_cmdnum = 512, int init_axis = 7, bool debug = false, std::string report_type = "rich", bool baud_checkset = true);
ParameterDescription
portip-address(such as "192.168.1.185")
Note: this parameter is required if do_not_open is false
is_radianset the default unit is radians or not, default is false
do_not_opendo not open, default is false. if true, call connect() manually later
check_tcp_limitreserved, whether to check tcp limit, default is true
check_joint_limitreserved, whether to check joint limit, default is true
check_cmdnum_limitwhether to check command num limit, default is true
check_robot_snwhether to check robot sn, default is false
check_is_readywhether to check robot ready state before motion, default is true
Note: only available if firmware version < 1.5.20
check_is_pausewhether to check robot pause state, default is true
max_callback_thread_countmax callback thread count, default is -1
greater than 0: maximum number of callback worker threads
equal to 0: callbacks are not dispatched by worker thread
less than 0: no limit on callback worker threads
max_cmdnummax command cache threshold, default is 512
Note: only available in the param check_cmdnum_limit is true

Properties

NameTypeDescription
stateintstate
modeintmode
cmd_numintcmd cache count
joints_torquefp32[7]joints torque, fp32[7]{servo-1, ..., servo-7}
motor_brake_statesbool[8]motor brake states, bool[8]{servo-1, ..., servo-7, reserved}
motor_enable_statesbool[8]motor enable states, bool[8]{servo-1, ..., servo-7, reserved}
error_codeinterror code
warn_codeintwarn code
tcp_loadfp32[4]tcp load, fp32[4]{weight, x, y, z}
collision_sensitivityintcollision sensitivity
teach_sensitivityintteach sensitivity
device_typeintdevice type
axisintrobot axis
master_idint-
slave_idint-
motor_tidint-
motor_fidint-
versionunsigned char[30]version
snunsigned char[40]sn
version_numberint[3]version number
tcp_jerkfp32tcp jerk
joint_jerkfp32joint jerk
rot_jerkfp32rot jerk
max_rot_accfp32max rot acc
tcp_speed_limitfp32[2]fp32[2]{min, max}
tcp_acc_limitfp32[2]fp32[2]{min, max}
last_used_tcp_speedfp32-
last_used_tcp_accfp32-
anglesfp32[7]fp32[7]{servo-1, ..., servo-7}
last_used_anglesfp32[7]fp32[7]{servo-1, ..., servo-7}
joint_speed_limitfp32[2]fp32[2]{min, max}
joint_acc_limitfp32[2]fp32[2]{min, max}
last_used_joint_speedfp32-
last_used_joint_accfp32-
positionfp32[6]fp32[6]{x, y, z, roll, pitch, yaw}
position_aafp32[6]fp32[6]{x, y, z, rx, ry, rz}
last_used_positionfp32[6]fp32[6]{x, y, z, roll, pitch, yaw}
tcp_offsetfp32[6]fp32[6]{x, y, z, roll, pitch, yaw}
gravity_directionfp32[3]fp32[3]{x_direction, y_direction, z_direction}
realtime_tcp_speedfp32-
realtime_joint_speedsfp32[7]-
reduced_tcp_boundaryint[6]-
reduced_max_tcp_speedfp32-
reduced_max_joint_sppedfp32-
reduced_joint_limitsfp32[14]-
is_reduced_modebool-
is_fence_modebool-
is_report_currentbool-
is_approx_motionbool-
is_cart_continuousbool-
is_collision_reboundbool-
ft_sensor_is_enablebool-
cgpio_alarm_codeint-
monitor_device_typeint-
monitor_device_stateint-
monitor_device_posint-
monitor_device_speedint-
monitor_device_currentint-
world_offsetfp32[6]fp32[6]{x, y, z, roll, pitch, yaw}
temperaturesfp32[7]-
countint-
iden_progressint-
gpio_reset_configunsigned char[2]unsigned char[2]{cgpio_reset_enable, tgpio_reset_enable}
ft_ext_forcefp32[6]-
ft_raw_forcefp32[6]-
default_is_radianbool-
corestd::shared_ptr<UxbusCmd>-
robotiq_statusstruct RobotIqStatus-
linear_motor_statusLinearMotorStatus-
voltagesfp32[7]fp32[7]{servo-1, ..., servo-7}
currentsfp32[7]fp32[7]{servo-1, ..., servo-7}
is_simulation_robotint0: off, 1: on
is_collision_detectionint0: off, 1: on
collision_tool_typeint-
collision_model_paramsfp32[6]fp32[6]{...}
cgpio_stateint-
cgpio_codeint-
cgpio_input_digitalsint[2]int[2]{ digital-input-functional-gpio-state, digital-input-configuring-gpio-state }
cgpio_output_digitalsint[2]int[2]{ digital-output-functional-gpio-state, digital-output-configuring-gpio-state }
cgpio_input_analogsfp32[2]fp32[2] {analog-1-input-value, analog-2-input-value}
cgpio_output_analogsfp32[2]fp32[2] {analog-1-output-value, analog-2-output-value}
cgpio_input_confint[16]int[16]{ CI0-conf, ... CI7-conf }
cgpio_output_confint[16]int[16]{ CO0-conf, ... CO7-conf }
only_check_resultunsigned char-

Methods

has_err_warn()

bool has_err_warn(void);

xArm has error/warn or not, only available in socket way @param port: ip-address(such as "192.168.1.185")      Note: this parameter is required if do_not_open is false @param is_radian: set the default unit is radians or not, default is false @param do_not_open: do not open, default is false. if true, call connect() manually later @param check_tcp_limit: reserved, whether to check tcp limit, default is true @param check_joint_limit: reserved, whether to check joint limit, default is true @param check_cmdnum_limit: whether to check command num limit, default is true @param check_robot_sn: whether to check robot sn, default is false @param check_is_ready: whether to check robot ready state before motion, default is true     Note: only available if firmware version < 1.5.20 @param check_is_pause: whether to check robot pause state, default is true @param max_callback_thread_count: max callback thread count, default is -1      greater than 0: maximum number of callback worker threads      equal to 0: callbacks are not dispatched by worker thread      less than 0: no limit on callback worker threads @param max_cmdnum: max command cache threshold, default is 512     Note: only available in the param check_cmdnum_limit is true     /      XArmAPI(const std::string &port = "",      bool is_radian = DEFAULT_IS_RADIAN,      bool do_not_open = false,      bool check_tcp_limit = true,      bool check_joint_limit = true,      bool check_cmdnum_limit = true,      bool check_robot_sn = false,      bool check_is_ready = true,      bool check_is_pause = true,      int max_callback_thread_count = -1,      int max_cmdnum = 512,      int init_axis = 7,      bool debug = false,      std::string report_type = "rich",      bool baud_checkset = true);      ~XArmAPI(void);

has_error()

bool has_error(void);

xArm has error or not, only available in socket way

has_warn()

bool has_warn(void);

xArm has warn or not, only available in socket way

is_connected()

bool is_connected(void);

xArm is connected or not

is_lite6()

bool is_lite6(void);

Robot is lite6 or not

is_850()

bool is_850(void);

Robot is UF850 or not

is_reported()

bool is_reported(void);

xArm is reported or not, only available in socket way

connect()

int connect(const std::string &port = "");

Connect to xArm @param port: port name or the ip address

disconnect()

void disconnect(void);

Disconnect

get_version()

int get_version(unsigned char version[40]);

Get the xArm version @param version: @return: see the API Code Documentation for details.

get_robot_sn()

int get_robot_sn(unsigned char robot_sn[40]);

Get the xArm sn @param robot_sn: @return: see the API Code Documentation for details.

get_state()

int get_state(int *state);

Get the xArm state @param state: the state of xArm      1: in motion      2: sleeping      3: suspended      4: stopping @return: see the API Code Documentation for details.

system_control()

int system_control(int value = 1);

Control the xArm controller system @param value:      1: shutdown      2: reboot @return: see the API Code Documentation for details.

get_cmdnum()

int get_cmdnum(int *cmdnum);

Get the cmd count in cache @return: see the API Code Documentation for details.

get_err_warn_code()

int get_err_warn_code(int err_warn[2]);

Get the controller error and warn code @return: see the API Code Documentation for details.

get_position()

int get_position(fp32 pose[6]);

Get the cartesian position @param pose: the position of xArm, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @return: see the API Code Documentation for details.

get_servo_angle()

int get_servo_angle(fp32 angles[7], bool is_real = false);

Get the servo angle @param angles: the angles of the servos, like [servo-1, ..., servo-7]      if default_is_radian is true, the value of servo-1/.../servo-7 should be in radians      if default_is_radian is false, The value of servo-1/.../servo-7 should be in degrees @return: see the API Code Documentation for details.

get_joint_states()

int get_joint_states(fp32 jposition[7], fp32 velocity[7], fp32 effort[7], int num = 3);

Get the joint states @param position: the angles of the joints, like [angle-1, ..., angle-7]      if default_is_radian is true, the value of angle-1/.../angle-7 should be in radians      if default_is_radian is false, The value of angle-1/.../angle-7 should be in degrees @param velocity: the velocities of the joints, like [velo-1, ..., velo-7]      if default_is_radian is true, the value of velo-1/.../velo-7 should be in radians      if default_is_radian is false, The value of velo-1/.../velo-7 should be in degrees @param effort: the efforts of the joints, like [effort-1, ..., effort-7] @return: see the API Code Documentation for details.

motion_enable()

int motion_enable(bool enable, int servo_id = 8);

Motion enable @param enable: enable or not @param servo_id: servo id, 1-8, 8(enable/disable all servo) @return: see the API Code Documentation for details.

set_state()

int set_state(int state);

Set the xArm state @param state: state      0: motion state      3: pause state      4: stop state      6: deceleration stop state @return: see the API Code Documentation for details.

set_mode()

int set_mode(int mode, int detection_param = 0);

Set the xArm mode @param mode: mode      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 @param detection_param: teaching detection parameters, default is 0      0: turn on motion detection      1: turn off motion detection      Note:      1. only available if firmware_version >= 1.10.1      2. only available if set_mode(2) @return: see the API Code Documentation for details.

set_servo_attach()

int set_servo_attach(int servo_id);

Attach the servo @param servo_id: servo id, 1-8, 8(attach all servo) @return: see the API Code Documentation for details.

set_servo_detach()

int set_servo_detach(int servo_id);

Detach the servo, be sure to do protective work before unlocking to avoid injury or damage. @param servo_id: servo id, 1-8, 8(detach all servo) @return: see the API Code Documentation for details.

clean_error()

int clean_error(void);

Clean the controller error, need to be manually enabled motion and set state after clean error @return: see the API Code Documentation for details.

clean_warn()

int clean_warn(void);

Clean the controller warn @return: see the API Code Documentation for details.

set_pause_time()

int set_pause_time(fp32 sltime);

Set the arm pause time, xArm will pause sltime second @param sltime: sleep second @return: see the API Code Documentation for details.

set_collision_sensitivity()

int set_collision_sensitivity(int sensitivity, bool wait = true);

Set the sensitivity of collision @param sensitivity: sensitivity value, 0~5 @param wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting @return: see the API Code Documentation for details.

set_teach_sensitivity()

int set_teach_sensitivity(int sensitivity, bool wait = true);

Set the sensitivity of drag and teach @param sensitivity: sensitivity value, 1~5 @param wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting @return: see the API Code Documentation for details.

set_gravity_direction()

int set_gravity_direction(fp32 gravity_dir[3], bool wait = true);

Set the gravity direction for proper torque compensation and collision detection. @param gravity_dir: Gravity direction vector [x, y, z], e.g., [0, 0, -1] for a floor-mounted arm. @param wait: Whether to wait for the robotic arm to stop or clear all previous queued commands before applying the setting. @return: see the API Code Documentation for details.

clean_conf()

int clean_conf(void);

Clean current config and restore system default settings @return: see the API Code Documentation for details.

save_conf()

int save_conf(void);

Save config @return: see the API Code Documentation for details.

set_position()

int set_position(fp32 pose[6], fp32 radius = -1, fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0, bool wait = false, fp32 timeout = NO_TIMEOUT, bool relative = false, unsigned char motion_type = 0);
int set_position(fp32 pose[6], fp32 radius, bool wait, fp32 timeout = NO_TIMEOUT, bool relative = false, unsigned char motion_type = 0);
int set_position(fp32 pose[6], bool wait, fp32 timeout = NO_TIMEOUT, bool relative = false, unsigned char motion_type = 0);

Set the position @param pose: position, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param radius: move radius, if radius is None or radius less than 0, will MoveLine, else MoveArcLine @param speed: move speed (mm/s, rad/s), default is this.last_used_tcp_speed @param mvacc: move acceleration (mm/s^2, rad/s^2), default is this.last_used_tcp_acc @param mvtime: reserved, 0 @param wait: whether to wait for the arm to complete, default is false @param timeout: maximum waiting time(unit: second), default is no timeout, only valid if wait is true @param relative: relative move or not      Note: only available if firmware_version >= 1.8.100 @param motion_type: motion planning type, default is 0      motion_type == 0: default, linear planning      motion_type == 1: prioritize linear planning, and turn to IK for joint planning when linear planning is not possible      motion_type == 2: direct transfer to IK using joint planning      Note:      1. only available if firmware_version >= 1.11.100      2. when motion_type is 1 or 2, linear motion cannot be guaranteed      3. once IK is transferred to joint planning, the given Cartesian velocity and acceleration are converted into joint velocity and acceleration according to the percentage      speed = speed / max_tcp_speed * max_joint_speed      acc = acc / max_tcp_acc * max_joint_acc      4. if there is no suitable IK, a C40 error will be triggered @return: see the API Code Documentation for details.

set_tool_position()

int set_tool_position(fp32 pose[6], fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0, bool wait = false, fp32 timeout = NO_TIMEOUT, fp32 radius = -1, unsigned char motion_type = 0);
int set_tool_position(fp32 pose[6], bool wait, fp32 timeout = NO_TIMEOUT, fp32 radius = -1, unsigned char motion_type = 0);

Movement relative to the tool coordinate system @param pose: the coordinate relative to the current tool coordinate system, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param speed: move speed (mm/s, rad/s), default is this.last_used_tcp_speed @param mvacc: move acceleration (mm/s^2, rad/s^2), default is this.last_used_tcp_acc @param mvtime: reserved, 0 @param wait: whether to wait for the arm to complete, default is false @param timeout: maximum waiting time(unit: second), default is no timeout, only valid if wait is true @param radius: move radius, if radius less than 0, will MoveToolLine, else MoveToolArcLine      Note: only available if firmware_version >= 1.11.100 @param motion_type: motion planning type, default is 0      motion_type == 0: default, linear planning      motion_type == 1: prioritize linear planning, and turn to IK for joint planning when linear planning is not possible      motion_type == 2: direct transfer to IK using joint planning      Note:      1. only available if firmware_version >= 1.11.100      2. when motion_type is 1 or 2, linear motion cannot be guaranteed      3. once IK is transferred to joint planning, the given Cartesian velocity and acceleration are converted into joint velocity and acceleration according to the percentage      speed = speed / max_tcp_speed * max_joint_speed      acc = acc / max_tcp_acc * max_joint_acc      4. if there is no suitable IK, a C40 error will be triggered @return: see the API Code Documentation for details.

set_servo_angle()

int set_servo_angle(fp32 angles[7], fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0, bool wait = false, fp32 timeout = NO_TIMEOUT, fp32 radius = -1, bool relative = false);
int set_servo_angle(fp32 angles[7], bool wait, fp32 timeout = NO_TIMEOUT, fp32 radius = -1, bool relative = false);
int set_servo_angle(int servo_id, fp32 angle, fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0, bool wait = false, fp32 timeout = NO_TIMEOUT, fp32 radius = -1, bool relative = false);
int set_servo_angle(int servo_id, fp32 angle, bool wait, fp32 timeout = NO_TIMEOUT, fp32 radius = -1, bool relative = false);

Set the servo angle @param angles: angles, like [servo-1, ..., servo-7]      if default_is_radian is true, the value of servo-1/.../servo-7 should be in radians      if default_is_radian is false, The value of servo-1/.../servo-7 should be in degrees @param servo_id: servo id, 1~7, specify the joint ID to set @param angle: servo angle, use with servo_id parameters @param speed: move speed (rad/s or °/s), default is this.last_used_joint_speed      if default_is_radian is true, the value of speed should be in radians      if default_is_radian is false, The value of speed should be in degrees @param acc: move acceleration (rad/s^2 or °/s^2), default is this.last_used_joint_acc      if default_is_radian is true, the value of acc should be in radians      if default_is_radian is false, The value of acc should be in degrees @param mvtime: reserved, 0 @param wait: whether to wait for the arm to complete, default is false @param timeout: maximum waiting time(unit: second), default is no timeout, only valid if wait is true @param radius: move radius, if radius less than 0, will MoveJoint, else MoveArcJoint      Note: the blending radius cannot be greater than the track length.      Note: only available if firmware_version >= 1.5.20 @param relative: relative move or not      Note: only available if firmware_version >= 1.8.100 @return: see the API Code Documentation for details.

set_servo_angle_j()

int set_servo_angle_j(fp32 angles[7], fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0);

Servo_j motion, execute only the last instruction, need to be set to servo motion mode(this.set_mode(1)) @param angles: angles, like [servo-1, ..., servo-7]      if default_is_radian is true, the value of servo-1/.../servo-7 should be in radians      if default_is_radian is false, The value of servo-1/.../servo-7 should be in degrees @param speed: reserved, move speed (rad/s or °/s)      if default_is_radian is true, the value of speed should be in radians      if default_is_radian is false, The value of speed should be in degrees @param acc: reserved, move acceleration (rad/s^2 or °/s^2)      if default_is_radian is true, the value of acc should be in radians      if default_is_radian is false, The value of acc should be in degrees @param mvtime: reserved, 0 @return: see the API Code Documentation for details.

set_servo_cartesian()

int set_servo_cartesian(fp32 pose[6], fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0, bool is_tool_coord = false);

Servo cartesian motion, execute only the last instruction, need to be set to servo motion mode(this.set_mode(1)) @param pose: position, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param speed: reserved, move speed (mm/s) @param mvacc: reserved, move acceleration (mm/s^2) @param mvtime: reserved, 0 @param is_tool_coord: is tool coordinate or not @return: see the API Code Documentation for details.

move_circle()

int move_circle(fp32 pose1[6], fp32 pose2[6], fp32 percent, fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0, bool wait = false, fp32 timeout = NO_TIMEOUT, bool is_tool_coord = false, bool is_axis_angle = false);

The motion calculates the trajectory of the space circle according to the three-point coordinates. @param pose1: cartesian position, [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param pose2: cartesian position, [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param percent: the percentage of arc length and circumference of the movement @param speed: move speed (mm/s, rad/s), default is this.last_used_tcp_speed @param mvacc: move acceleration (mm/s^2, rad/s^2), default is this.last_used_tcp_acc @param mvtime: 0, reserved @param wait: whether to wait for the arm to complete, default is false @param timeout: maximum waiting time(unit: second), default is 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 @return: see the API Code Documentation for details.

move_gohome()

int move_gohome(fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0, bool wait = false, fp32 timeout = NO_TIMEOUT);
int move_gohome(bool wait, fp32 timeout = NO_TIMEOUT);

Move to go home (Back to zero) @param speed: move speed (rad/s or °/s), default is 50 °/s      if default_is_radian is true, the value of speed should be in radians      if default_is_radian is false, The value of speed should be in degrees @param acc: move acceleration (rad/s^2 or °/s^2), default is 1000 °/s^2      if default_is_radian is true, the value of acc should be in radians      if default_is_radian is false, The value of acc should be in degrees @param mvtime: reserved, 0 @param wait: whether to wait for the arm to complete, default is false @param timeout: maximum waiting time(unit: second), default is no timeout, only valid if wait is true @return: see the API Code Documentation for details.

reset()

void reset(bool wait = false, fp32 timeout = NO_TIMEOUT);

Reset @param wait: whether to wait for the arm to complete, default is false @param timeout: maximum waiting time(unit: second), default is no timeout, only valid if wait is true @return: see the API Code Documentation for details.

emergency_stop()

void emergency_stop(void);

Emergency stop

set_tcp_offset()

int set_tcp_offset(fp32 pose_offset[6], bool wait = true);

Set the tool coordinate system offset at the end @param pose_offset: tcp offset, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting @return: see the API Code Documentation for details.

set_tcp_load()

int set_tcp_load(fp32 weight, fp32 center_of_gravity[3], bool wait = false);

Set the load @param weight: load weight (unit: kg) @param center_of_gravity: tcp load center of gravity, like [x(mm), y(mm), z(mm)] @param wait: whether to wait for the command to be executed or the robotic arm to stop @return: see the API Code Documentation for details.

set_tcp_jerk()

int set_tcp_jerk(fp32 jerk);

Set the translational jerk of Cartesian space @param jerk: jerk (mm/s^3) @return: see the API Code Documentation for details.

set_tcp_maxacc()

int set_tcp_maxacc(fp32 acc);

Set the max translational acceleration of Cartesian space @param acc: max acceleration (mm/s^2) @return: see the API Code Documentation for details.

set_joint_jerk()

int set_joint_jerk(fp32 jerk);

Set the jerk of Joint space @param jerk: jerk (°/s^3 or rad/s^3)      if default_is_radian is true, the value of jerk should be in radians      if default_is_radian is false, The value of jerk should be in degrees @return: see the API Code Documentation for details.

set_joint_maxacc()

int set_joint_maxacc(fp32 acc);

Set the max acceleration of Joint space @param acc: max acceleration (°/s^2 or rad/s^2)      if default_is_radian is true, the value of acc should be in radians      if default_is_radian is false, The value of acc should be in degrees @return: see the API Code Documentation for details.

get_inverse_kinematics()

int get_inverse_kinematics(fp32 pose[6], fp32 angles[7], bool limited = true, fp32 *ref_angles = nullptr);

Get inverse kinematics @param pose: source pose, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param angles: target angles, like [servo-1, ..., servo-7]      if default_is_radian is true, the value of servo-1/.../servo-7 should be in radians      if default_is_radian is false, The value of servo-1/.../servo-7 should be in degrees @param limited: the result is limited to within ±180° or not, default is true      1. only available if firmware_version >= 2.7.103 @param ref_angles: reference values for joint angles, like [servo-1, ..., servo-7]      1. only available if firmware_version >= 2.7.103      2. if default_is_radian is true, the value of servo-1/.../servo-7 should be in radians @return: see the API Code Documentation for details.

get_forward_kinematics()

int get_forward_kinematics(fp32 angles[7], fp32 pose[6]);

Get forward kinematics @param angles: source angles, like [servo-1, ..., servo-7]      if default_is_radian is true, the value of servo-1/.../servo-7 should be in radians      if default_is_radian is false, The value of servo-1/.../servo-7 should be in degrees @param pose: target pose, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @return: see the API Code Documentation for details.

is_tcp_limit()

int is_tcp_limit(fp32 pose[6], int *limit);

Check the tcp pose is in limit @param pose: pose, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param limit: 1: limit, 0: no limit @return: see the API Code Documentation for details.

is_joint_limit()

int is_joint_limit(fp32 angles[7], int *limit);

Check the joint is in limit @param angles: angles, like [servo-1, ..., servo-7]      if default_is_radian is true, the value of servo-1/.../servo-7 should be in radians      if default_is_radian is false, The value of servo-1/.../servo-7 should be in degrees @param limit: 1: limit, 0: no limit @return: see the API Code Documentation for details.

set_gripper_enable()

int set_gripper_enable(bool enable);

Set the gripper enable @param enable: enable or not @return: see the API Code Documentation for details.

set_gripper_mode()

int set_gripper_mode(int mode);

Set the gripper mode @param mode: 1: location mode, 2: speed mode(no use), 3: torque mode(no use) @return: see the API Code Documentation for details.

get_gripper_position()

int get_gripper_position(int *pos);
int get_gripper_position(fp32 *pos);

Get the gripper position (pulse) @param pos: used to store the results obtained @return: see the API Code Documentation for details.

get_gripper_g2_position()

int get_gripper_g2_position(int *pos);

Get the position (mm) of the xArm Gripper G2 @param pos: used to store the results obtained @return: see the API Code Documentation for details.

set_gripper_position()

int set_gripper_position(int pos, bool wait = false, fp32 timeout = 10, bool wait_motion = true);
int set_gripper_position(int pos, int speed, bool wait = false, fp32 timeout = 10, bool wait_motion = true);

Set the gripper position @param pos: gripper position @param wait: wait or not, default is false @param timeout: maximum waiting time(unit: second), default is 10s, only valid if wait is true @return: see the API Code Documentation for details.

set_gripper_g2_position()

int set_gripper_g2_position(int pos, int speed = 100, int force = 50, bool wait = false, fp32 timeout = 10, bool wait_motion = true);

Set the position of the xArm Gripper G2 @param pos: gripper pos between 0 and 84, (unit: mm) @param speed: gripper speed between 15 and 225, default is 100, (unit: mm/s) @param force: gripper force between 1 and 100, default is 50 @param wait: whether to wait for the bio gripper motion complete, default is false @param timeout: maximum waiting time(unit: second), default is 10s, only valid if wait is true @return: see the API Code Documentation for details.

set_gripper_speed()

int set_gripper_speed(int speed);

Set the gripper speed @param speed: @return: see the API Code Documentation for details.

get_gripper_status()

int get_gripper_status(int *status);

Get the status of the xArm Gripper @param status: used to store the results obtained      status & 0x03 == 0: stop state      status & 0x03 == 1: move state      status & 0x03 == 2: grasp state @return: see the API Code Documentation for details.

get_gripper_err_code()

int get_gripper_err_code(int *err);

Get the gripper error code @param err: used to store the results obtained @return: see the API Code Documentation for details.

clean_gripper_error()

int clean_gripper_error(void);

Clean the gripper error @return: see the API Code Documentation for details.

get_tgpio_digital()

int get_tgpio_digital(int *io0_value, int *io1_value, int *io2_value = nullptr, int *io3_value = nullptr, int *io4_value = nullptr);

Get the digital value of the Tool GPIO @param io0_value: the digital value of Tool GPIO-0 @param io1_value: the digital value of Tool GPIO-1 @param io2_value: the digital value of Tool GPIO-2 @param io3_value: the digital value of Tool GPIO-3 @param io4_value: the digital value of Tool GPIO-4 @return: see the API Code Documentation for details.

set_tgpio_digital()

int set_tgpio_digital(int ionum, int value, float delay_sec = 0, bool sync = true);

Set the digital value of the specified Tool GPIO @param ionum: ionum, 0 or 1 @param value: the digital value of the specified io @param delay_sec: delay effective time from the current start, in seconds, default is 0(effective immediately) @param sync: whether to execute in the motion queue, set to false to execute immediately(default is true)      1. only available if firmware_version >= 2.4.101      2. only available if delay_sec <= 0 @return: see the API Code Documentation for details.

get_tgpio_analog()

int get_tgpio_analog(int ionum, float *value);

Get the analog value of the specified Tool GPIO @param ionum: ionum, 0 or 1 @param value: the analog value of the specified tool io @return: see the API Code Documentation for details.

get_cgpio_digital()

int get_cgpio_digital(int *digitals, int *digitals2 = nullptr);

Get the digital value of the specified Controller GPIO @param digitals: the values of the controller GPIO(0-7) @param digitals2: the values of the controller GPIO(8-15) @return: see the API Code Documentation for details.

get_cgpio_analog()

int get_cgpio_analog(int ionum, fp32 *value);

Get the analog value of the specified Controller GPIO @param ionum: ionum, 0 or 1 @param value: the analog value of the specified controller io @return: see the API Code Documentation for details.

set_cgpio_digital()

int set_cgpio_digital(int ionum, int value, float delay_sec = 0, bool sync = true);

Set the digital value of the specified Controller GPIO @param ionum: ionum, 0 ~ 15 @param value: the digital value of the specified io @param delay_sec: delay effective time from the current start, in seconds, default is 0(effective immediately) @param sync: whether to execute in the motion queue, set to false to execute immediately(default is true)      1. only available if firmware_version >= 2.4.101      2. only available if delay_sec <= 0 @return: see the API Code Documentation for details.

set_cgpio_analog()

int set_cgpio_analog(int ionum, fp32 value, bool sync = true);

Set the analog value of the specified Controller GPIO @param ionum: ionum, 0 or 1 @param value: the analog value of the specified io @param sync: whether to execute in the motion queue, set to false to execute immediately(default is true)      1. only available if firmware_version >= 2.4.101 @return: see the API Code Documentation for details.

set_cgpio_digital_input_function()

int set_cgpio_digital_input_function(int ionum, int fun);

Set the digital input functional mode of the Controller GPIO @param ionum: 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: see the API Code Documentation for details.

set_cgpio_digital_output_function()

int set_cgpio_digital_output_function(int ionum, int fun);

Set the digital output functional mode of the specified Controller GPIO @param ionum: ionum, 0 ~ 15 @param fun: functional 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: see the API Code Documentation for details.

get_cgpio_state()

int get_cgpio_state(int *state, int *digit_io, fp32 *analog, int *input_conf, int *output_conf, int *input_conf2 = nullptr, int *output_conf2 = nullptr);

Get the state of the Controller GPIO @param state: controller gpio module state and controller gpio module error code      state[0]: controller gpio module state      state[0] == 0: normal      state[0] == 1:wrong      state[0] == 6:communication failure      state[1]: controller gpio module error code      state[1] == 0: normal      state[1] != 0:error code @param digit_io:      digit_io[0]: digital input functional gpio state      digit_io[1]: digital input configuring gpio state      digit_io[2]: digital output functional gpio state      digit_io[3]: digital output configuring gpio state @param analog:      analog[0]: analog-0 input value      analog[1]: analog-1 input value      analog[2]: analog-0 output value      analog[3]: analog-1 output value @param input_conf: digital(0-7) input functional info @param output_conf: digital(0-7) output functional info @param input_conf2: digital(8-15) input functional info @param output_conf2: digital(8-15) output functional info @return: see the API Code Documentation for details.

get_vacuum_gripper()

int get_vacuum_gripper(int *val, int hardware_version = 1);

Get the state of the Vacuum Gripper @param callback: nullptr means to release all callbacks;     /      int release_report_data_callback(void(*callback)(XArmReportData *report_data_ptr) = nullptr);      int release_report_data_callback(bool clear_all); @param callback: nullptr means to release all callbacks;     /      int release_report_location_callback(void(*callback)(const fp32 *pose, const fp32 *angles) = nullptr);      int release_report_location_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_connect_changed_callback(void(*callback)(bool connected, bool reported) = nullptr);      int release_connect_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_state_changed_callback(void(*callback)(int state) = nullptr);      int release_state_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_mode_changed_callback(void(*callback)(int mode) = nullptr);      int release_mode_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_mtable_mtbrake_changed_callback(void(*callback)(int mtable, int mtbrake) = nullptr);      int release_mtable_mtbrake_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_error_warn_changed_callback(void(*callback)(int err_code, int warn_code) = nullptr);      int release_error_warn_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_cmdnum_changed_callback(void(*callback)(int cmdnum) = nullptr);      int release_cmdnum_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_temperature_changed_callback(void(*callback)(const fp32 *temps) = nullptr);      int release_temperature_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_count_changed_callback(void(*callback)(int count) = nullptr);      int release_count_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_iden_progress_changed_callback(void(*callback)(int progress) = nullptr);      int release_iden_progress_changed_callback(bool clear_all); @param callback: nullptr means to release all callbacks for the same event     /      int release_feedback_callback(void(*callback)(unsigned char *feedback_data) = nullptr);      int release_feedback_callback(bool clear_all); @param val:      -1: Vacuum Gripper is off      0: Object not picked by vacuum gripper      1: Object picked by vacuum gripper @param hardware_version:      1: Plug-in Connection, default      2: Contact Connection @return: see the API Code Documentation for details.

set_vacuum_gripper()

int set_vacuum_gripper(bool on, bool wait = false, float timeout = 3, float delay_sec = 0, bool sync = true, int hardware_version = 1);

Set the Vacuum Gripper ON/OFF @param on: open vacuum gripper or not @param wait: wait or not, default is false @param timeout: maximum waiting time(unit: second), default is 10s, only valid if wait is true @param delay_sec: delay effective time from the current start, in seconds, default is 0(effective immediately) @param sync: whether to execute in the motion queue, set to false to execute immediately(default is true)      1. only available if firmware_version >= 2.4.101      2. only available if delay_sec <= 0 @param hardware_version:      1: Plug-in Connection, default      2: Contact Connection @return: see the API Code Documentation for details.

get_gripper_version()

int get_gripper_version(unsigned char versions[3]);

Get gripper version, only for debug @return: see the API Code Documentation for details.

get_servo_version()

int get_servo_version(unsigned char versions[3], int servo_id = 1);

Get servo version, only for debug @return: see the API Code Documentation for details.

get_tgpio_version()

int get_tgpio_version(unsigned char versions[3]);

Get tool gpio version, only for debug @return: see the API Code Documentation for details.

reload_dynamics()

int reload_dynamics(void);

Reload dynamics, only for debug @return: see the API Code Documentation for details.

set_reduced_mode()

int set_reduced_mode(bool on);

Turn on/off reduced mode @param on: on/off @return: see the API Code Documentation for details.

set_reduced_max_tcp_speed()

int set_reduced_max_tcp_speed(float speed);

Set the maximum tcp speed of the reduced mode @param speed: the maximum tcp speed @return: see the API Code Documentation for details.

set_reduced_max_joint_speed()

int set_reduced_max_joint_speed(float speed);

Set the maximum joint speed of the reduced mode @param speed: the maximum joint speed      if default_is_radian is true, the value of speed should be in radians      if default_is_radian is false, The value of speed should be in degrees @return: see the API Code Documentation for details.

get_reduced_mode()

int get_reduced_mode(int *mode);

Get reduced mode @param mode:      0: reduced mode is on      1: reduced mode is off @return: see the API Code Documentation for details.

get_reduced_states()

int get_reduced_states(int *on, int *xyz_list, float *tcp_speed, float *joint_speed, float jrange[14] = nullptr, int *fence_is_on = nullptr, int *collision_rebound_is_on = nullptr);

Get states of the reduced mode @param on:      0: reduced mode is on      1: reduced mode is off @param xyz_list: the tcp boundary, like [reduced_x_max, reduced_x_min, reduced_y_max, reduced_y_min, reduced_z_max, reduced_z_min], @param tcp_speed: the maximum tcp speed of reduced mode @param joint_speed: the maximum joint speed of reduced mode      if default_is_radian is true, the value of speed should be in radians      if default_is_radian is false, The value of speed should be in degrees @param jrange: the joint range of the reduced mode, like [joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]      if default_is_radian is true, the value of joint range should be in radians      if default_is_radian is false, The value of joint range should be in degrees @param fence_is_on:      0: safety mode is on      1: safety mode is off @param collision_rebound_is_on:      0: collision rebound is on      1: collision rebound is off @return: see the API Code Documentation for details.

set_reduced_tcp_boundary()

int set_reduced_tcp_boundary(int boundary[6]);

Set the boundary of the safety boundary mode @param boundary: like [x_max(mm), x_min(mm), y_max(mm), y_min(mm), z_max(mm), z_min(mm)] @return: see the API Code Documentation for details.

set_reduced_joint_range()

int set_reduced_joint_range(float jrange[14]);

Set the joint range of the reduced mode @param jrange: like [joint-1-min, joint-1-max, ..., joint-7-min, joint-7-max]      if default_is_radian is true, the value of joint range should be in radians      if default_is_radian is false, The value of joint range should be in degrees @return: see the API Code Documentation for details.

set_fence_mode()

int set_fence_mode(bool on);

Turn on/off safety mode @param on: on/off @return: see the API Code Documentation for details.

set_collision_rebound()

int set_collision_rebound(bool on);

Turn on/off collision rebound @param on: on/off @return: see the API Code Documentation for details.

set_world_offset()

int set_world_offset(float pose_offset[6], bool wait = true);

Set the base coordinate system offset at the end @param pose_offset: tcp offset, like [x(mm), y(mm), z(mm), roll(rad or °), pitch(rad or °), yaw(rad or °)]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, The value of roll/pitch/yaw should be in degrees @param wait: whether to wait for the robotic arm to stop or all previous queue commands to be executed or cleared before setting @return: see the API Code Documentation for details.

start_record_trajectory()

int start_record_trajectory(void);

Start trajectory recording, only in teach mode, so you need to set joint teaching mode before. @return: see the API Code Documentation for details.

stop_record_trajectory()

int stop_record_trajectory(const char* filename = nullptr);

Stop trajectory recording @param filename: the name to save      If the filename is nullptr, just stop recording, do not save, you need to manually call save_record_trajectory save before changing the mode. otherwise it will be lost      the trajectory is saved in the controller box.      this action will overwrite the trajectory with the same name      empty the trajectory in memory after saving, so repeated calls will cause the recorded trajectory to be covered by an empty trajectory. @return: see the API Code Documentation for details.

save_record_trajectory()

int save_record_trajectory(const char* filename, float timeout = 5);

Save the trajectory you just recorded @param filename: the name to save      the trajectory is saved in the controller box.      this action will overwrite the trajectory with the same name      empty the trajectory in memory after saving, so repeated calls will cause the recorded trajectory to be covered by an empty trajectory. @return: see the API Code Documentation for details.

load_trajectory()

int load_trajectory(const char* filename, float timeout = NO_TIMEOUT);

Load the trajectory @param filename: the name of the trajectory to load @param timeout: the maximum timeout waiting for loading to complete, default is 10 seconds. @return: see the API Code Documentation for details.

playback_trajectory()

int playback_trajectory(int times = 1, const char* filename = nullptr, bool wait = false, int double_speed = 1);

Playback trajectory @param times: number of playbacks. @param filename: the name of the trajectory to play back      if filename is nullptr, 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: see the API Code Documentation for details.

get_trajectory_rw_status()

int get_trajectory_rw_status(int *status);

Get trajectory read/write status @param status:      0: no read/write      1: loading      2: load success      3: load failed      4: saving      5: save success      6: save failed @return: see the API Code Documentation for details.

set_counter_reset()

int set_counter_reset(void);

Reset counter value @return: see the API Code Documentation for details.

set_counter_increase()

int set_counter_increase(void);

Set counter plus 1 @return: see the API Code Documentation for details.

set_tgpio_digital_with_xyz()

int set_tgpio_digital_with_xyz(int ionum, int value, float xyz[3], float tol_r);

Set the digital value of the specified Tool GPIO when the robot has reached the specified xyz position @param ionum: 0 or 1 @param value: value @param xyz: position xyz, as [x, y, z] @param tol_r: fault tolerance radius @return: see the API Code Documentation for details.

set_cgpio_digital_with_xyz()

int set_cgpio_digital_with_xyz(int ionum, int value, float xyz[3], float tol_r);

Set the digital value of the specified Controller GPIO when the robot has reached the specified xyz position @param ionum: 0 ~ 7 @param value: value @param xyz: position xyz, as [x, y, z] @param tol_r: fault tolerance radius @return: see the API Code Documentation for details.

set_cgpio_analog_with_xyz()

int set_cgpio_analog_with_xyz(int ionum, float value, float xyz[3], float tol_r);

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, 0~10.0 @param xyz: position xyz, as [x, y, z] @param tol_r: fault tolerance radius @return: see the API Code Documentation for details.

config_tgpio_reset_when_stop()

int config_tgpio_reset_when_stop(bool on_off);

Config the Tool GPIO reset the digital output when the robot is in stop state @param on_off: true/false @return: see the API Code Documentation for details.

config_cgpio_reset_when_stop()

int config_cgpio_reset_when_stop(bool on_off);

Config the Controller GPIO reset the digital output when the robot is in stop state @param on_off: true/false @return: see the API Code Documentation for details.

set_position_aa()

int set_position_aa(fp32 pose[6], fp32 speed = 0, fp32 acc = 0, fp32 mvtime = 0, bool is_tool_coord = false, bool relative = false, bool wait = false, fp32 timeout = NO_TIMEOUT, fp32 radius = -1, unsigned char motion_type = 0);
int set_position_aa(fp32 pose[6], bool is_tool_coord, bool relative = false, bool wait = false, fp32 timeout = NO_TIMEOUT, fp32 radius = -1, unsigned char motion_type = 0);

Set the pose represented by the axis angle pose @param pose: the axis angle pose, like [x(mm), y(mm), z(mm), rx(rad or °), ry(rad or °), rz(rad or °)]      if default_is_radian is true, the value of rx/ry/rz should be in radians      if default_is_radian is false, The value of rx/ry/rz should be in degrees @param speed: move speed (mm/s, rad/s), default is this.last_used_tcp_speed @param mvacc: move acceleration (mm/s^2, rad/s^2), default is this.last_used_tcp_acc @param mvtime: reserved, 0 @param is_tool_coord: is tool coordinate or not, if it is true, the relative parameter is no longer valid @param relative: relative move or not @param wait: whether to wait for the arm to complete, default is false @param timeout: maximum waiting time(unit: second), default is no timeout, only valid if wait is true @param radius: move radius, if radius less than 0, will MoveLineAA, else MoveArcLineAA      Note: only available if firmware_version >= 1.11.100 @param motion_type: motion planning type, default is 0      motion_type == 0: default, linear planning      motion_type == 1: prioritize linear planning, and turn to IK for joint planning when linear planning is not possible      motion_type == 2: direct transfer to IK using joint planning      Note:      1. only available if firmware_version >= 1.11.100      2. when motion_type is 1 or 2, linear motion cannot be guaranteed      3. once IK is transferred to joint planning, the given Cartesian velocity and acceleration are converted into joint velocity and acceleration according to the percentage      speed = speed / max_tcp_speed * max_joint_speed      acc = acc / max_tcp_acc * max_joint_acc      4. if there is no suitable IK, a C40 error will be triggered @return: see the API Code Documentation for details.

set_servo_cartesian_aa()

int set_servo_cartesian_aa(fp32 pose[6], fp32 speed = 0, fp32 acc = 0, bool is_tool_coord = false, bool relative = false);
int set_servo_cartesian_aa(fp32 pose[6], bool is_tool_coord, bool relative = false);

Set the servo cartesian represented by the axis angle pose, execute only the last instruction, need to be set to servo motion mode(self.set_mode(1)) @param pose: the axis angle pose, like [x(mm), y(mm), z(mm), rx(rad or °), ry(rad or °), rz(rad or °)]      if default_is_radian is true, the value of rx/ry/rz should be in radians      if default_is_radian is false, The value of rx/ry/rz should be in degrees @param speed: reserved, move speed (mm/s) @param mvacc: reserved, move acceleration (mm/s^2) @param is_tool_coord: is tool coordinate or not @param relative: relative move or not @return: see the API Code Documentation for details.

get_pose_offset()

int get_pose_offset(float pose1[6], float pose2[6], float offset[6], int orient_type_in = 0, int orient_type_out = 0);

Calculate the pose offset of two given points @param pose1: position, like [x(mm), y(mm), z(mm), roll/rx(rad or °), pitch/ry(rad or °), yaw/rz(rad or °)]      if default_is_radian is true, the value of roll/rx/pitch/ry/yaw/rz should be in radians      if default_is_radian is false, The value of roll/rx/pitch/ry/yaw/rz should be in degrees @param pose2: position, like [x(mm), y(mm), z(mm), roll/rx(rad or °), pitch/ry(rad or °), yaw/rz(rad or °)]      if default_is_radian is true, the value of roll/rx/pitch/ry/yaw/rz should be in radians      if default_is_radian is false, The value of roll/rx/pitch/ry/yaw/rz should be in degrees @param offset: the offset between pose1 and pose2 @param orient_type_in: input attitude notation, 0 is RPY (default), 1 is axis angle @param orient_type_out: notation of output attitude, 0 is RPY (default), 1 is axis angle @return: see the API Code Documentation for details.

get_position_aa()

int get_position_aa(fp32 pose[6]);

Get the pose represented by the axis angle pose @param pose: the pose represented by the axis angle pose of xArm, like [x(mm), y(mm), z(mm), rx(rad or °), ry(rad or °), rz(rad or °)]      if default_is_radian is true, the value of rx/ry/rz should be in radians      if default_is_radian is false, The value of rx/ry/rz should be in degrees @return: see the API Code Documentation for details.

robotiq_reset()

int robotiq_reset(unsigned char ret_data[6] = nullptr);

Reset the robotiq gripper (clear previous activation if any) @param ret_data: the response from robotiq @return: see the API Code Documentation for details.

robotiq_set_activate()

int robotiq_set_activate(bool wait = true, fp32 timeout = 3, unsigned char ret_data[6] = nullptr);
int robotiq_set_activate(bool wait, unsigned char ret_data[6]);
int robotiq_set_activate(unsigned char ret_data[6]);

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 @param ret_data: the response from robotiq @return: see the API Code Documentation for details.

robotiq_set_position()

int robotiq_set_position(unsigned char pos, unsigned char speed = 0xFF, unsigned char force = 0xFF, bool wait = true, fp32 timeout = 5, unsigned char ret_data[6] = nullptr, bool wait_motion = true);
int robotiq_set_position(unsigned char pos, bool wait, fp32 timeout = 5, unsigned char ret_data[6] = nullptr, bool wait_motion = true);
int robotiq_set_position(unsigned char pos, bool wait, unsigned char ret_data[6], bool wait_motion = true);
int robotiq_set_position(unsigned char pos, unsigned char ret_data[6], bool wait_motion = true);

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 robotiq motion complete, default is true @param timeout: maximum waiting time(unit: second), default is 5, only available if wait=true @param ret_data: the response from robotiq @return: see the API Code Documentation for details.

robotiq_open()

int robotiq_open(unsigned char speed = 0xFF, unsigned char force = 0xFF, bool wait = true, fp32 timeout = 5, unsigned char ret_data[6] = nullptr, bool wait_motion = true);
int robotiq_open(bool wait, fp32 timeout = 5, unsigned char ret_data[6] = nullptr, bool wait_motion = true);
int robotiq_open(bool wait, unsigned char ret_data[6], bool wait_motion = true);
int robotiq_open(unsigned char ret_data[6], bool wait_motion = true);

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 complete, default is true @param timeout: maximum waiting time(unit: second), default is 5, only available if wait=true @param ret_data: the response from robotiq @return: see the API Code Documentation for details.

robotiq_close()

int robotiq_close(unsigned char speed = 0xFF, unsigned char force = 0xFF, bool wait = true, fp32 timeout = 5, unsigned char ret_data[6] = nullptr, bool wait_motion = true);
int robotiq_close(bool wait, fp32 timeout = 5, unsigned char ret_data[6] = nullptr, bool wait_motion = true);
int robotiq_close(bool wait, unsigned char ret_data[6], bool wait_motion = true);
int robotiq_close(unsigned char ret_data[6], bool wait_motion = true);

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 complete, default is true @param timeout: maximum waiting time(unit: second), default is 5, only available if wait=true @param ret_data: the response from robotiq @return: see the API Code Documentation for details.

robotiq_get_status()

int robotiq_get_status(unsigned char ret_data[9], unsigned char number_of_registers = 3);

Reading the status of robotiq gripper @param ret_data: the response from robotiq @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: see the API Code Documentation for details.

set_bio_gripper_enable()

int set_bio_gripper_enable(bool enable, bool wait = true, fp32 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: see the API Code Documentation for details.

set_bio_gripper_speed()

int set_bio_gripper_speed(int speed);

Set the speed of the bio gripper @param speed: speed @return: see the API Code Documentation for details.

set_bio_gripper_control_mode()

int set_bio_gripper_control_mode(int mode);

Set the mode of the bio gripper @param mode: mode      0: bio gripper opening and closing mode      1: position loop mode @return: see the API Code Documentation for details.

set_bio_gripper_force()

int set_bio_gripper_force(int force);

Set the force of the bio gripper @param force: gripper force between 10 and 100 @return: see the API Code Documentation for details.

set_bio_gripper_g2_position()

int set_bio_gripper_g2_position(int pos, int speed = 2000, int force=100, bool wait = true, fp32 timeout = 5, bool wait_motion = true);

Set the position of the bio gripper @param pos: gripper pos between 71 and 150, (unit: mm) @param speed: gripper speed between 500 and 4000, default is 2000, (unit: pulse/s) @param force: gripper force between 1 and 100, default is 100 @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: see the API Code Documentation for details.

open_bio_gripper()

int open_bio_gripper(int speed = 0, bool wait = true, fp32 timeout = 5, bool wait_motion = true);
int open_bio_gripper(bool wait, fp32 timeout = 5, bool wait_motion = true);

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: see the API Code Documentation for details.

close_bio_gripper()

int close_bio_gripper(int speed = 0, bool wait = true, fp32 timeout = 5, bool wait_motion = true);
int close_bio_gripper(bool wait, fp32 timeout = 5, bool wait_motion = true);

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: see the API Code Documentation for details.

get_bio_gripper_status()

int get_bio_gripper_status(int *status);

Get the status of the bio gripper @param status: the result of the bio gripper status value      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 @return: see the API Code Documentation for details.

get_bio_gripper_g2_position()

int get_bio_gripper_g2_position(int *pos);

Get the position (mm) of the BIO Gripper G2 @param pos: the pos of the BIO gripper G2 @return: see the API Code Documentation for details.

get_bio_gripper_error()

int get_bio_gripper_error(int *err);

Get the error code of the bio gripper @param err: the result of the bio gripper error code @return: see the API Code Documentation for details.

clean_bio_gripper_error()

int clean_bio_gripper_error(void);

Clean the error code of the bio gripper @return: see the API Code Documentation for details.

set_rs485_timeout()

int set_rs485_timeout(int timeout, std::string target = "robot", std::string protocol = "modbus_rtu");
int set_rs485_timeout(int timeout, bool is_transparent_transmission);

Set the timeout of the target RS485 @param timeout: timeout, milliseconds @param target: "robot" or "control_box"      robot: Robot RS485      control_box: ControlBox RS485 @param protocol: "modbus_rtu" or "transparent"      modbus_rtu: Modbus RTU      transparent: Transparent Transmission @param is_transparent_transmission: whether the set timeout is the timeout of transparent transmission (only for set_tgpio_modbus_timeout)      Note: only available if firmware_version >= 1.11.0 @return: see the API Code Documentation for details.

get_rs485_timeout()

int get_rs485_timeout(int *timeout, std::string target = "robot", std::string protocol = "modbus_rtu");
int get_rs485_timeout(int *timeout, bool is_transparent_transmission);

Get the timeout of the target RS485 @param timeout: timeout, milliseconds @param target: "robot" or "control_box"      robot: Robot RS485      control_box: ControlBox RS485 @param protocol: "modbus_rtu" or "transparent"      modbus_rtu: Modbus RTU      transparent: Transparent Transmission @param is_transparent_transmission: is transparent transmission or not (only for get_tgpio_modbus_timeout) @return: see the API Code Documentation for details.

set_rs485_baudrate()

int set_rs485_baudrate(int baud, std::string target = "robot");

Set the baudrate of the target RS485 @param baud: baudrate, 4800/9600/19200/38400/57600/115200/230400/460800/921600/1000000/1500000/2000000/2500000 @param target: "robot" or "control_box"      robot: Robot RS485      control_box: ControlBox RS485 @return: see the API Code Documentation for details.

get_rs485_baudrate()

int get_rs485_baudrate(int *baud, std::string target = "robot");

Get the baudrate of the target RS485 @param baud: the result of baudrate @param target: "robot" or "control_box"      robot: Robot RS485      control_box: ControlBox RS485 @return: see the API Code Documentation for details.

set_rs485_data()

int set_rs485_data(unsigned char *modbus_data, int modbus_length, unsigned char *ret_data, int ret_length, std::string target = "robot", std::string protocol = "modbus_rtu", bool use_503_port = false);
int set_rs485_data(unsigned char *modbus_data, int modbus_length, unsigned char *ret_data, int ret_length, unsigned char host_id, bool is_transparent_transmission = false, bool use_503_port = false);

Send the modbus data to the Robot RS485 @param modbus_data: send data @param modbus_length: the length of the modbus_data @param ret_data: the response data of the modbus @param ret_length: the length of the response data @param target: "robot" or "control_box"      robot: Robot RS485      control_box: ControlBox RS485 @param protocol: "modbus_rtu" or "transparent"      modbus_rtu: Modbus RTU      transparent: Transparent Transmission @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: see the API Code Documentation for details.

getset_tgpio_modbus_data()

int getset_tgpio_modbus_data(unsigned char *modbus_data, int modbus_length, unsigned char *ret_data, int ret_length, unsigned char host_id = UXBUS_CONF::ROBOT_RS485_HOST_ID, bool is_transparent_transmission = false, bool use_503_port = false);

Send the modbus data to the RS485 @param modbus_data: send data @param modbus_length: the length of the modbus_data @param ret_data: the response data of the modbus @param ret_length: the length of the response data @param host_id: host id, default is 9      9: Robot RS485      11: ControlBox 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: see the API Code Documentation for details.

set_report_tau_or_i()

int set_report_tau_or_i(int tau_or_i = 0);

Set the reported torque or electric current @param tau_or_i:      0: torque      1: electric current @return: see the API Code Documentation for details.

get_report_tau_or_i()

int get_report_tau_or_i(int *tau_or_i);

Get the reported torque or electric current @param tau_or_i: the result of the tau_or_i @return: see the API Code Documentation for details.

set_self_collision_detection()

int set_self_collision_detection(bool on);

Set whether to enable self-collision detection @param on: enable or not @return: see the API Code Documentation for details.

set_collision_tool_model()

int set_collision_tool_model(int tool_type, int n = 0, ...);

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      7: Lite Gripper, no additional parameters required      8: Lite Vacuum Gripper, no additional parameters required      9: xArm Gripper G2, no additional parameters required      10: PGC-140-50 of the DH-ROBOTICS, no additional parameters required      11: RH56DFX-2L of the INSPIRE-ROBOTS, no additional parameters required      12: RH56DFX-2R of the INSPIRE-ROBOTS, no additional parameters required      13: xArm Bio Gripper G2, no additional parameters required      21: Cylinder, need additional parameters radius, height      arm->set_collision_tool_model(21, 2, radius, height)      @param radius: the radius of cylinder, (unit: mm), (float)      @param height: the height of cylinder, (unit: mm), (float)      @param x_offset: offset in the x direction, (unit: mm), (float)      @param y_offset: offset in the y direction, (unit: mm), (float)      @param z_offset: offset in the z direction, (unit: mm), (float)      22: Cuboid, need additional parameters x, y, z      arm->set_collision_tool_model(22, 3, x, y, z)      @param x: the length of the cuboid in the x coordinate direction, (unit: mm), (float)      @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 x_offset: offset in the x direction, (unit: mm), (float)      @param y_offset: offset in the y direction, (unit: mm), (float)      @param z_offset: offset in the z direction, (unit: mm), (float) @param n: the count of the additional parameters @param ...: additional parameters @return: see the API Code Documentation for details.

set_simulation_robot()

int set_simulation_robot(bool on);

Set the simulation robot @param on: enable or not @return: see the API Code Documentation for details.

vc_set_joint_velocity()

int vc_set_joint_velocity(fp32 speeds[7], bool is_sync = true, fp32 duration = -1.0);

Joint velocity control, need to be set to joint velocity control mode(this.set_mode(4)) @param speeds: [spd_J1, spd_J2, ..., spd_J7]      if default_is_radian is true, the value of spd_J1/.../spd_J7 should be in radians      if default_is_radian is false, the value of spd_J1/.../spd_J7 should be in degrees @param is_sync: whether all joints accelerate and decelerate synchronously, default is true @param duration: the maximum duration of the speed, over this time will automatically set the speed to 0.      duration > 0: seconds, indicates the maximum number of seconds that this speed can be maintained      duration == 0: always effective, will not stop automatically      duration < 0: default value, only used to be compatible with the old protocol, equivalent to 0      Note:      only available if firmware_version >= 1.8.0 @return: see the API Code Documentation for details.

vc_set_cartesian_velocity()

int vc_set_cartesian_velocity(fp32 speeds[6], bool is_tool_coord = false, fp32 duration = -1.0);

Cartesian velocity control, need to be set to cartesian velocity control mode(self.set_mode(5)) @param speeds: [spd_x, spd_y, spd_z, spd_rx, spd_ry, spd_rz]      if default_is_radian is true, the value of spd_rx/spd_ry/spd_rz should be in radians      if default_is_radian is false, the value of spd_rx/spd_ry/spd_rz should be in degrees @param is_tool_coord: is tool coordinate or not, default is false @param duration: the maximum duration of the speed, over this time will automatically set the speed to 0.      duration > 0: seconds, indicates the maximum number of seconds that this speed can be maintained      duration == 0: always effective, will not stop automatically      duration < 0: default value, only used to be compatible with the old protocol, equivalent to 0      Note:      only available if firmware_version >= 1.8.0 @return: see the API Code Documentation for details.

calibrate_tcp_coordinate_offset()

int calibrate_tcp_coordinate_offset(float four_points[4][6], float ret_xyz[3]);

Four-point method to calibrate tool coordinate system position offset @param four_points: a list of four teaching coordinate positions [x, y, z, roll, pitch, yaw]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, the value of roll/pitch/yaw should be in degrees @param ret_xyz: the result of the calculated xyz(mm) TCP offset, [x, y, z] @return: see the API Code Documentation for details.

calibrate_tcp_orientation_offset()

int calibrate_tcp_orientation_offset(float rpy_be[3], float rpy_bt[3], float ret_rpy[3]);

An additional teaching point to calibrate the tool coordinate system attitude offset @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]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, the value of roll/pitch/yaw should be in degrees @param ret_rpy: the result of the calculated rpy TCP offset, [roll, pitch, yaw] @return: see the API Code Documentation for details.

calibrate_user_orientation_offset()

int calibrate_user_orientation_offset(float three_points[3][6], float ret_rpy[3], int mode = 0, int trust_ind = 0);

Three-point method teaches user coordinate system posture offset @param four_points: a list of teaching TCP coordinate positions [x, y, z, roll, pitch, yaw]      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, the value of roll/pitch/yaw should be in degrees @param ret_rpy: the result of the calculated rpy user offset, [roll, pitch, yaw] @return: see the API Code Documentation for details.

calibrate_user_coordinate_offset()

int calibrate_user_coordinate_offset(float rpy_ub[3], float pos_b_uorg[3], float ret_xyz[3]);

An additional teaching point determines the position offset of the user coordinate system. @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()      if default_is_radian is true, the value of roll/pitch/yaw should be in radians      if default_is_radian is false, the value of roll/pitch/yaw should be in degrees @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 ret_xyz: the result of the calculated xyz user offset, [x, y, z] @return: see the API Code Documentation for details.

set_ft_sensor_admittance_parameters()

int set_ft_sensor_admittance_parameters(int coord, int c_axis[6], float M[6], float K[6], float B[6]);
int set_ft_sensor_admittance_parameters(int coord, int c_axis[6]);
int set_ft_sensor_admittance_parameters(float M[6], float K[6], float B[6]);

Set the parameters of admittance control through the Six-axis Force Torque Sensor. @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 admittance in the corresponding axis of the task frame. @param M: 6d vector, mass. (kg) @param K: 6d vector, stiffness coefficient. @param B: 6d vector, damping coefficient. invalid.      Note: the value is set to 2sqrt(MK) in controller. @return: see the API Code Documentation for details.

set_ft_sensor_force_parameters()

int set_ft_sensor_force_parameters(int coord, int c_axis[6], float f_ref[6], float limits[6], float kp[6], float ki[6], float kd[6], float xe_limit[6]);
int set_ft_sensor_force_parameters(int coord, int c_axis[6], float f_ref[6], float limits[6]);
int set_ft_sensor_force_parameters(float kp[6], float ki[6], float kd[6], float xe_limit[6]);

Set the parameters of force control through the Six-axis Force Torque Sensor. @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: 6d vector, 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: 6d vector, for compliant axes, these values are the maximum allowed tcp speed along/about the axis. @param kp: 6d vector, proportional gain @param ki: 6d vector, integral gain. @param kd: 6d vector, 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: see the API Code Documentation for details.

set_ft_sensor_zero()

int set_ft_sensor_zero(void);

Set the current state to the zero point of the Six-axis Force Torque Sensor @return: see the API Code Documentation for details.

iden_ft_sensor_load_offset()

int iden_ft_sensor_load_offset(float result[10]);

Identification the tcp load and offset with the Six-axis Force Torque Sensor @param result: the result of identification, [mass(kg),x_centroid(mm),y_centroid(mm),z_centroid(mm),Fx_offset,Fy_offset,Fz_offset,Tx_offset,Ty_offset,Tz_offset] @return: see the API Code Documentation for details.

set_ft_sensor_load_offset()

int set_ft_sensor_load_offset(float load_offset[10], bool association_setting_tcp_load = false, float m = 0.270, float x = -17, float y = 9, float z = 11.8);

Write the load offset parameters identified by the Six-axis Force Torque Sensor @param load_offset: iden result([mass(kg),x_centroid(mm),y_centroid(mm),z_centroid(mm),Fx_offset,Fy_offset,Fz_offset,Tx_offset,Ty_offset,Tz_offset]) @param association_setting_tcp_load: whether to convert the parameter to the corresponding tcp load and set, default is false      if true, the value of tcp load will be modified @return: see the API Code Documentation for details.

set_ft_sensor_enable()

int set_ft_sensor_enable(int on_off);

Used for enabling and disabling the use of the Six-axis Force Torque Sensor measurements in the controller. @param on_off: enable or disable F/T data sampling. @return: see the API Code Documentation for details.

set_ft_sensor_mode()

int set_ft_sensor_mode(int mode);

Set robot to be controlled in force mode. (Through the Six-axis Force Torque Sensor) @param mode: force mode.      0: non-force mode      1: admittance control      2: force control @return: see the API Code Documentation for details.

get_ft_sensor_mode()

int get_ft_sensor_mode(int *mode);

Get force mode @param mode: the result of force mode.      0: non-force mode      1: admittance control      2: force control @return: see the API Code Documentation for details.

get_ft_sensor_data()

int get_ft_sensor_data(float ft_data[6], bool is_raw = false);

Get the data of the Six-axis Force Torque Sensor @param ft_data: the result of the Six-axis Force Torque Sensor. @return: see the API Code Documentation for details.

get_ft_sensor_config()

int get_ft_sensor_config(int *ft_mode = nullptr, int *ft_is_started = nullptr, int *ft_type = nullptr, int *ft_id = nullptr, int *ft_freq = nullptr,;

Get the config of the Six-axis Force Torque Sensor @param ft_mode: force mode      0: non-force mode      1: admittance control      2: force control @param ft_is_started: ft sensor is enable or not @param ft_type: ft sensor type @param ft_id: ft sensor id @param ft_freq: ft sensor frequency @param ft_mass: load mass @param ft_dir_bias: @param ft_centroid: [x_centroid,y_centroid,z_centroid] @param ft_zero: [Fx_offset,Fy_offset,Fz_offset,Tx_offset,Ty_offset,Tz_offset] @param imp_coord: task frame of admittance control mode.      0: base frame.      1: tool frame. @param imp_c_axis: a 6d vector of 0s and 1s. 1 means that robot will be admittance 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. @param f_coord: task frame of force control mode.      0: base frame.      1: tool frame. @param f_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 f_limits: for compliant axes, these values are the maximum allowed tcp speed along/about the axis. @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: see the API Code Documentation for details.

get_ft_sensor_error()

int get_ft_sensor_error(int *err);

Get the error code of the Six-axis Force Torque Sensor @param err: the result of ft sensor error code @return: see the API Code Documentation for details.

iden_tcp_load()

int iden_tcp_load(float result[4], float estimated_mass = 0.0);

Identification the tcp load with current @param result: the result of identification. [mass,x_centroid,y_centroid,z_centroid] @return: see the API Code Documentation for details.

get_linear_motor_registers()

int get_linear_motor_registers(LinearMotorStatus *status = nullptr, int addr = 0x0A20, int number_of_registers = 8);

Get all status of the linear motor @param status: the result of linear motor status @return: see the API Code Documentation for details.

get_linear_motor_pos()

int get_linear_motor_pos(int *pos);

Get the pos of the linear motor @param pos: the result of linear motor position @return: see the API Code Documentation for details.

get_linear_motor_status()

int get_linear_motor_status(int *status);

Get the motion status of the linear motor @param status: the result of linear motor status      status & 0x00: motion finish.      status & 0x01: in motion      status & 0x02: has stop @return: see the API Code Documentation for details.

get_linear_motor_error()

int get_linear_motor_error(int *err);

Get the error code of the linear motor @param err: the result of linear motor error @return: see the API Code Documentation for details.

get_linear_motor_is_enabled()

int get_linear_motor_is_enabled(int *status);

Get the linear motor is enabled or not @param status: the result of linear motor status      status == 0: linear motor is not enabled      status == 1: linear motor is enabled @return: see the API Code Documentation for details.

get_linear_motor_on_zero()

int get_linear_motor_on_zero(int *status);

Get the linear motor is on zero position or not @param status: the result of linear motor status      status == 0: linear motor is not on zero      status == 1: linear motor is on zero @return: see the API Code Documentation for details.

get_linear_motor_sci()

int get_linear_motor_sci(int *sci1);

Get the sci1 value of the linear motor @param sci1: the result of linear motor sci1 @return: see the API Code Documentation for details.

get_linear_motor_sco()

int get_linear_motor_sco(int sco[2]);

Get the sco value of the linear motor @param sco: the result of linear motor sco0 and sco1 @return: see the API Code Documentation for details.

clean_linear_motor_error()

int clean_linear_motor_error(void);

Clean the linear motor error @return: see the API Code Documentation for details.

set_linear_motor_enable()

int set_linear_motor_enable(bool enable);

Set the linear motor enable/disable @param enable: enable or not @return: see the API Code Documentation for details.

set_linear_motor_speed()

int set_linear_motor_speed(int speed);

Set the speed of the linear motor @param speed: Integer between 1 and 1000mm/s. @return: see the API Code Documentation for details.

set_linear_motor_back_origin()

int set_linear_motor_back_origin(bool wait = true, bool auto_enable = true);

Set the linear motor go back to the origin position @param wait: wait to motion finish or not, default is true @param auto_enable: enable after back to origin or not, default is true @return: see the API Code Documentation for details.

set_linear_motor_pos()

int set_linear_motor_pos(int pos, int speed = 0, bool wait = true, fp32 timeout = 100, bool auto_enable = true);

Set the position of the linear motor @param pos: position. Integer between 0 and 700/1000/1500.      If the SN of the linear motor is start with AL1300, the position range is 0700mm.      If the SN of the linear motor is start with AL1301, the position range is 01000mm.      If the SN of the linear motor is start with AL1302, the position range is 0~1500mm. @param speed: auto set the speed of the linear motor if the speed is changed, Integer between of 1 and 1000mm/s, default is -1(not set) @param wait: wait to motion finish or not, default is true @param timeout: wait timeout, seconds, default is 100s. @param auto_enable: auto enable if not enabled, default is true @return: see the API Code Documentation for details.

set_linear_motor_stop()

int set_linear_motor_stop(void);

Set the linear motor to stop @return: see the API Code Documentation for details.

set_baud_checkset_enable()

int set_baud_checkset_enable(bool enable);

Enable auto checkset the baudrate of the end IO board or not

set_checkset_default_baud()

int set_checkset_default_baud(int type, int baud);

Set the checkset baud value @param type: checkset type      1: xarm gripper      2: bio gripper      3: robotiq gripper      4: linear motor @param baud: checkset baud value, less than or equal to 0 means disable checkset @return: see the API Code Documentation for details.

get_checkset_default_baud()

int get_checkset_default_baud(int type, int *baud);

Get the checkset baud @param type: checkset type      1: xarm gripper      2: bio gripper      3: robotiq gripper      4: linear motor @param baud: checkset baud value, less than or equal to 0 means disable checkset @return: see the API Code Documentation for details.

set_cartesian_velo_continuous()

int set_cartesian_velo_continuous(bool on_off);

Set cartesian motion velocity continuous @param on_off: continuous or not, default is false @return: see the API Code Documentation for details.

set_allow_approx_motion()

int set_allow_approx_motion(bool on_off);

Set allow to avoid overspeed near some singularities using approximate solutions @param on_off: allow or not, default is false @return: see the API Code Documentation for details.

iden_joint_friction()

int iden_joint_friction(int *result, unsigned char *sn = nullptr);

Identification the friction @param result: the result of identification.      0: success      -1: failure @return: see the API Code Documentation for details.

set_only_check_type()

int set_only_check_type(unsigned char only_check_type = 0);

Set the motion process detection type (valid for all motion interfaces of the current SDK instance) @param only_check_type: Motion Detection Type      only_check_type == 0: Restore the original function of the motion interface, it will move, the default is 0      only_check_type == 1: Only check the self-collision without moving, take the actual state of the manipulator as the initial planned path, and check whether the path has self-collision (the intermediate state will be updated at this time)      only_check_type == 2: Only check the self-collision without moving, use the intermediate state as the starting planning path, check whether the path has self-collision (the intermediate state will be updated at this time), and restore the intermediate state to the actual state after the end      only_check_type == 3: Only check the self-collision without moving, use the intermediate state as the starting planning path, and check whether the path has self-collision (the intermediate state will be updated at this time) @return: see the API Code Documentation for details.

open_lite6_gripper()

int open_lite6_gripper(bool sync = true);

Open the gripper of Lite6 series robotics arms @param sync: whether to execute in the motion queue, set to false to execute immediately(default is true)      1. only available if firmware_version >= 2.4.101 @return: see the API Code Documentation for details.

close_lite6_gripper()

int close_lite6_gripper(bool sync = true);

Close the gripper of Lite6 series robotics arms @param sync: whether to execute in the motion queue, set to false to execute immediately(default is true)      1. only available if firmware_version >= 2.4.101 @return: see the API Code Documentation for details.

stop_lite6_gripper()

int stop_lite6_gripper(bool sync = true);

Stop the gripper of Lite6 series robotics arms @param sync: whether to execute in the motion queue, set to false to execute immediately(default is true)      1. only available if firmware_version >= 2.4.101 @return: see the API Code Documentation for details.

get_dh_params()

int get_dh_params(fp32 dh_params[28]);

Get the DH parameters @param dh_params: the result of 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 @return: see the API Code Documentation for details.

set_dh_params()

int set_dh_params(fp32 dh_params[28], unsigned char flag = 0);

Set the 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: see the API Code Documentation for details.

set_feedback_type()

int set_feedback_type(unsigned char feedback_type);

Set the feedback type @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: see the API Code Documentation for details.

set_linear_spd_limit_factor()

int set_linear_spd_limit_factor(float factor);

Set linear speed limit factor (default is 1.2) @param factor: speed limit factor @return: see the API Code Documentation for details.

set_cmd_mat_history_num()

int set_cmd_mat_history_num(int num);

Set cmd mat history num @param num: history num @return: see the API Code Documentation for details.

set_fdb_mat_history_num()

int set_fdb_mat_history_num(int num);

Set fdb mat history num @param num: history num @return: see the API Code Documentation for details.

get_linear_spd_limit_factor()

int get_linear_spd_limit_factor(float *factor);

Get linear speed limit factor @param factor: speed limit factor @return: see the API Code Documentation for details.

get_cmd_mat_history_num()

int get_cmd_mat_history_num(int *num);

Get cmd mat history num @param num: history num @return: see the API Code Documentation for details.

get_fdb_mat_history_num()

int get_fdb_mat_history_num(int *num);

Get fdb mat history num @param num: history num @return: see the API Code Documentation for details.

get_poe_status()

int get_poe_status(int *status);

Get poe status @param status: poe status, 1 means poe valid, 0 means poe invalid @return: see the API Code Documentation for details.

get_iden_status()

int get_iden_status(int *status);

Get iden status @param status: iden status, 1 means in identifying, 0 means not in identifying @return: see the API Code Documentation for details.

get_c31_error_info()

int get_c31_error_info(int *servo_id, float *theoretical_tau, float *actual_tau);

Get collision error (C31) info @param servo_id: servo id @param theoretical_tau: theoretical tau @param actual_tau: actual tau @return: see the API Code Documentation for details.

get_c54_error_info()

int get_c54_error_info(int *dir, float *tau_threshold, float *actual_tau);

Get (Six-axis Force Torque Sensor) collision error (C54) info @param dir: trigger direction (XYZRxRyRz) @param tau_threshold: tau threshold @param actual_tau: actual tau @return: see the API Code Documentation for details.

get_c37_error_info()

int get_c37_error_info(int *servo_id, float *diff_angle);

Get payload error (C37) info @param servo_id: servo id @param diff_angle: diff angle @return: see the API Code Documentation for details.

get_c23_error_info()

int get_c23_error_info(int *id_bits, float angles[7]);

Get joint angle limit error (C23) info @param id_bits: each bit corresponds to each joint (bit0 corresponds to joint 1), and a bit of 1 indicates that the corresponding joint exceeds the limit. @param angles: current angles @return: see the API Code Documentation for details.

get_c24_error_info()

int get_c24_error_info(int *servo_id, float *speed);

Get joint angle speed limit (C24) error info @param servo_id: servo id @param speed: current speed @return: see the API Code Documentation for details.

get_c60_error_info()

int get_c60_error_info(float *max_velo, float *curr_velo);

Get linear angle speed limit (C60) error info @param max_velo: max limit linear speed @param curr_velo: current linear speed @return: see the API Code Documentation for details.

get_c38_error_info()

int get_c38_error_info(int *id_bits, float angles[7]);

Get joint hard angle limit error (C38) info @param id_bits: each bit corresponds to each joint (bit0 corresponds to joint 1), and a bit of 1 indicates that the corresponding joint exceeds the limit. @param angles: current angles @return: see the API Code Documentation for details.

set_ft_collision_detection()

int set_ft_collision_detection(int on_off);

Set whether to enable collision detection with the Six-axis Force Torque Sensor @param on_off: enable or not @return: see the API Code Documentation for details.

set_ft_collision_rebound()

int set_ft_collision_rebound(int on_off);

Set whether to enable collision rebound with the Six-axis Force Torque Sensor @param on_off: enable or not @return: see the API Code Documentation for details.

set_ft_collision_threshold()

int set_ft_collision_threshold(float thresholds[6]);

Set the thresholds of the collision detection with the Six-axis Force Torque Sensor @param thresholds: collision detection thresholds, [x(N), y(N), z(N), Rx(Nm), Ry(Nm), Rz(Nm)]      x: [5, 200] (N)      y: [5, 200] (N)      z: [5, 200] (N)      Rx: [0.1, 4] (Nm)      Ry: [0.1, 4] (Nm)      Rz: [0.1, 4] (Nm) @return: see the API Code Documentation for details.

set_ft_collision_reb_distance()

int set_ft_collision_reb_distance(float distances[6]);

Set the rebound distance of the collision rebound with the Six-axis Force Torque Sensor @param distances: collision rebound distance, [x(mm), y(mm), z(mm), Rx(° or rad), Ry(° or rad), Rz(° or rad)]      x: [2, 500] (mm)      y: [2, 500] (mm)      z: [2, 500] (mm)      Rx: [0.2, 50] (°)      Ry: [0.2, 50] (°)      Rz: [0.2, 50] (°) @return: see the API Code Documentation for details.

set_ft_admittance_ctrl_threshold()

int set_ft_admittance_ctrl_threshold(float thresholds[6]);

Set the reaction thresholds in each direction under the admittance control mode of the Six-axis Force Torque Sensor @param thresholds: reaction thresholds, [x(N), y(N), z(N), Rx(Nm), Ry(Nm), Rz(Nm)]      x: [0.1, 50] (N)      y: [0.1, 50] (N)      z: [0.1, 50] (N)      Rx: [0.01, 2] (Nm)      Ry: [0.01, 2] (Nm)      Rz: [0.01, 2] (Nm) @return: see the API Code Documentation for details.

set_external_device_monitor_params()

int set_external_device_monitor_params(int dev_type, int frequency);

Set the monitor params of the external device @param dev_type: the type of the external device      0: Turn off monitoring      1: xArm Gripper      2: xArm Gripper G2      3: BIO Gripper G2      4: Robotiq 2F-85/Robotiq 2F-140 @param frequency: the frequency of communication with the external device @return: see the API Code Documentation for details.

set_tgpio_monitor_params()

int set_tgpio_monitor_params(int io_type, int frequency);

Set the monitor params of the TGPIO @param io_type: the type of the TGPIO      0: Turn off monitoring      1: Turn on monitoring @param frequency: the frequency of communication with the TGPIO @return: see the API Code Documentation for details.

get_ft_collision_detection()

int get_ft_collision_detection(int *on_off);

Get the collision detection with the Six-axis Force Torque Sensor is enable or not @param on_off: enable or not @return: see the API Code Documentation for details.

get_ft_collision_rebound()

int get_ft_collision_rebound(int *on_off);

Get the collision rebound with the Six-axis Force Torque Sensor is enable or not @param on_off: enable or not @return: see the API Code Documentation for details.

get_ft_collision_threshold()

int get_ft_collision_threshold(float thresholds[6]);

Get the collision thresholds with the Six-axis Force Torque Sensor @param thresholds: collision detection thresholds @return: see the API Code Documentation for details.

get_ft_collision_reb_distance()

int get_ft_collision_reb_distance(float distances[6]);

Get the collision rebound distance with the Six-axis Force Torque Sensor @param distances: rebound distance, [x(mm), y(mm), z(mm), Rx(° or rad), Ry(° or rad), Rz(° or rad)] @return: see the API Code Documentation for details.

get_ft_admittance_ctrl_threshold()

int get_ft_admittance_ctrl_threshold(float thresholds[6]);

Get the reaction thresholds in each direction under the admittance control mode of the Six-axis Force Torque Sensor @param thresholds: reaction thresholds, [x(N), y(N), z(N), Rx(Nm), Ry(Nm), Rz(Nm)] @return: see the API Code Documentation for details.

get_external_device_monitor_params()

int get_external_device_monitor_params(int params[2]);

Get the monitor params of the external device @param params: params, [dev_type, frequency] @return: see the API Code Documentation for details.

get_tgpio_monitor_params()

int get_tgpio_monitor_params(int params[2]);

Get the monitor params of the TGPIO @param params: params, [io_type, frequency] @return: see the API Code Documentation for details.

read_coil_bits()

int read_coil_bits(unsigned short addr, unsigned short quantity, unsigned char *bits);

(Standard Modbus TCP) Read Coils (0x01) @param addr: the starting address of the register to be read @param quantity: number of registers @param bits: store result @return: see the API Code Documentation for details.

read_input_bits()

int read_input_bits(unsigned short addr, unsigned short quantity, unsigned char *bits);

(Standard Modbus TCP) Read Discrete Inputs (0x02) @param addr: the starting address of the register to be read @param quantity: number of registers @param bits: store result @return: see the API Code Documentation for details.

read_holding_registers()

int read_holding_registers(unsigned short addr, unsigned short quantity, int *regs, bool 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 regs: store result @param is_signed: whether to convert the read register value into a signed form @return: see the API Code Documentation for details.

read_input_registers()

int read_input_registers(unsigned short addr, unsigned short quantity, int *regs, bool 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 regs: store result @param is_signed: whether to convert the read register value into a signed form @return: see the API Code Documentation for details.

write_single_coil_bit()

int write_single_coil_bit(unsigned short addr, unsigned char bit_val);

(Standard Modbus TCP) Write Single Coil (0x05) @param addr: register address @param bit_val: the value to write (0/1) @return: see the API Code Documentation for details.

write_single_holding_register()

int write_single_holding_register(unsigned short addr, int reg_val);

(Standard Modbus TCP) Write Single Holding Register (0x06) @param addr: register address @param reg_val: the value to write @return: see the API Code Documentation for details.

write_multiple_coil_bits()

int write_multiple_coil_bits(unsigned short addr, unsigned short quantity, unsigned char *bits);

(Standard Modbus TCP) Write Multiple Coils (0x0F) @param addr: the starting address of the register to be written @param quantity: the number of registers to be written @param bits: array of values to write @return: see the API Code Documentation for details.

write_multiple_holding_registers()

int write_multiple_holding_registers(unsigned short addr, unsigned short quantity, int *regs);

(Standard Modbus TCP) Write Multiple Holding Registers (0x10) @param addr: the starting address of the register to be written @param quantity: the number of registers to be written @param regs: array of values to write @return: see the API Code Documentation for details.

mask_write_holding_register()

int mask_write_holding_register(unsigned short addr, unsigned short and_mask, unsigned short 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.

write_and_read_holding_registers()

int write_and_read_holding_registers(unsigned short r_addr, unsigned short r_quantity, int *r_regs, unsigned short w_addr, unsigned short w_quantity, int *w_regs, bool is_signed = false);

(Standard Modbus TCP) Write and Read Holding Registers (0x17) @param r_addr: the starting address of the register to be read @param r_quantity: number of registers to read @param r_regs: store result @param w_addr: the starting address of the register to be written @param w_quantity: number of registers to write @param w_regs: array of values to write to the register @param is_signed: whether to convert the read register value into a signed form @return: see the API Code Documentation for details.