robotic-arm 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/robotic-arm.rb +10 -10
- metadata +2 -2
data/lib/robotic-arm.rb
CHANGED
@@ -21,6 +21,8 @@ class RoboticArm
|
|
21
21
|
def active?() @active end
|
22
22
|
|
23
23
|
def activate(switch, val, seconds=0)
|
24
|
+
|
25
|
+
return if val == @previous_val
|
24
26
|
|
25
27
|
@active = val >= 0
|
26
28
|
@prev_val = val
|
@@ -54,12 +56,12 @@ class RoboticArm
|
|
54
56
|
super(robot_arm)
|
55
57
|
@switch, @val = 0, OFF
|
56
58
|
end
|
57
|
-
|
58
|
-
protected
|
59
59
|
|
60
60
|
def stop() (@active = false; activate(@switch, -(@prev_val))) if moving? end
|
61
61
|
|
62
62
|
alias moving? active?
|
63
|
+
|
64
|
+
protected
|
63
65
|
|
64
66
|
def activate(switch, val, seconds=0)
|
65
67
|
(@val = @prev_val; stop) if active?
|
@@ -69,11 +71,9 @@ class RoboticArm
|
|
69
71
|
end
|
70
72
|
|
71
73
|
class ComponentUpDown < ComponentMoving
|
72
|
-
|
73
|
-
protected
|
74
74
|
|
75
75
|
def up (seconds=0) activate(@switch, @upval, seconds) end
|
76
|
-
def down(seconds=0) activate(@switch, @downval, seconds) end
|
76
|
+
def down(seconds=0) activate(@switch, @downval, seconds) end
|
77
77
|
end
|
78
78
|
|
79
79
|
class Shoulder < ComponentUpDown
|
@@ -155,17 +155,17 @@ class RoboticArm
|
|
155
155
|
# turn off all active signals
|
156
156
|
#
|
157
157
|
def off()
|
158
|
-
|
159
|
-
|
158
|
+
led.off if on?
|
159
|
+
stop
|
160
160
|
@handle.release_interface(0)
|
161
161
|
end
|
162
162
|
|
163
163
|
# stop all robotic movement
|
164
164
|
#
|
165
165
|
def stop()
|
166
|
-
|
167
|
-
|
168
|
-
|
166
|
+
[wrist, elbow, shoulder, base, grip].each do |motor|
|
167
|
+
motor.stop if motor.moving?
|
168
|
+
end
|
169
169
|
end
|
170
170
|
|
171
171
|
private
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: robotic-arm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- James Robertson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-12-
|
13
|
+
date: 2012-12-20 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: libusb
|