Skip to main content

This tutorial is written assuming you are using the latest version of Ubuntu. Commands may not be the same for alternative distributions of Linux.

Install requirements

  • The DYNAMIXEL SDK requires GNU gcc ver. 5.4.0 20160609 or higher
  • To check the version of your gcc compiler
$ gcc -v
  • Download the requirements
$ sudo apt-get install gcc
$ sudo apt-get install build-essential
$ sudo apt-get install gcc-multilib g++-multilib # For cross-compiling

Build the SDK

  • Check your system architecture
$ uname -m
  • Enter the appropriate build folder depending on your system and build the SDK
$ cd DynamixelSDK/c/build/linux64 # for 64-bit systems
$ sudo make install
  • make sure to enter the correct folder according to your system architecture.

    • linux64 for 64-bit systems
    • linux32 for 32-bit systems
    • linux_sbc for ARM-based SBCs like Raspberry Pi
  • If the build completes successfully, you should see the .so file generated inside the build folder.

$ ls
libdxl_x86_c.so Makefile
  • Grant permission to access the port
$ sudo chmod 666 /dev/ttyUSB0
tip

  • Common make commands for building the SDK
$ make # Compile the source code and generate binaries
$ make install # Install the library files to the system
$ make clean # Remove all build files and reset the build environment
$ make uninstall # Remove files installed by 'make install' from the system
$ make reinstall # Reinstall by cleaning, rebuilding, and installing again

Building and Running the Sample Code

The DYNAMIXEL SDK example code for C uses a .so (Linux Shared Object) library built in C.
The previous instructions walk you through building the latest library files in [DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so built by its own source code.

  • Go to the Makefile's directory using cd:
$ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux32

OR

$ cd [DynamixelSDK folder]/c/example/protocol1.0/read_write/linux64

  • Build the executable file:
$ make

  • If there is an error, $ make clean then $ make again.

  • To delete the executable file, $ make clean.

  • Access the port you will be using to communicate with DYNAMIXEL:

$ sudo chmod a+rw /dev/ttyUSB0

  • Run the executable file:
$ ./read_write

CMake Build

  • Latest DYNAMIXEL SDK supports CMake build.

Build System Update

The existing OS-specific make build system has been unified into a single CMake-based build system.

CategoryLegacy (make)New (cmake)
Build fileOS-dependentUnified across platforms
Generated Fileslibdxl_{sys_env}_c.solibdxl_c.so
Install Include Paths/usr/local/include/dynamixel_sdk//usr/local/include/dynamixel_sdk_c/

Build with CMake

Install build-essential, and cmake.

$ sudo apt-get install build-essential
$ sudo apt-get install cmake

Build the SDK. --target install option makes the library files installed to the system.
You can skip installing the library files by omitting the --target install option.

$ cd DynamixelSDK/c
$ sudo cmake -B cmake_build
$ sudo cmake --build cmake_build --target install
$ sudo cmake --build cmake_build --target uninstall # Uninstall the library files from the system

Build result can be found in the cmake_build folder and the library files are installed to the system(/usr/local/lib/libdxl_c.so, /usr/local/include/dynamixel_sdk_c/).

Build the Example Code with CMake

The example code also supports unified CMake build.
The executable file can be found in the build folder.

$ cd DynamixelSDK/c/example/protocol2.0
$ sudo cmake -B build
$ sudo cmake --build build
$ cd build
$ ./broadcast_ping