■ FIGURE 4. Dynamixel interface schematic.
with 1K between the Propeller pin and the pull-up will
work, too (see the object code for the alternate
connection).
■ FIGURE 5.
Dynamixel
After downloading the program, open a terminal
window and then press a key. You'll see a menu for setting
the baud rate for the driver — press [1] for 1,000,000 baud
scanner
report.
(unless you know your actuators have been set to a
different rate). After that, the code uses a method called
scan to document any devices connected to the Propeller.
In the middle of the scan method, you'll find this loop
which uses the driver's ping method:
■ FIGURE 6.
JonnyMac Jr.
platform.
repeat id from $00 to $FD
cursor_xy(12, 6)
show_id(id)
if (dy.ping(id) == id)
cursor_xy(0, devices+8)
term.str(string("--> "))
show_id(id)
devices += 1
pause(50)
This code loops through all possible IDs, pings
each, and if there is a successful response it is noted
on the output. When complete, the number of
devices detected is displayed. Figure 5 shows the
result of the program running on my test setup.
Note that there is a 50 ms delay between
packets. While talking with Kyle at Trossen Robotics, I
got the impression that Dynamixels — even with their
crazy-fast default baud rate — don't want to deal with
more than about 30 packets per second. While I
cannot find any documentation to support this, the
guys at Trossen have a lot of experience with the
Dynamixels and have been incredibly helpful when
I've called. This helps explain the use of Sync Write;
while a bit fussy to set up, it allows one to update
registers in several actuators using a single packet.
While ping is useful to inventory devices
connected to a system, that's about where its utility
ends. To do useful things with the Dynamixel, we
need to read and write registers. The driver includes
low-level methods called read_data and write_data.
16 November 2013