Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Creating Modules with Ruby for Unsuported USB Hardware

For general discussion related FlowStone

Creating Modules with Ruby for Unsuported USB Hardware

Postby granta1969 » Thu May 02, 2013 5:26 pm

Hello. I've been working on a little project which uses Servo controlles. Flowstone supports servos by a company called Phidgets. When I went to the Phidgets website I was disapointed to see that their cheapest usb servo controller was about £40 and it only supported one servo. If you want to control up to 6 you're looking at nearly £200. I noticed on the phidgets website that they provided programming examples and saw they even provided samples for Ruby.

After searching the web I found an ideal usb servo controller by the Polulu company for £15 which supports 6 independant servos. The Micro Maestro 6-Channel USB Servo ControllerPerfect. It's a company based in Las Vegas Nevada but Proto-Pic here in the U.K. sells it. Only one problem though. How do I use Flowstone to control it? Well the people at Polulu have considered this sort of problem. They have designed it to work with a Com Port to usb converter driver. and since flowstone supports a Com Port module it should be easy to send com port commands to the usb device via the com port converter driver. It's not really an ideal solution though. ideally you want flowstone to directly control the device.

the question here is this. Is it possible for Ruby to work with any unkown usb device that you might install onto your system? I'm assuming of course that you have the driver for the device and it's installed. Would ruby be able to directly control The Micro Maestro without using the Com Port driver and the com port module? You would think it would.. I'm still learning it though and I havent' gotten very far.

I'm going to buy the Maestro and experiment with the com port driver at first just to get things up and running.. But does anyone here have knowledge if it's possible to get Ruby to control the device itself? the Maestro comes with lots of documentation and all that. it comes with programming examples, but unfortunately not ruby examples.

any insights would be greatly appreciated!

Grant
granta1969
 
Posts: 7
Joined: Fri Sep 21, 2012 5:11 am

Re: Creating Modules with Ruby for Unsuported USB Hardware

Postby fixstuff555 » Thu May 02, 2013 6:27 pm

As far as I know, Pololu's protocol is the same among their other modules. I tested out their 24V23 modules, and made a 4ch FS project a while back. If you look in the module itself, you'll see 4 modules on the right labeled "Front Left", Rear Left", etc. Inside those modules is the way I used to communicate with the Pololu hardware over the COM port. Porting it over to Ruby shouldn't be to tough.

Here is the previous post with it:

http://www.dsprobotics.com/support/viewtopic.php?f=3&t=608
fixstuff555
 
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

Re: Creating Modules with Ruby for Unsuported USB Hardware

Postby fixstuff555 » Thu May 02, 2013 6:37 pm

Belay that. I used the ASCII protocol, and the Maestro doesn't have that one...
fixstuff555
 
Posts: 151
Joined: Thu Oct 21, 2010 3:24 pm

Re: Creating Modules with Ruby for Unsuported USB Hardware

Postby trogluddite » Thu May 02, 2013 8:47 pm

granta1969 wrote:ideally you want flowstone to directly control the device.

It looks like that may be possible - Pololu also have a USB SDK available for direct USB comm's, so that you can access the features not available through the serial interface.
Such an SDK usually just consists of a bunch of .dll files containing the necessary functions - and Ruby is able to call any .dll function using it's Win32API class.
Without looking at the SDK doc's in much more detail, it's hard to tell how difficult this would be - but .dll calls have a fairly standard format so long as the SDK describes the functions in adequate detail. You can then define a bunch of Ruby methods to "wrap" the dll calls to make them more user-friendly for day-to-day use.

Don't dismiss the serial interface though. Serial-via-USB is used by a lot of devices out there because it does make life mush simpler - you can typically communicate by just building strings of encoded characters (something else Ruby is very good at). And the Pololu hardware handles all the tricksy PWM for you, so the number and speed of commands you send would be dramatically less than if you had to generate those signals yourself - meaning that the relatively slow speed of serial would be unlikely to cause any serious headaches in practice.

Looks like a very nice bit of kit - especially at that price!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Creating Modules with Ruby for Unsuported USB Hardware

Postby brighton36 » Tue Aug 27, 2013 2:29 am

Try the newer phidgets_native gem instead of the phidgets-ffi gem. There's no ffi requirement, it's faster, and way more stable. Probably that will help you out tremendously.
brighton36
 
Posts: 1
Joined: Tue Aug 27, 2013 2:27 am


Return to General

Who is online

Users browsing this forum: No registered users and 62 guests