1
$\begingroup$

I'm trying to get the "Torobot" USB servo controller to work with Angstrom Linux on a Beagle Board XM.

The servo controller registers as a USB device. The device just takes simple text commands, but there is no TTY associated with it. So I'm not sure how to send commands to it.

Can I just send data like this (assuming that 002/005 is the device):

$ cat file.txt >> /dev/bus/usb/002/005

Or do I need to associate it with the generic USB device? If so, how do I do that?

$\endgroup$
1
$\begingroup$

you can pyusb for send data http://pyusb.sourceforge.net/docs/1.0/tutorial.html and your data information is here http://www.torobot.com/down/usc_en.pdf i think you python code like this

    import usb.core
import usb.util

# find our device
dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)

# was it found?
if dev is None:
    raise ValueError('Device not found')

# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()

# get an endpoint instance
cfg = dev.get_active_configuration()
interface_number = cfg[(0,0)].bInterfaceNumber
alternate_settting = usb.control.get_interface(interface_number)
intf = usb.util.find_descriptor(
    cfg, bInterfaceNumber = interface_number,
    bAlternateSetting = alternate_setting
)

ep = usb.util.find_descriptor(
    intf,
    # match the first OUT endpoint
    custom_match = \
    lambda e: \
        usb.util.endpoint_direction(e.bEndpointAddress) == \
        usb.util.ENDPOINT_OUT
)

assert ep is not None

# write the data
ep.write('#1P1500T100\r\n')
$\endgroup$
  • $\begingroup$ cool - I'll have to dust off my (weak) python chops...but will give it a try. Thanks! $\endgroup$ – ChronoFish Aug 29 '13 at 19:04
  • $\begingroup$ thanks... there a lot of dependencies that don't come on the Angstrom distribution for this. I have filled most of those, but still getting errors. See my latest question: robotics.stackexchange.com/questions/2132/… $\endgroup$ – ChronoFish Dec 7 '13 at 23:41
  • $\begingroup$ I could not get pyUSB to work - but I did find away to access the board directly through the tty $\endgroup$ – ChronoFish Dec 15 '13 at 9:24
0
$\begingroup$

Finally Success:

I found that the Torobot USB board could be communicated with an Arduino serial driver. Conveniently this is available through opkg:

opkg install kernel-module-cdc-acm

When the board is plugged in, it comes up as

/dev/ttyACM0 

From here you can simply echo commands to the device.

echo "#8P1500T100" > /dev/ttyACM0

This basically says "set servo 8 to position 1500 with speed 100"

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.