Programming Servo Motions with DynamixelSDK in Matlab on a Personal Computer

Getting started

Step 1: Download the DynamixelSDK

Download the DynamixelSDK from Robotis' website, then unpack it to a location you will remember later. I personally chose my Documents folder.

Step 2: Set up MATLAB to use the DynamixelSDK libraries

Essentially this boils down to adding the locations of the libraries to your MATLAB path so MATLAB can find them.

Robotis provides a guide for installing the DynamixelSDK libraries that is 90% accurate. The only inaccuracy is you should also "Add with Subfolders" the path:

[DynamixelSDK folder]/c/build/win32/output

Once you've completed these steps, the list of paths you added should look something like this:

Step 3: Set up your hardware

Connect the servo(s) you would like to control to the U2D2 and connect that to a USB port on your computer. Also ensure each servo has power.

Switching servos between protocols

This tutorial requires Protocol 2.0, and MX series Dynamixels are shipped running Protocol 1.0. To switch them to Protocol 2.0, open the Dynamixel Wizard.

Use the scanning function of the Dynamixel Wizard to find your servo. Then, select the Recovery icon. This will open the Firmware Management window.

The Recovery icon in the Dynamixel Wizard

Click Next to click through the warnings, then choose the model of servo you have connected with (2.0) at the end. An image of the servo should come up when you click on it. Then click Next.

The model selection screen in the Firmware Management window.

Select the latest latest version of the firmware if it isn't selected already, then click Next.

Select the COM port that your U2D2 is connected to, then click Next again.

You will then be prompted to disconnect power to the servo, wait a few seconds, then plug it back in again. I generally disconnect the barrel jack from the power shield, wait approx. 3 seconds, then plug it back in. The window will respond once power is reconnected and install the new firmware.

Once the installation is complete, click Next, then click Finish. You can now use the Scan tool to find your servo on Protocol 2.0.

All other control parameters (ID, Return Delay Time, Shutdown, etc.) will have been reset during the firmware installation, so you will need to set them to your liking before continuing.

Controlling servos

Last updated

Was this helpful?