Edit on GitHub

Examples

Device Setup(RH-P12-RN)

In order to run the example, RH-P12-RN should be set as belows.

TIP: To change the values of the control table, use R+ Manager 2.0 (in Windows) or DYNAMIXEL Wizard 2.0 (in Windows, Linux or Mac OS.)

Communication Port Setup

The Serial COM Port for Windows example is set as “COM4”.
Please change the Serial COM Port to COM4 in the Device Manager or modify the DEVICE_NAME in the example source code.
In case of Linux example, the communication port is set as “/dev/ttyUSB0”.
If other communication port is used, the DEVICE_NAME in the example source code should be modified properly.

RH-P12-RN_Example/rh-p12-rn.cpp

...

#if defined(__linux__)
#define DEVICE_NAME             "/dev/ttyUSB0"
#elif defined(_WIN32) || defined(_WIN64)
#define DEVICE_NAME             "COM4"
#endif

...

Windows Example

Download

Download from https://github.com/ROBOTIS-GIT/RH-P12-RN_Example with GIT client software or directly download source code at https://github.com/ROBOTIS-GIT/RH-P12-RN_Example/archive/master.zip and decompress the zip file.

Build and Run

Windows example is written on Visual Studio 2017.
Install Visual Studio and open the solution with RH-P12-RN_Example\win64\RH-P12-RN-Example.sln. Then build solution and run.

Below error message might appear due to the difference of Windows SDK version.

error MSB8036: The Windows SDK version 10.0.14393.0 was not found.  
Install the required version of Windows SDK or change the SDK version  
in the project property pages or by right-clicking the solution  
and selecting "Retarget solution".

In order to resolve the above error, open the property page from the project and select installed Windows SDK version, then rebuild the code.

img

Upon successful execution of the Windows example, the communication port and the baudrate of connected device are listed as shown in the below image.
If execution fails, confirm the error message to configure the device or communication port properly.

img

If RH-P12-RN is configured as Current-based Position Control Mode, below image will be displayed.

img

If RH-P12-RN is configured as Current Control Mode, below image will be displayed.

img

Each option is described as belows.

++ MODE ++

++ TORQUE ++

++ CONTROL ++

++ PARAMETERS ++

Linux Example

Preperation

DYNAMIXEL SDK should be installed in advance. Please enter below commands to install DYNAMIXEL SDK.

$ git clone https://github.com/ROBOTIS-GIT/DynamixelSDK
$ cd DynamixelSDK/c++/build/linux64
$ sudo make install

Below command will register USER_ID to dialout group in order to gain access to /dev/ttyUSB0

$ sudo usermod -aG dialout USER_ID  

Restart or log out and log in to validate the change.

Download

$ git clone https://github.com/ROBOTIS-GIT/RH-P12-RN_Example

Build

$ cd RH-P12-RN_Example/linux64
$ make

Run

$ ./rh-p12-rn_example

Upon successful execution of the Linux example, the communication port and the baudrate of connected device are listed as shown in the below image.
If execution fails, confirm the error message to configure the device or communication port properly.

img

If RH-P12-RN is configured as Current-based Position Control Mode, below image will be displayed.

img

If RH-P12-RN is configured as Current Control Mode, below image will be displayed.

img

Each option is identical to the Windows Example

ROS GUI Example

Create real-time scheduling priority (rtprio) for USER_GROUP (your user group)

$ sudo bash -c 'echo "@USER_GROUP - rtprio 99" > /etc/security/limits.d/robotis-rtprio.conf'

Below command will register USER_ID (your user ID) to dialout group in order to gain access to /dev/ttyUSB0

$ sudo usermod –aG dialout USER_ID

Restart or log out and log in to validate the change.

Download

$ cd ~/catkin_ws/src
$ git clone https://github.com/ROBOTIS-GIT/DynamixelSDK
$ git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Framework
$ git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Framework-msgs
$ git clone https://github.com/ROBOTIS-GIT/RH-P12-RN

Build

$ cd ~/catkin_ws
$ catkin_make

Run

Open the new terminal and run manager with below command.

$ roslaunch rh_p12_rn_manager rh_p12_rn_manager.launch

Open the new terminal and run GUI example with below command.

$ rosrun rh_p12_rn_gui rh_p12_rn_gui

If RH-P12-RN is configured as Current-based Position Control Mode, below GUI window will be displayed.

img

If RH-P12-RN is configured as Current Control Mode, below GUI window will be displayed.

img

Each option is identical to the Windows Example