C Linux
This tutorial is written assuming you are using the latest version of Ubuntu. Commands may not be the same for alternative distributions of Linux.
Compiler and Builder
Compiler
- The DYNAMIXEL SKD requires GNU gcc ver. 5.4.0 20160609 or higher
-
To check the version of your gcc compiler:
$ gcc -v
-
Download the required compiler:
$ sudo apt-get install gcc
Builder
- Build-essential pkg → make
-
Download:
$ sudo apt-get install build-essential
Dependent Packages
- Packages needed for cross-compiling
-
Download:
$ sudo apt-get install gcc-multilib g++-multilib
Build the Library
-
Choose which format (32bit or 64bit) of the library you will be bulding. The Makefile is located in the following folder:
[DynamixelSDK folder]/c/build/linux32
OR[DynamixelSDK folder]/c/build/linux64
folder for 32/64-bit platforms OR[DynamixelSDK folder]/c/build/linux_sbc
folder for ARM SBCs.
Please note that if you intend to use the 32-bit example applications, you must build the 32-bit library. -
Go to the Makefile’s directory located in
[DynamixelSDK folder]/c/build/linux32
OR[DynamixelSDK folder]/c/build/linux64
OR[DynamixelSDK folder]/c/build/linux_sbc
using $cd
. -
Build the library file:
$ make
-
If there is an error, try rebuilding the package after cleaning any leftover files.
$ make clean && make
-
To delete the library file and object files after a successful build:
$ make clean
Copy (Install) the Library to the Root Directory
-
Make the library file and copy it to the root directory (to handle the serial port):
$ sudo make install
-
If there is an error, you can retry the installation:
$ sudo make uninstall && sudo make install
OR
$ sudo make reinstall
-
To delete the library file from the root directory:
$ sudo make uninstall
-
You will see the built library file in
[DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_c.so
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