ArbotiX-M Robocontroller
This tutorial will show you how to use the Arbotix-M Robocontroller board to control DYNAMIXEL servos with ROS.
1. Flash the Arbotix board
Before you can use the Arbotix board with ROS, you need to flash a proper firmware. Follow the Quick Start Guide from TrossenRobotics to learn how to program the board with Arduino IDE.
If you have successfully programmed the example sketches, open and upload the following sketch:
The rest of this tutorial can be done in any machine that runs ROS and have an Internet connection. It can be Leo Rover
pageConnect via SSHpageConnect to a local network and the Internetor your computer
pageInstall ROS on your computer2. Install Arbotix ROS driver
The driver for Arbotix board is distributed in arbotix package. It can be installed from official repository just by typing:
replace [DISTRO]
with the ROS distribution you are using (If you are on LeoOS, type: melodic
).
3. Set Dynamixel IDs and test the servos
Make sure your setup looks like this:
Then, type in your terminal:
arbotix_terminal
by default, assumes the board is connected on /dev/ttyUSB0
port. If it is attached to another device, you can specify it like this:
To check which port the device connects to, you can, for instance, run dmesg -w
(Ctrl+C to exit), connect the device and check kernel logs.
If you are using Ubuntu on Windows Subsytem for Linux
, you need to open Device Manager and look under Ports for COM port number of the device. COM[N]
corresponds to /dev/ttyS[N]
path. (e.g. COM4 -> /dev/ttyS4). You might need to run:
A terminal prompt should appear. Type help
for the list of commands.
Connect the Dynamixel you want to set id to. Then type ls
to see id of connected servo and mv [source] [target]
to change it. For example, when the servo has ID 1 and we want to set it to 2, just type:
When you have connected multiple servos, this command will change ALL servos with ID [source]
(1 in this example) to ID [target]
.
You can also read and change some parameters to test servo movement with get
and set
commands. For example, to read current position of servo with ID 1, type:
To move the servo to position 300 (the range is between 0 and 1023), type:
To set the goal speed of the servo to half of the maximum, type:
The servo should start moving continuously in one direction.
4. Test the ROS driver
We will create a package that tests the arbotix driver. Let's start by creating a catkin workspace (if you don't have one yet):
and an empty package:
Inside the package, create config/test.yaml
file with the following content:
You might need to change to port
parameter
You can set more parameters for each joint, like maximum speed, minimum and maximum angle etc. A brief documentation (Unfortunately, a little outdated) can be found here.
And launch/test.launch
with the following:
Build the package and source
the result space:
Now, run the launch file, by typing:
You should see new topics spawned (check with rostopic list
):
And new services (check with rosservice list
):
To shortly summarize the features:
/dynamixelX/command
topic will enable the torque and move the servo with ID X to a specified position if published to. The position is specified in radians./dynamixelX/enable
service will just enable the torque on the servo./dynamixelX/relax
service will relax the servo (disable the torque)./dynamixelX/set_speed
service will set the speed the servo will move with when it receives a new command. The speed is specified in radians per second.The current joint positions and velocities are published to
/joint_states
topic.
We can try to test the features using rostopic
and rosservice
tools.
Assuming you have connected the servo with ID 1, start by setting the speed to a safe value (0.2 rad/s in this case):
Move servo to a default neutral value:
The maximum angle range for a Dynamixel servo is [-150, 150] degrees which is equal to approximately [-2.62, 2.62] in radians
Relax joint:
Last updated