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 Servo IDs
Description: This tutorial shows how to set servo IDs using the terminal program.Tutorial Level: BEGINNER
Contents
Overview
By default, each servo ships with an ID of 1, so we usually need to program the servos with new IDs before use. The easiest way to do this is to connect the ArbotiX to the PC using the USB cable, and then attach one servo at a time, setting the ID using the terminal program.
The terminal works like a typical Linux terminal. Typing ls will query the ArbotiX for the attached servos and print the number of each (searching up to ID 18). If you attach a single servo, you should get just "1" when you type ls and a number of .... for each servo ID not attached. You can then move this servo to a new ID using the mv old_id new_id command.
Let's move our servo #1 to ID 2:
$ rosrun arbotix_python terminal.py ArbotiX Terminal --- Version 0.1 Copyright 2011 Vanadium Labs LLC >> ls 1 .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... >> mv 1 2 OK >> ls .... 2 .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ....
The terminal has several other commands. Typing help will list all commands:
>> help ArbotiX Terminal V0.1 valid commands: ls - list the servos found on the bus. mv id id2 - rename any servo with ID=id, to id2 baud b - set baud rate of bus to b get param id - get a parameter value from a servo set param id val - set parameter on servo ID=id to val valid parameters pos - current position of a servo, 0-1023 baud - baud rate temp - current temperature, degrees C, READ ONLY