In [2]:
import pypot.dynamixel
ports = pypot.dynamixel.get_available_ports()
if not ports:
raise IOError('no port found!')
print 'ports found', ports
Protocol is not the same for XL320 servomotors, set the using_XL320 flag to True if you use them. Set my_baudrate to the baudrate you are using (1000000 for motors already configured, 57600 for new ones).
In [3]:
using_XL320 = False
my_baudrate = 1000000
If the code below gives you an exception, try to restart all other notebooks that may be running, wait 5 seconds and try again.
In [4]:
for port in ports:
print port
try:
if using_XL320:
dxl_io = pypot.dynamixel.Dxl320IO(port, baudrate=my_baudrate)
else:
dxl_io = pypot.dynamixel.DxlIO(port, baudrate=my_baudrate)
print "scanning"
found = dxl_io.scan(range(60))
print found
dxl_io.close()
except Exception, e:
print e
Kill whoever uses the ports (should be used only as last chance try to free the ports).
In [ ]:
import os
for port in ports:
os.system('fuser -k '+port);
In [ ]: