artoo-leapmotion 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -19
- data/artoo-leapmotion.gemspec +1 -1
- data/examples/leap_hands.rb +27 -0
- data/lib/artoo-leapmotion/version.rb +1 -1
- data/lib/artoo/drivers/leapmotion.rb +3 -1
- data/lib/artoo/drivers/leapmotion/hand.rb +12 -0
- data/test/drivers/leapmotion_driver_test.rb +2 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 162af68408d602a5a482333ebd39a2cecc40b74b
|
4
|
+
data.tar.gz: 848c559000f80727272dcab898fbca94cff5aa0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b786d357bba4156462f78fc56f3ae959779c02116bc7d1a860a5c7aa3fe2012e61dde60b1addd5f77e0708086c433e5e0589059eb402ed12d9962283d13f577d
|
7
|
+
data.tar.gz: baae8130ea437b2ad93113b6a6d3f4e1181eb57b9b1d7741e5555b9192c0051b28be0e17e4be8c1c0b77b14c69d60e69f9924020c2a3d311e2d501adc535c4e5
|
data/Gemfile.lock
CHANGED
@@ -1,59 +1,56 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
artoo-leapmotion (0.
|
5
|
-
artoo (~> 1.
|
4
|
+
artoo-leapmotion (0.2.0)
|
5
|
+
artoo (~> 1.2.0)
|
6
6
|
hybridgroup-celluloid-websocket-client
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
artoo (1.
|
11
|
+
artoo (1.2.0)
|
12
12
|
celluloid (~> 0.15.0)
|
13
13
|
celluloid-io (~> 0.15.0)
|
14
14
|
multi_json (~> 1.6)
|
15
15
|
pry (~> 0.9)
|
16
16
|
rake (~> 10.0)
|
17
|
-
reel (~> 0.4.0
|
17
|
+
reel (~> 0.4.0)
|
18
18
|
thor (~> 0.18.1)
|
19
|
-
celluloid (0.15.
|
19
|
+
celluloid (0.15.1)
|
20
20
|
timers (~> 1.1.0)
|
21
21
|
celluloid-io (0.15.0)
|
22
22
|
celluloid (>= 0.15.0)
|
23
23
|
nio4r (>= 0.5.0)
|
24
|
-
certified (0.1.1)
|
25
24
|
coderay (1.0.9)
|
26
|
-
http (0.
|
27
|
-
certified
|
25
|
+
http (0.5.0)
|
28
26
|
http_parser.rb
|
29
|
-
http_parser.rb (0.
|
27
|
+
http_parser.rb (0.6.0.beta.2)
|
30
28
|
hybridgroup-celluloid-websocket-client (0.0.3)
|
31
29
|
celluloid-io
|
32
30
|
websocket-driver
|
33
31
|
metaclass (0.0.1)
|
34
32
|
method_source (0.8.2)
|
35
|
-
minitest (5.0.
|
33
|
+
minitest (5.0.7)
|
36
34
|
minitest-happy (1.0.0)
|
37
35
|
mocha (0.14.0)
|
38
36
|
metaclass (~> 0.0.1)
|
39
|
-
multi_json (1.
|
37
|
+
multi_json (1.8.0)
|
40
38
|
nio4r (0.5.0)
|
41
39
|
pry (0.9.12.2)
|
42
40
|
coderay (~> 1.0.5)
|
43
41
|
method_source (~> 0.8)
|
44
42
|
slop (~> 3.4)
|
45
|
-
rack (1.5.2)
|
46
43
|
rake (10.1.0)
|
47
|
-
reel (0.4.0
|
48
|
-
celluloid
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
websocket_parser (>= 0.1.
|
44
|
+
reel (0.4.0)
|
45
|
+
celluloid (>= 0.15.1)
|
46
|
+
celluloid-io (>= 0.15.0)
|
47
|
+
http (>= 0.5.0)
|
48
|
+
http_parser.rb (>= 0.6.0.beta.2)
|
49
|
+
websocket_parser (>= 0.1.4)
|
53
50
|
slop (3.4.6)
|
54
51
|
thor (0.18.1)
|
55
52
|
timers (1.1.0)
|
56
|
-
websocket-driver (0.
|
53
|
+
websocket-driver (0.3.0)
|
57
54
|
websocket_parser (0.1.4)
|
58
55
|
http
|
59
56
|
|
data/artoo-leapmotion.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_runtime_dependency 'artoo', '~> 1.
|
22
|
+
s.add_runtime_dependency 'artoo', '~> 1.2.0'
|
23
23
|
s.add_runtime_dependency 'hybridgroup-celluloid-websocket-client'
|
24
24
|
s.add_development_dependency 'minitest', '~> 5.0'
|
25
25
|
s.add_development_dependency 'minitest-happy'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
connection :leapmotion, :adaptor => :leapmotion, :port => '127.0.0.1:6437'
|
4
|
+
device :leapmotion, :driver => :leapmotion
|
5
|
+
|
6
|
+
work do
|
7
|
+
on leapmotion, :open => :on_open
|
8
|
+
on leapmotion, :hand => :on_hand
|
9
|
+
on leapmotion, :close => :on_close
|
10
|
+
end
|
11
|
+
|
12
|
+
def on_open(*args)
|
13
|
+
puts args
|
14
|
+
end
|
15
|
+
|
16
|
+
def on_hand(*args)
|
17
|
+
hand = args[1]
|
18
|
+
puts "#{scale_to_servo(hand.palm_x, -200, 200)},#{scale_to_servo(hand.palm_y, -130, 130)}" if hand
|
19
|
+
end
|
20
|
+
|
21
|
+
def on_close(*args)
|
22
|
+
puts args
|
23
|
+
end
|
24
|
+
|
25
|
+
def scale_to_servo(val, min, max)
|
26
|
+
(((val - min) / (max - min)) * 180).ceil
|
27
|
+
end
|
@@ -33,7 +33,9 @@ module Artoo
|
|
33
33
|
frame = Artoo::Drivers::Leapmotion::Frame.new(message)
|
34
34
|
publish(event_topic_name("frame"), frame)
|
35
35
|
|
36
|
-
frame.
|
36
|
+
frame.hands.each {|h| publish(event_topic_name("hand"), h)} if frame.hands
|
37
|
+
frame.gestures.each {|g| publish(event_topic_name("gesture"), g)} if frame.gestures
|
38
|
+
frame.pointables.each {|p| publish(event_topic_name("pointable"), p)} if frame.pointables
|
37
39
|
else
|
38
40
|
publish(event_topic_name("error"), data)
|
39
41
|
end
|
@@ -19,6 +19,18 @@ module Artoo
|
|
19
19
|
self.class.send(:define_method, k.to_sym, lambda { instance_variable_get("@#{k}") })
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
def palm_x
|
24
|
+
palmPosition[0] if palmPosition
|
25
|
+
end
|
26
|
+
|
27
|
+
def palm_y
|
28
|
+
palmPosition[2] if palmPosition
|
29
|
+
end
|
30
|
+
|
31
|
+
def palm_z
|
32
|
+
palmPosition[1] if palmPosition
|
33
|
+
end
|
22
34
|
end
|
23
35
|
end
|
24
36
|
end
|
@@ -15,7 +15,9 @@ describe Artoo::Drivers::Leapmotion do
|
|
15
15
|
@connection = mock('connection')
|
16
16
|
@device.stubs(:connection).returns(@connection)
|
17
17
|
@frame = mock('frame')
|
18
|
+
@frame.stubs(:hands).returns([])
|
18
19
|
@frame.stubs(:gestures).returns([])
|
20
|
+
@frame.stubs(:pointables).returns([])
|
19
21
|
Artoo::Drivers::Leapmotion::Frame.stubs(:new).returns(@frame)
|
20
22
|
end
|
21
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artoo-leapmotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ron Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: artoo
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: hybridgroup-celluloid-websocket-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- artoo-leapmotion.gemspec
|
97
97
|
- examples/leap.rb
|
98
98
|
- examples/leap_gesture.rb
|
99
|
+
- examples/leap_hands.rb
|
99
100
|
- lib/artoo-leapmotion.rb
|
100
101
|
- lib/artoo-leapmotion/version.rb
|
101
102
|
- lib/artoo/adaptors/leapmotion.rb
|