Here, we walk through set up and example scripts to communicate with connected Dynamixel motors, using Matlab.
Prerequisite: This assumes instructions in hardware setup have been completed.
Clone the **dynamixel** repository maintained on Georgia Tech GitHub Enterprise: git@github.gatech.edu:ivabots/dynamixel.git
Note: Walk-through instructions to set up and clone Git repositories can be found here .
Within the repository, a Dynamixel_IO
Matlab class has been created to facilitate convenient communication with and operation of the motors: code/matlab/Dynamixel_IO/Dynamixel_IO.m
Take some time to explore the class definition and high-level methods available.
Disclaimer(s):
Dynamixel_IO
Matlab class only supports Dynamixel motors using 10-bit encoders (e.g. AX and RX line of motors). A variant (not yet committed to the repository) has been created to support most functions associated to motors that use 12-bit encoders (e.g. MX line of motors) and is available upon request. Dynamixel_IO
class relies on pre-compiled lower-level libraries to communicate with the motors. It presumes the libraries are located in a specific relative path. If you clone the dynamixel repo and use the Dynamixel_IO
class from the repository location, there should be no problem. If you move the Dynamixel_IO.m file out of the cloned repository location and use it elsewhere, however, it may not be able to find dependency libraries expected to reside within in the repository.Within the dynamixel repo, navigate to: code/matlab/Dynamixel_IO/test_cases.
Open and view the following test script which will command a (user-specified) motor ID to a desired position : test_case_command_single_motor.m
Some notes:
ls /dev/ttyUSB*
to view a list of device files that may correspond to this device. The number after 'ttyUSB' is your port number. Use that as the 1st argument to dxl.connect( … );
in the test script.motor_id = 17;
, replacing 17
with your motor's ID.dest_pos = pi/6;
, replace pi/6
with a motor position (radians) you'd like the motor to travel to. Each Dynamixel motor product line has a set of specifications that document the minimum/maximum range of motion. As an example, the AX-12 specifications can be found on its e-manual page . Every motor model has its own e-manual (Google the motor model name + “Dynamixel e-manual”). Exercise(s):