CPP 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]/cpp/build/linux32
OR[DynamixelSDK folder]/cpp/build/linux64
folder for 32/64-bit platforms OR[DynamixelSDK folder]/cpp/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]/cpp/build/linux32
OR[DynamixelSDK folder]/cpp/build/linux64
OR[DynamixelSDK folder]/cpp/build/linux_sbc
using $cd
. -
To 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
-
To make 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
-
To recopy the library file to the root directory:
$ sudo make reinstall
-
You will see the built library file in
[DynamixelSDK folder]/c/build/[linuxXX]/libdxl_xYY_cpp.so
Building and Running the Sample Code
The DYNAMIXEL SDK sample code for CPP uses a .so (Linux Shared Object) library built in the CPP language.
The previous instructions walk you thorough building the latest library files [DynamixelSDK folder]/c++/build/[linuxXX]/libdxl_xYY_cpp.so
with its own source code.
-
Go to the Makefile’s directory using
cd
: -
To build executable file, type:
$ make
-
If there is an error,
$ make clean
then$ make
again. -
To delete the executable file,
$ make clean
.$ make clean
-
Access the port you will be using to communicate with DYNAMIXEL:
$ sudo chmod a+rw /dev/ttyUSB0
-
Run the executable code
$ ./read_write