Notice: MediaWiki has been updated. Report any rough edges to marcan@marcan.st

Difference between revisions of "Ruby Wrapper"

From OpenKinect
Jump to: navigation, search
(Current Status)
(Sample Code)
 
(2 intermediate revisions by 2 users not shown)
Line 48: Line 48:
 
== Sample Code ==
 
== Sample Code ==
  
<source lang="ruby" border="1">
+
this project is dead as it seams (correct me if i'm wrong) ... here's an active one: https://github.com/pachacamac/rinect
require 'rubygems'
 
require 'usb'
 
 
 
LED_STATES = {:off=>0, :green=>1, :red=>2, :yellow=>3, :blink_yellow=>4, :blink_green=>5, :blink_red_yellow=>6, :blink_red_green=>7}
 
def set_led(state)
 
  begin
 
    @@led_device ||= USB.devices.select{|d| d.idVendor==0x045e && d.idProduct==0x02b0}.first
 
    @@led_handle ||= @@led_device.usb_open
 
    @@led_handle.usb_control_msg 0x40, 0x06, state, 0x0000, '', 0
 
  rescue Exception => e 
 
    puts e.message
 
  end
 
end
 
 
 
def set_motor(pitch)
 
  begin
 
    @@motor_device ||= USB.devices.select{|d| d.idVendor==0x045e && d.idProduct==0x02b0}.first
 
    @@motor_handle ||= @@motor_device.usb_open
 
    pitch = -35 if pitch < -35
 
  pitch = 55 if pitch > 55
 
    @@motor_handle.usb_control_msg 0x40,0x31,pitch,0x0000,'',0
 
  rescue Exception => e 
 
    puts e.message
 
  end
 
end
 
</source>
 
 
 
<source lang="ruby" border="1">
 
puts "puts works"
 
puts " with line breaks."
 
 
 
print "print works"
 
print " with no line breaks."
 
 
 
printf("\n\nprintf formats numbers like %7.2f, and
 
strings like %s.",3.14156,"me")
 
</source>
 
 
 
(Random code I lifted from somewhere that's not Kinect related just to show how this page should look)
 
  
 
[[Category:Wrappers]]
 
[[Category:Wrappers]]

Latest revision as of 02:05, 6 January 2011

This effort will provide a wrapper to access the Kinect through Ruby.

About

Who is involved

Coordinator/Development: Aditya Gaddam (User:LostInCake)

Current Status

Feature Supported? Notes
Connect to Kinect (heh) No (Possible values are Yes/No/Partial) Not started main development
Control LED yes
Control motor yes
Get accelerometer data No
RGB data callback No
Depth data callback No

Demos / Videos

Some demo links / videos / images will go here

Installation/Configuration

  1. Step one
  2. Step two
  3. Step three


Sample Code

this project is dead as it seams (correct me if i'm wrong) ... here's an active one: https://github.com/pachacamac/rinect