justincinmd / ruby-ev3

Ruby Gem for Lego EV3
MIT License
8 stars 6 forks source link

I'm interested in helping #1

Closed rscottm closed 10 years ago

rscottm commented 10 years ago

Hi @jcnnghm,

I came across your ruby-ev3 repository today, and am interested in helping out. I've been able to fire up the console, connect to a brick via bluetooth, and do the basics (beep & spin a motor). I'd love to help move this forward if you're interested.

I'm also interested in seeing if I can get his working with another project I work on ruboto (JRuby on Android):

https://github.com/ruboto/ruboto

Thanks, Scott

justincinmd commented 10 years ago

Hey @rscottm,

I am definitely interested in getting some help on this. In particular, I'd like to get a USB adapter working and write at least on input adapter before releasing an alpha version of the gem. The USB adapter is a little tricky because the EV3 is a HID device, which prevents most (perhaps all) of the existing cross-platform usb libraries from working with it. Last I looked at it, I thought the easiest way forward would probably be wrapping hidapi.h using ffi in a separate gem, then using that gem to write an adapter similar to the wifi/bluetooth adapters. I started down that path, then other stuff kind of got in the way. I'd be happy to share that code if it's something you're interested in working on.

Justin

rscottm commented 10 years ago

I don't have any experience with USB & HID, but I can give it a shot. I was looking at:

https://github.com/larskanis/libusb

It looks like it has some HID support.

On Sun, Aug 10, 2014 at 12:10 AM, jcnnghm notifications@github.com wrote:

Hey @rscottm https://github.com/rscottm,

I am definitely interested in getting some help on this. In particular, I'd like to get a USB adapter working and write at least on input adapter before releasing an alpha version of the gem. The USB adapter is a little tricky because the EV3 is a HID device, which prevents most (perhaps all) of the existing cross-platform usb libraries from working with it. Last I looked at it, I thought the easiest way forward would probably be wrapping hidapi.h using ffi in a separate gem, then using that gem to write an adapter similar to the wifi/bluetooth adapters. I started down that path, then other stuff kind of got in the way. I'd be happy to share that code if it's something you're interested in working on.

Justin

— Reply to this email directly or view it on GitHub https://github.com/jcnnghm/ruby-ev3/issues/1#issuecomment-51708110.

grumpit commented 10 years ago

There may also be some tools to borrow from in the ev3dev repo: https://github.com/ev3dev/ev3dev although the approach there seems to be focused on command line tools.

How do you get this working on an EV3? Set up a debian install on a sim card, install ruby and then run it?

grumpit commented 10 years ago

Really excited about this repo, BTW. Would love to help any way I can.

grumpit commented 10 years ago

@jcnnghm @rscottm there's an old-ish repo for HID here: https://github.com/ozone1015/ruby-hidapi might be a starting point?

Update: NVM, looks like it's a dud, sorry

Another, more promising update: https://github.com/signal11/hidapi (arrived at via here: http://spin.atomicobject.com/2014/01/31/ruby-prototyping-ffi)

rscottm commented 10 years ago

@grumpit asked: How do you get this working on an EV3? Set up a debian install on a sim card, install ruby and then run it?

I think you're asking about running this code on an EV3. It's not designed to do that. This code runs run on another machine to communicate with the EV3. I used it on a Mac communicating to the EV3 via bluetooth:

1) I used Ruby 2.1.2 2) gem install serialport 3) Clone the git repository 4) Change to the repository directory 5) rake console 6) require 'ev3/connections/bluetooth' 7) c = EV3::Connections::Bluetooth.new 8) b = EV3::Brick.new(c) 9) b.connect 10) b.beep