artoo 0.5.0 → 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/.yardopts +1 -1
- data/CONTRIBUTORS.md +16 -0
- data/Gemfile +10 -9
- data/Gemfile.lock +31 -35
- data/README.md +110 -19
- data/Rakefile +0 -1
- data/api/assets/javascripts/artoo/controllers/robot.js.coffee +5 -8
- data/api/public/core.js +7 -12
- data/api/public/partials/robot-detail.html +1 -1
- data/bin/robi +1 -1
- data/examples/christmas_roomba.rb +16 -19
- data/examples/hello_api_multiple.rb +3 -2
- data/examples/notifications.rb +2 -2
- data/examples/sphero_messages.rb +9 -3
- data/lib/artoo/adaptors/test.rb +28 -0
- data/lib/artoo/connection.rb +5 -0
- data/lib/artoo/delegator.rb +1 -1
- data/lib/artoo/device.rb +13 -0
- data/lib/artoo/drivers/counter.rb +28 -0
- data/lib/artoo/drivers/pinger.rb +8 -11
- data/lib/artoo/drivers/random.rb +27 -0
- data/lib/artoo/drivers/test.rb +23 -0
- data/lib/artoo/master.rb +4 -2
- data/lib/artoo/robot.rb +11 -103
- data/lib/artoo/robot_class_methods.rb +147 -0
- data/lib/artoo/version.rb +1 -1
- data/test/robot_test.rb +3 -3
- data/test/test_helper.rb +1 -2
- metadata +10 -44
- data/bin/sphero.sh +0 -8
- data/bin/sphero_linux_bind.sh +0 -25
- data/bin/sphero_linux_socat.sh +0 -8
- data/examples/sphero2.rb +0 -26
- data/lib/artoo/adaptors/ardrone.rb +0 -41
- data/lib/artoo/adaptors/ardrone_navigation.rb +0 -33
- data/lib/artoo/adaptors/ardrone_video.rb +0 -35
- data/lib/artoo/adaptors/firmata.rb +0 -33
- data/lib/artoo/adaptors/roomba.rb +0 -51
- data/lib/artoo/adaptors/sphero.rb +0 -58
- data/lib/artoo/drivers/ardrone.rb +0 -15
- data/lib/artoo/drivers/ardrone_navigation.rb +0 -25
- data/lib/artoo/drivers/ardrone_video.rb +0 -27
- data/lib/artoo/drivers/button.rb +0 -59
- data/lib/artoo/drivers/led.rb +0 -48
- data/lib/artoo/drivers/motor.rb +0 -69
- data/lib/artoo/drivers/pinger2.rb +0 -27
- data/lib/artoo/drivers/roomba.rb +0 -179
- data/lib/artoo/drivers/servo.rb +0 -59
- data/lib/artoo/drivers/sphero.rb +0 -105
- data/lib/artoo/drivers/wiichuck.rb +0 -61
- data/lib/artoo/drivers/wiiclassic.rb +0 -139
- data/lib/artoo/drivers/wiidriver.rb +0 -102
- data/test/adaptors/ardrone_test.rb +0 -24
- data/test/adaptors/firmata_test.rb +0 -25
- data/test/adaptors/sphero_test.rb +0 -24
- data/test/drivers/ardrone_navigation_test.rb +0 -11
- data/test/drivers/ardrone_test.rb +0 -11
- data/test/drivers/ardrone_video_test.rb +0 -11
- data/test/drivers/led_test.rb +0 -56
- data/test/drivers/motor_test.rb +0 -40
- data/test/drivers/roomba_test.rb +0 -87
- data/test/drivers/servo_test.rb +0 -45
- data/test/drivers/sphero_test.rb +0 -54
- data/test/drivers/wiichuck_test.rb +0 -11
- data/test/drivers/wiiclassic_test.rb +0 -11
- data/test/drivers/wiidriver_test.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 731043a8242e8887c4cbff414816cdf7eadae2af
|
4
|
+
data.tar.gz: 6b0f65cd67cefd32098bea77d87adefcf7032d60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eddbdcfe51452b114468046a6e2d0fd4e3fd160ec377ab93a903fab4ce01bd60f6081b390db66e72beac6129828c4710a3ff774abef272def8220ac2cb414566
|
7
|
+
data.tar.gz: 6392e99e47cd6eaddcb69d98777afcf3cf4000a721632b42bfceb18242c2965c7fc150b3d32b87cf1d75fa19d39f2909d5f7b604c8694cefa827cdb01e08500d
|
data/.travis.yml
CHANGED
data/.yardopts
CHANGED
data/CONTRIBUTORS.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Artoo exists thanks to the work of these wonderful individuals:
|
2
|
+
|
3
|
+
- Adrian Zankich (@adzankich)
|
4
|
+
- Andrew Stewart (@stewart)
|
5
|
+
- Ari Lerner (@auser)
|
6
|
+
- Daniel Fischer (@dfischer)
|
7
|
+
- Jake Good (@whoisjake)
|
8
|
+
- Javier Cervantes (@solojavier)
|
9
|
+
- Kurtis Rainbolt-Greene (@krainboltgreene)
|
10
|
+
- Mario "Kuroir" Ricalde (@MarioRicalde)
|
11
|
+
- Mike Ford (@mikejford)
|
12
|
+
- Ron Evans (@deadprogram)
|
13
|
+
|
14
|
+
Thank you!
|
15
|
+
|
16
|
+
Please join us, we'd love your contribution too!
|
data/Gemfile
CHANGED
@@ -3,13 +3,6 @@ source "http://rubygems.org"
|
|
3
3
|
# Specify your gem's dependencies in artoo.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem "foreman"
|
7
|
-
|
8
|
-
# these are for specific hardware, they have to be here for tests
|
9
|
-
gem "hybridgroup-firmata", "~> 0.4.0"
|
10
|
-
gem "hybridgroup-sphero", "~> 1.3.0"
|
11
|
-
gem "hybridgroup-argus", "~> 0.3.0"
|
12
|
-
|
13
6
|
# For the front end web application
|
14
7
|
gem 'sass'
|
15
8
|
gem 'coffee-script'
|
@@ -22,13 +15,21 @@ gem 'guard-sprockets'
|
|
22
15
|
gem 'guard-compass'
|
23
16
|
gem 'rb-inotify', '~> 0.8.8'
|
24
17
|
gem 'execjs'
|
25
|
-
|
18
|
+
|
19
|
+
if RUBY_PLATFORM =~ /java/
|
20
|
+
gem 'therubyrhino'
|
21
|
+
else
|
22
|
+
gem 'therubyracer'
|
23
|
+
end
|
26
24
|
|
27
25
|
# For documentation
|
28
26
|
gem 'yard'
|
29
27
|
gem 'yard-sinatra'
|
30
|
-
gem '
|
28
|
+
gem 'kramdown'
|
31
29
|
|
32
30
|
# For tests
|
33
31
|
gem "minitest", "~> 5.0.1"
|
34
32
|
gem "mocha", '~> 0.14.0', :require => false
|
33
|
+
|
34
|
+
gem 'json', '~> 1.7.7'
|
35
|
+
gem "foreman"
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
artoo (0.
|
4
|
+
artoo (1.0.0.pre)
|
5
5
|
celluloid (~> 0.14.0)
|
6
6
|
celluloid-io (~> 0.14.0)
|
7
7
|
multi_json (~> 1.6)
|
@@ -12,7 +12,7 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: http://rubygems.org/
|
14
14
|
specs:
|
15
|
-
bootstrap-sass (2.
|
15
|
+
bootstrap-sass (2.3.1.0)
|
16
16
|
sass (~> 3.2)
|
17
17
|
celluloid (0.14.0)
|
18
18
|
timers (>= 1.0.0)
|
@@ -20,23 +20,22 @@ GEM
|
|
20
20
|
celluloid (>= 0.13.0)
|
21
21
|
nio4r (>= 0.4.5)
|
22
22
|
certified (0.1.1)
|
23
|
-
chunky_png (1.2.
|
23
|
+
chunky_png (1.2.8)
|
24
24
|
coderay (1.0.9)
|
25
25
|
coffee-script (2.2.0)
|
26
26
|
coffee-script-source
|
27
27
|
execjs
|
28
|
-
coffee-script-source (1.
|
28
|
+
coffee-script-source (1.6.2)
|
29
29
|
compass (0.12.2)
|
30
30
|
chunky_png (~> 1.2)
|
31
31
|
fssm (>= 0.2.7)
|
32
32
|
sass (~> 3.1)
|
33
33
|
dotenv (0.7.0)
|
34
|
-
em-websocket (0.
|
34
|
+
em-websocket (0.5.0)
|
35
35
|
eventmachine (>= 0.12.9)
|
36
36
|
http_parser.rb (~> 0.5.3)
|
37
|
-
|
38
|
-
eventmachine (1.0.
|
39
|
-
eventmachine (1.0.0-java)
|
37
|
+
eventmachine (1.0.3)
|
38
|
+
eventmachine (1.0.3-java)
|
40
39
|
execjs (1.4.0)
|
41
40
|
multi_json (~> 1.0)
|
42
41
|
ffi (1.8.1)
|
@@ -47,50 +46,50 @@ GEM
|
|
47
46
|
foreman (0.63.0-java)
|
48
47
|
dotenv (>= 0.7)
|
49
48
|
thor (>= 0.13.6)
|
49
|
+
formatador (0.2.4)
|
50
50
|
fssm (0.2.10)
|
51
|
-
guard (1.
|
51
|
+
guard (1.7.0)
|
52
|
+
formatador (>= 0.2.4)
|
52
53
|
listen (>= 0.6.0)
|
53
54
|
lumberjack (>= 1.0.2)
|
54
55
|
pry (>= 0.9.10)
|
55
|
-
terminal-table (>= 1.4.3)
|
56
56
|
thor (>= 0.14.6)
|
57
57
|
guard-compass (0.0.6)
|
58
58
|
compass (>= 0.10.5)
|
59
59
|
guard (>= 0.2.1)
|
60
|
-
guard-livereload (1.
|
60
|
+
guard-livereload (1.3.0)
|
61
61
|
em-websocket (>= 0.2.0)
|
62
62
|
guard (>= 1.5.0)
|
63
63
|
multi_json (~> 1.0)
|
64
|
-
guard-sprockets (0.4.
|
64
|
+
guard-sprockets (0.4.3)
|
65
65
|
execjs (~> 1.0)
|
66
66
|
guard (>= 1.1.0)
|
67
67
|
sprockets (~> 2.0)
|
68
|
-
hike (1.2.
|
68
|
+
hike (1.2.2)
|
69
69
|
http (0.4.0)
|
70
70
|
certified
|
71
71
|
http_parser.rb
|
72
72
|
http_parser.rb (0.5.3)
|
73
73
|
http_parser.rb (0.5.3-java)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
hybridgroup-sphero (1.3.0)
|
74
|
+
json (1.7.7)
|
75
|
+
json (1.7.7-java)
|
76
|
+
kramdown (1.0.2)
|
78
77
|
libv8 (3.11.8.17)
|
79
|
-
listen (0.7.
|
80
|
-
lumberjack (1.0.
|
78
|
+
listen (0.7.3)
|
79
|
+
lumberjack (1.0.3)
|
81
80
|
metaclass (0.0.1)
|
82
81
|
method_source (0.8.1)
|
83
82
|
minitest (5.0.1)
|
84
83
|
minitest-happy (1.0.0)
|
85
84
|
mocha (0.14.0)
|
86
85
|
metaclass (~> 0.0.1)
|
87
|
-
multi_json (1.
|
86
|
+
multi_json (1.7.3)
|
88
87
|
nio4r (0.4.5)
|
89
|
-
pry (0.9.12)
|
88
|
+
pry (0.9.12.2)
|
90
89
|
coderay (~> 1.0.5)
|
91
90
|
method_source (~> 0.8)
|
92
91
|
slop (~> 3.4)
|
93
|
-
pry (0.9.12-java)
|
92
|
+
pry (0.9.12.2-java)
|
94
93
|
coderay (~> 1.0.5)
|
95
94
|
method_source (~> 0.8)
|
96
95
|
slop (~> 3.4)
|
@@ -99,28 +98,27 @@ GEM
|
|
99
98
|
rake (10.0.4)
|
100
99
|
rb-inotify (0.8.8)
|
101
100
|
ffi (>= 0.5.0)
|
102
|
-
redcarpet (2.2.2)
|
103
101
|
reel (0.4.0.pre)
|
104
102
|
celluloid-io (>= 0.8.0)
|
105
103
|
http (>= 0.2.0)
|
106
104
|
http_parser.rb (>= 0.5.3)
|
107
105
|
rack (>= 1.4.0)
|
108
106
|
websocket_parser (>= 0.1.2)
|
109
|
-
ref (1.0.
|
110
|
-
sass (3.2.
|
111
|
-
slop (3.4.
|
112
|
-
spoon (0.0.
|
113
|
-
|
107
|
+
ref (1.0.5)
|
108
|
+
sass (3.2.9)
|
109
|
+
slop (3.4.5)
|
110
|
+
spoon (0.0.4)
|
111
|
+
ffi
|
112
|
+
sprockets (2.9.3)
|
114
113
|
hike (~> 1.2)
|
115
114
|
multi_json (~> 1.0)
|
116
115
|
rack (~> 1.0)
|
117
116
|
tilt (~> 1.1, != 1.3.0)
|
118
|
-
terminal-table (1.4.5)
|
119
117
|
therubyracer (0.11.4)
|
120
118
|
libv8 (~> 3.11.8.12)
|
121
119
|
ref
|
122
|
-
thor (0.
|
123
|
-
tilt (1.
|
120
|
+
thor (0.18.1)
|
121
|
+
tilt (1.4.1)
|
124
122
|
timers (1.1.0)
|
125
123
|
websocket_parser (0.1.2)
|
126
124
|
http
|
@@ -143,14 +141,12 @@ DEPENDENCIES
|
|
143
141
|
guard-compass
|
144
142
|
guard-livereload
|
145
143
|
guard-sprockets
|
146
|
-
|
147
|
-
|
148
|
-
hybridgroup-sphero (~> 1.3.0)
|
144
|
+
json (~> 1.7.7)
|
145
|
+
kramdown
|
149
146
|
minitest (~> 5.0.1)
|
150
147
|
minitest-happy
|
151
148
|
mocha (~> 0.14.0)
|
152
149
|
rb-inotify (~> 0.8.8)
|
153
|
-
redcarpet
|
154
150
|
sass
|
155
151
|
sprockets
|
156
152
|
therubyracer
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Artoo provides a simple, yet powerful domain-specific language (DSL) for robotic
|
|
12
12
|
|
13
13
|
### Basic
|
14
14
|
|
15
|
-
Arduino with an LED and a button, using the Firmata protocol.
|
15
|
+
#### Arduino with an LED and a button, using the Firmata protocol.
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
require 'artoo'
|
@@ -26,7 +26,7 @@ work do
|
|
26
26
|
end
|
27
27
|
```
|
28
28
|
|
29
|
-
Parrot ARDrone 2.0
|
29
|
+
#### Parrot ARDrone 2.0
|
30
30
|
|
31
31
|
```ruby
|
32
32
|
require 'artoo'
|
@@ -45,6 +45,8 @@ end
|
|
45
45
|
|
46
46
|
### Modular
|
47
47
|
|
48
|
+
You can also write more modular class-oriented code, that allows you to control swarms of robots:
|
49
|
+
|
48
50
|
```ruby
|
49
51
|
require 'artoo/robot'
|
50
52
|
|
@@ -71,7 +73,7 @@ SPHEROS.each {|p|
|
|
71
73
|
SpheroRobot.work!(robots)
|
72
74
|
```
|
73
75
|
|
74
|
-
Ruby versions supported: Ruby 2.0, Ruby 1.9.3, JRuby 1.7.
|
76
|
+
Ruby versions supported: Ruby 2.0, Ruby 1.9.3, JRuby 1.7.4, and Rubinius 2.0-rc1
|
75
77
|
|
76
78
|
|
77
79
|
Artoo is conceptualy influenced by Sinatra (https://github.com/sinatra/sinatra) as well as borrowing some code from it.
|
@@ -80,6 +82,19 @@ Artoo provides a robust actor-based messaging architecture, that can support ful
|
|
80
82
|
|
81
83
|
To a large extent, this is due to being built on top of Celluloid (https://github.com/celluloid/celluloid), Celluloid::IO (https://github.com/celluloid/celluloid-io), and Reel (https://github.com/celluloid/reel).
|
82
84
|
|
85
|
+
## Hardware support:
|
86
|
+
|
87
|
+
Artoo has a extensible system for connecting to hardware devices. The following robotics and physical computing platforms are currently supported:
|
88
|
+
|
89
|
+
- Arduino (http://www.arduino.cc/) adaptor (https://github.com/hybridgroup/artoo-arduino)
|
90
|
+
- ARDrone (http://ardrone2.parrot.com/) adaptor (https://github.com/hybridgroup/artoo-ardrone)
|
91
|
+
- Roomba (http://www.irobot.com/us/robots/Educators/Create.aspx) adaptor (https://github.com/hybridgroup/artoo-roomba)
|
92
|
+
- Sphero (http://www.gosphero.com/) adaptor (https://github.com/hybridgroup/artoo-sphero)
|
93
|
+
|
94
|
+
More platforms are coming soon!
|
95
|
+
|
96
|
+
Do you have some hardware that is not yet supported by Artoo? We want to help you, help us, help them! Get in touch...
|
97
|
+
|
83
98
|
## API:
|
84
99
|
|
85
100
|
Artoo includes a RESTful API to query the status of any robot running within a group, including the connection and device status, and device streaming data via websockets.
|
@@ -100,38 +115,112 @@ end
|
|
100
115
|
|
101
116
|
Once the robot or group is working, you can view the main API page at the host and port specified.
|
102
117
|
|
118
|
+
## Test-Driven Robotics:
|
119
|
+
|
120
|
+
Artoo makes it easy to do Test Driven Development (TDD) of your robotic devices using your favorite Ruby test and mocking frameworks.
|
121
|
+
|
122
|
+
Here is an example that uses Minitest and Mocha:
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
describe 'sphero' do
|
126
|
+
let(:robot) { Artoo::MainRobot.new }
|
127
|
+
|
128
|
+
it 'has work to do every 3 seconds' do
|
129
|
+
robot.work
|
130
|
+
|
131
|
+
robot.has_work?(:every, 3.seconds).wont_be_nil
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'must roll every 3 seconds' do
|
135
|
+
robot.sphero.expects(:roll).twice
|
136
|
+
|
137
|
+
robot.work
|
138
|
+
sleep 6.1
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'receives collision event' do
|
142
|
+
robot.expects(:contact)
|
143
|
+
|
144
|
+
robot.work
|
145
|
+
robot.sphero.publish("collision", "clunk")
|
146
|
+
sleep 0.1
|
147
|
+
end
|
148
|
+
end
|
149
|
+
```
|
150
|
+
to describe the following Sphero robot:
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
require 'artoo'
|
154
|
+
|
155
|
+
connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:4560'
|
156
|
+
device :sphero, :driver => :sphero
|
157
|
+
|
158
|
+
def contact(*args)
|
159
|
+
@contacts ||= 0
|
160
|
+
@contacts += 1
|
161
|
+
puts "Contact #{@contacts}"
|
162
|
+
end
|
163
|
+
|
164
|
+
work do
|
165
|
+
on sphero, :collision => :contact
|
166
|
+
|
167
|
+
every(3.seconds) do
|
168
|
+
puts "Rolling..."
|
169
|
+
sphero.roll 90, rand(360)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
```
|
173
|
+
|
103
174
|
## Console:
|
104
175
|
|
105
176
|
Artoo includes Robi, a console based on Pry (http://pryrepl.org/) to allow you to interactively debug and control your robot.
|
106
177
|
|
107
178
|
```
|
108
|
-
robi ./examples/hello.rb
|
109
|
-
I, [2013-
|
110
|
-
I, [2013-
|
111
|
-
|
112
|
-
|
113
|
-
I, [2013-
|
114
|
-
I, [2013-
|
115
|
-
[
|
116
|
-
|
117
|
-
|
179
|
+
$ robi ./examples/hello.rb
|
180
|
+
I, [2013-05-21T18:09:05.179630 #8752] INFO -- : Registering connection 'loop'...
|
181
|
+
I, [2013-05-21T18:09:05.180681 #8752] INFO -- : Preparing work...
|
182
|
+
robi> start
|
183
|
+
Starting main robot...
|
184
|
+
I, [2013-05-21T18:09:37.086550 #8752] INFO -- : Initializing connection loop...
|
185
|
+
I, [2013-05-21T18:09:37.092231 #8752] INFO -- : Starting work...
|
186
|
+
I, [2013-05-21T18:09:37.092691 #8752] INFO -- : Connecting to 'loop' on port '#<Artoo::Port:0x104e4>'...
|
187
|
+
robi> hello
|
188
|
+
hello
|
189
|
+
robi> stop
|
190
|
+
Stopping robots...
|
191
|
+
robi> exit
|
192
|
+
D, [2013-05-21T18:09:53.507709 #8752] DEBUG -- : Terminating 7 actors...
|
193
|
+
D, [2013-05-21T18:09:53.508622 #8752] DEBUG -- : Shutdown completed cleanly
|
118
194
|
```
|
119
195
|
|
120
|
-
##
|
196
|
+
## Getting Started:
|
197
|
+
|
198
|
+
### Installation
|
121
199
|
|
122
200
|
```ruby
|
123
201
|
gem install artoo
|
124
202
|
```
|
125
203
|
|
126
|
-
Then install the gems required by
|
204
|
+
Then install the gems required by the hardware you want to use. For example, if you wanted to integrate a Wiiclassic controller connected to an Arduino to fly your ARDrone:
|
127
205
|
|
128
206
|
```ruby
|
129
|
-
gem install
|
130
|
-
gem install
|
131
|
-
gem install hybridgroup-sphero
|
207
|
+
gem install artoo-arduino
|
208
|
+
gem install artoo-ardrone
|
132
209
|
```
|
133
210
|
|
134
|
-
|
211
|
+
If you will be using socket to serial commuication (required if you will use JRuby or Rubinius), you are ready to start programming your hardware.
|
212
|
+
|
213
|
+
If you want to connect via serial port directly, and are using MRI, install the hybridgroup-serialport gem:
|
214
|
+
|
215
|
+
```ruby
|
216
|
+
gem install hybridgroup-serialport
|
217
|
+
```
|
218
|
+
|
219
|
+
### Writing your robot code:
|
220
|
+
|
221
|
+
Now you are ready to write your own code. Take a look at the examples directory for a whole bunch of code you can use to help get started. We recommend using TDR (Test-Driven Robotics) with your preferred test frameworks.
|
222
|
+
|
223
|
+
### Running your robot:
|
135
224
|
|
136
225
|
```ruby
|
137
226
|
ruby myrobot.rb
|
@@ -140,3 +229,5 @@ ruby myrobot.rb
|
|
140
229
|
## Wiki
|
141
230
|
|
142
231
|
Check out our [wiki](https://github.com/hybridgroup/artoo/wiki) for more docs
|
232
|
+
|
233
|
+
(c) 2012-2013 The Hybrid Group
|
data/Rakefile
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
window.driversWithOutput = ["Pinger", "Pinger2", "ardrone_navigation", "wiiclassic"]
|
2
|
-
|
3
1
|
@RobotIndexCtrl = ($scope, $http, $location, $route) ->
|
4
2
|
$http.get('/robots').success (data)->
|
5
3
|
$scope.robots = data
|
@@ -21,15 +19,14 @@ window.driversWithOutput = ["Pinger", "Pinger2", "ardrone_navigation", "wiiclass
|
|
21
19
|
$http.post('/robots/' + $scope.robot.name + "/devices/" + deviceId + "/commands/" + command, post_params).success (data)->
|
22
20
|
true
|
23
21
|
|
24
|
-
$scope.driverHasOutput = (driverId)->
|
25
|
-
true if $.inArray(driverId, window.driversWithOutput) != -1
|
26
|
-
|
27
22
|
device = console: ->
|
28
|
-
|
23
|
+
if window.ws
|
24
|
+
window.ws.onmessage = null
|
25
|
+
window.ws.close()
|
26
|
+
$(".console code").empty()
|
29
27
|
wspath = "ws://" + location.host + "/robots/"
|
30
28
|
window.ws = new WebSocket(wspath + $scope.robot.name + "/devices/" + $scope.deviceDetail.name + "/events")
|
31
|
-
|
32
|
-
ws.onmessage = (evt)->
|
29
|
+
window.ws.onmessage = (evt)->
|
33
30
|
$(".console code").prepend(evt.data + "\n")
|
34
31
|
|
35
32
|
$scope.isConnected = (connection) ->
|