Ruby client for Crazyflie (Crubyflie)

Firmware/software/electronics/mechanics
Post Reply
hsanjuan
Beginner
Posts: 19
Joined: Sat Jul 20, 2013 10:51 am

Ruby client for Crazyflie (Crubyflie)

Post by hsanjuan »

Hello,

Since I didn't know where to start contributing, I started by trying to understand the pc client code better by rewriting it. The outcome is Ruby bindings for the Crazyflie (more or less a lightweight clone of the basic current pytho pc-client), which I have released them as a gem (Crubyflie).

So far it can read/write parameters, logging blocks, send commands etc. and of course, fly the Crazyflie using a joystick controller!

If you would like to use it/test/contribute to it visit https://github.com/hsanjuan/crubyflie :)

Thanks for creating this beautiful device and keep the good work up!
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Ruby client for Crazyflie (Crubyflie)

Post by tobias »

That is a lot of work, and great work :D.
I know Arnaud will be pleased with a Ruby client as he always talks so well about Ruby (compared to python)!
emson
Beginner
Posts: 1
Joined: Mon Sep 23, 2013 9:05 pm

Re: Ruby client for Crazyflie (Crubyflie)

Post by emson »

Hi All
I'm using the crubyflie Ruby library on OSX, and seem to have successfully installed all the dependencies:


However when I try and connect to the crazyflie over the USB radio I get the following error message:

Code: Select all

  LIBUSB::ERROR_NO_DEVICE in libusb_set_configuration
I suspect that on a Linux machine I could set the udev rules:

Code: Select all

  SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE="0664", GROUP="plugdev"
However I'm unsure how to set the libusb configuration on an OSX machine.
I wrote a quick driver check script and can see the USB radio device on my machine:

Code: Select all

  require "libusb"
  usb = LIBUSB::Context.new
  device = usb.devices.last
  puts device.inspect
Any tips or ideas would be greatly appreciated.
Many thanks
hsanjuan
Beginner
Posts: 19
Joined: Sat Jul 20, 2013 10:51 am

Re: Ruby client for Crazyflie (Crubyflie)

Post by hsanjuan »

Hello there,

Im not really sure what this means and know little about OSX.

I suspect the offending line is 112 here:

https://github.com/hsanjuan/crubyflie/b ... io.rb#L112

I am not sure it has to do with udev rules (can you run it with root and check?). If Ruby sees your dongle, you could do further testing

Code: Select all

require "libusb"
usb = LIBUSB::Context.new
device = usb.devices.first # we use the first dongle available
puts device.inspect
handle = devices.open()
handle.configuration = 1
handle.claim_interface(0)
that is basicly what the ruby code does to the dongle. See if you can find where it exactly breaks...

I think it would be good if you could open an issue in https://github.com/hsanjuan/crubyflie to track this.
absoloodle37
Member
Posts: 46
Joined: Sun Jun 09, 2013 3:04 am

Re: Ruby client for Crazyflie (Crubyflie)

Post by absoloodle37 »

emson wrote:Hi All
I'm using the crubyflie Ruby library on OSX, and seem to have successfully installed all the dependencies:


However when I try and connect to the crazyflie over the USB radio I get the following error message:

Code: Select all

  LIBUSB::ERROR_NO_DEVICE in libusb_set_configuration


Emson, I had the same problem when trying to install the Python CF client on my iMac. For some reason the system didn't recognize or detect my USB dongle. Then I tried the same steps to install the Python client on my Macbook Air, and the system detected the USB radio dongle just fine. So now I can fly my CF using my MB Air--even though it has the same version of OSX (Mountain Lion) as my iMac.

I suggest trying to at least get the Python CF client working, so you can at least isolate the problem to the Ruby version, rather than issues with your Mac itself. If you can't even get the Python client working, than try another Mac machine. Otherwise, I'm not sure what else to do...
I can vouch for the Crubyflie client, however. I have it on my Rasberry Pi, and it's awesome! I can edit the control parameters file via SSH (X mode, 100% thrust, etc.) and there's way more speed & flexibility with the program than the CF headless version on an R-Pi. On a Mac machine with lots of processing power, however, I don't see an advantage over the Python client because the Python version has a GUI and greater versatility (firmware updating, attitude indicator, etc.).
hsanjuan
Beginner
Posts: 19
Joined: Sat Jul 20, 2013 10:51 am

Re: Ruby client for Crazyflie (Crubyflie)

Post by hsanjuan »

Hi people,

I have got my Crazyflie out of the drawer, upgraded the firmware etc, and have added hover support to the Crubyflie gem (v.0.2.1) (https://github.com/hsanjuan/crubyflie), in case anyone is interested.

Cheers
Post Reply