xArm-C++-SDK

May 21, 2026 ยท View on GitHub

Overview

  • The current version supports Linux/windows/MacOS(beta), but the source code structure has changed.

Caution

  • During use, people should stay away from the robot arm to avoid accidental injury or damage to other items by the robot arm.
  • Protect the arm before use.
  • Before you exercise, please make sure you don't encounter obstacles.
  • Protect the arm before unlocking the motor.

Update Summary

  • 1.18.0/1.18.1

    • Strengthen the code, fix some hidden bugs, and eliminate security risks.
    • Supports CMake compilation
    • Fix document errors and variable name errors
  • 1.17.0/1.17.1

    • Change some API names
  • 1.16.0

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

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

    • Fix the 503 interface protocol identification error issue
    • Added sync parameters to some gpio interfaces to support immediate execution (requires firmware 2.4.101 or above)
    • Added XArmAPIWrapper to C# calls to support simultaneous control of multiple robotic arms
    • Added new interface to support obtaining some error information
  • More

API Change List

OLD API NAMENEW API NAMESDK VERSION
set_tgpio_modbus_timeoutset_rs485_timeout1.17.1
get_tgpio_modbus_timeoutget_rs485_timeout1.17.1
set_tgpio_modbus_baudrateset_rs485_baudrate1.17.1
get_tgpio_modbus_baudrateget_rs485_baudrate1.17.1
getset_tgpio_modbus_dataset_rs485_data1.17.1
set_impedanceset_ft_sensor_admittance_parameters1.17.0
set_impedance_mbkset_ft_sensor_admittance_parameters1.17.0
set_impedance_configset_ft_sensor_admittance_parameters1.17.0
set_force_control_pidset_ft_sensor_force_parameters1.17.0
config_force_controlset_ft_sensor_force_parameters1.17.0
ft_sensor_set_zeroset_ft_sensor_zero1.17.0
ft_sensor_iden_loadiden_ft_sensor_load_offset1.17.0
ft_sensor_cali_loadset_ft_sensor_load_offset1.17.0
ft_sensor_enableset_ft_sensor_enable1.17.0
ft_sensor_app_setset_ft_sensor_mode1.17.0
ft_sensor_app_getget_ft_sensor_mode1.17.0
get_linear_track_registersget_linear_motor_registers1.17.0
get_linear_track_posget_linear_motor_pos1.17.0
get_linear_track_statusget_linear_motor_status1.17.0
get_linear_track_errorget_linear_motor_error1.17.0
get_linear_track_is_enabledget_linear_motor_is_enabled1.17.0
get_linear_track_on_zeroget_linear_motor_on_zero1.17.0
get_linear_track_sciget_linear_motor_sci1.17.0
get_linear_track_scoget_linear_motor_sco1.17.0
clean_linear_track_errorclean_linear_motor_error1.17.0
set_linear_track_enableset_linear_motor_enable1.17.0
set_linear_track_speedset_linear_motor_speed1.17.0
set_linear_track_back_originset_linear_motor_back_origin1.17.0
set_linear_track_posset_linear_motor_pos1.17.0
set_linear_track_stopset_linear_motor_stop1.17.0
shutdown_systemsystem_control1.13.6
get_suction_cupget_vacuum_gripper1.8.0
set_suction_cupset_vacuum_gripper1.8.0

Doc

Build

Requirements

  • CMake 3.5 or newer
  • A C++11 compiler
  • Linux/macOS: g++ or clang++
  • Windows: Visual Studio 2015/2017/2019/2022 with Desktop development for C++

The top-level CMakeLists.txt is written against CMake 3.5 features.

Get the code

git clone https://github.com/xArm-Developer/xArm-CPLUS-SDK.git
cd xArm-CPLUS-SDK

Output layout

By default, the current CMake build generates:

  • libraries in build/lib
  • executables in build/bin

When building shared libraries, make sure the runtime loader can find build/lib.

Build With CMake

Linux

Configure and build:

mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j

Build static library instead of shared library:

mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
make -j

Disable examples:

mkdir -p build
cd build
cmake .. -DXARM_BUILD_EXAMPLES=OFF
make -j

Run an example with shared library output:

LD_LIBRARY_PATH=./build/lib ./build/bin/0002-get_property 192.168.1.221

Install:

mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j
sudo make install

macOS

Configure and build:

mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j

Run an example with shared library output:

DYLD_LIBRARY_PATH=./build/lib ./build/bin/0002-get_property 192.168.1.221

Windows

Configure with Visual Studio 2015:

mkdir build
cd build
cmake .. -G "Visual Studio 14 2015" -A x64
cmake --build . --config Release

Configure with Visual Studio 2017:

mkdir build
cd build
cmake .. -G "Visual Studio 15 2017" -A x64
cmake --build . --config Release

Configure with Visual Studio 2019:

mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A x64
cmake --build . --config Release

If you use Visual Studio 2022:

mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64
cmake --build . --config Release

Run an example:

.\build\bin\Release\0002-get_property.exe 192.168.1.221

Build the optional C# wrapper:

mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64 -DXARM_BUILD_CSHARP_WRAPPER=ON
cmake --build . --config Release

Build With Makefile

The repository still keeps the original Makefile for Linux-style builds.

Build library:

make xarm

Build all examples:

make test

Build one example:

make test-0002-get_property

Build everything:

make clean
make

Run an example with shared library output:

LD_LIBRARY_PATH=./build/lib ./build/bin/0002-get_property 192.168.1.221

Install:

sudo make install

Uninstall:

sudo make uninstall

Example