(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Setting up Dynamixel

Description: This tutorial should help beginners to get used to Dynamixel and how to set it's parameters in order to control it.

Tutorial Level: BEGINNER

Introduction

First of all, we must understand the basic concepts of Dynamixel. It is a servomotor in which the user can easily use it by giving certain paramaters through ROS, which is going to be covered up later. Also, there are three ways we can control our Dynamixel:

  • Joint Mode
  • Wheel Mode
  • Multi-turn Mode

It's very important to say that every time we want to configure any mode of our Dynamixel we always must run our controller manager. You can find how to this in this tutorial: http://wiki.ros.org/dynamixel_controllers/Tutorials/ConnectingToDynamixelBus

Pinging the Motor

There is an easy way to ping your motor using a Python script. The interface is easy to use as shown below You can find the complete package at: https://github.com/clebercoutof/mixcell

  • first1.png

For instance, if we connect a Dynamixel to our computer, then suppose we don't know the id nor the baud rate, so we would select all baud rates and select a range of IDs (from 1 to 10)

  • second2.png

Realize that the motor found is a MX-28 with 57600 baud rate and ID 5. Those data are fundamentally important for anything we want to do with Dynamixel.

Joint Mode

First, let's understand what a joint is, imagine you want to control the arm of a robot, therefore you should rotate a certain angle and then the arm should freeze at the given angle, that's what a joint does. Configurating the Dynamixel to joint mode is the simplest configuration you can do. In order to do this, you should follow this tutorial: http://wiki.ros.org/dynamixel_controllers/Tutorials/CreatingJointPositionController

Wheel Mode

To use Wheel Mode, we must look up for the following package in our terminal

$ rosrun dynamixel_drivers set_servo_config.py

Realize that inside the package "dynamixel_drivers" there is a python script called "set_servo_config.py", which is the script to set parameters to Dynamixel. When giving the previous command we should see something like this in the terminal:

Options:
  -h, --help            show this help message and exit
  -p PORT, --port=PORT  motors of specified controllers are connected to PORT
                        [default: /dev/ttyUSB0]
  -b BAUD, --baud=BAUD  connection to serial port will be established at BAUD
                        bps [default: 1000000]
  -r RATE, --baud-rate=RATE
                        set servo motor communication speed
  -d DELAY, --return-delay=DELAY
                        set servo motor return packet delay time
  --cw-angle-limit=CW_ANGLE
                        set servo motor CW angle limit
  --ccw-angle-limit=CCW_ANGLE
                        set servo motor CCW angle limit
  --min-voltage-limit=MIN_VOLTAGE
                        set servo motor minimum voltage limit
  --max-voltage-limit=MAX_VOLTAGE
                        set servo motor maximum voltage limit

There are plenty of parameters, in this case we just want to put the Dynamixel in wheel mode. Now we give the following command

$ rosrun dynamixel_drivers set_servo_config.py 5 --baud=57600 --cw-angle-limit=0 
--ccw-angle-limit=0

The first parameter, which is "5" is related to our Dynamixel's ID, in this case you should see your Dynamixel's ID before. The second parameter is the baud rate, there are plenty of baud rates available, you should also check it before. The two new parameters here are "--cw-angle-limit" and "--ccw-angle-limit". CW means clockwise and CCW means counterclockwise, so it makes sense to say that if we want our motor to fully rotate, then both CW and CCW limits should be 0.

Multi-turn Mode

This mode allows the dynamixel to receive a goal bigger than 4095 (4095 beign a full rotation). It's important to say that the Multi-turn mode is only available in some servos from Dynamixel, you should check the documentation before trying anything. You can find the tutorial for this mode in this link: http://wiki.ros.org/dynamixel_controllers/Tutorials/CreatingAMultiTurnJointController

An easy way

Instead of having all this hard work, we could simply use the script above, it also gives the ability of setting Dynamixel to any mode we want, such as setting gains, new baud rates, IDs and maximum torque.

  • final1.png

Wiki: dynamixel_controllers/Tutorials/SettingUpDynamixel (last edited 2017-08-15 12:49:03 by henriquePoleselo)