artoo 1.0.0.rc1 → 1.0.0.rc2
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.
- checksums.yaml +4 -4
- data/Gemfile +9 -6
- data/Gemfile.lock +21 -14
- data/README.md +70 -40
- data/artoo.gemspec +1 -3
- data/bin/artoo +37 -0
- data/bin/artoo_bind.sh +25 -0
- data/bin/artoo_socat_linux.sh +10 -0
- data/bin/{retry.sh → artoo_socat_osx.sh} +1 -1
- data/lib/artoo/api/api.rb +1 -1
- data/lib/artoo/commands/connect.rb +48 -0
- data/lib/artoo/commands/generate.rb +11 -0
- data/lib/artoo/commands/install.rb +25 -0
- data/lib/artoo/generators/adaptor.rb +37 -0
- data/lib/artoo/generators/adaptor/Gemfile.tt +4 -0
- data/lib/artoo/generators/adaptor/LICENSE +2 -0
- data/lib/artoo/generators/adaptor/README.md.tt +13 -0
- data/lib/artoo/generators/adaptor/Rakefile +10 -0
- data/lib/artoo/generators/adaptor/artoo-%adaptor_name%.gemspec.tt +28 -0
- data/lib/artoo/generators/adaptor/lib/artoo-%adaptor_name%.rb.tt +3 -0
- data/lib/artoo/generators/adaptor/lib/artoo-%adaptor_name%/version.rb.tt +5 -0
- data/lib/artoo/generators/adaptor/lib/artoo/adaptors/%adaptor_name%.rb.tt +35 -0
- data/lib/artoo/generators/adaptor/lib/artoo/drivers/%adaptor_name%.rb.tt +28 -0
- data/lib/artoo/generators/adaptor/test/adaptors/%adaptor_name%_adaptor_test.rb.tt +4 -0
- data/lib/artoo/generators/adaptor/test/drivers/%adaptor_name%_driver_test.rb.tt +4 -0
- data/lib/artoo/generators/adaptor/test/test_helper.rb +5 -0
- data/lib/artoo/utility.rb +21 -1
- data/lib/artoo/version.rb +1 -1
- metadata +30 -36
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 61bbb3f286d72755f95f57795cf0683aef11570a
|
|
4
|
+
data.tar.gz: dc0ff46b67e93f15b8b77fc857eacf11ac4ad620
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99bf08c9f0e74dcc39dfdde10e345120e0d81aa61ec491b9a59789b850c2f7663594613eb431586ddbd682c6e5c592c8b4dfbe60244294d6b264a2d1a574eecb
|
|
7
|
+
data.tar.gz: 264aba1fde9cc5cee419657502cf295bc861ecb8fa5f7981bef49a0f7b48992f4aae5770cbf17f709f9c05e4d1ef9b633114750015d4c8b6f76fb8c8259aed9b
|
data/Gemfile
CHANGED
|
@@ -15,12 +15,6 @@ gem 'guard-compass'
|
|
|
15
15
|
gem 'rb-inotify', '~> 0.8.8'
|
|
16
16
|
gem 'execjs'
|
|
17
17
|
|
|
18
|
-
if RUBY_PLATFORM =~ /java/
|
|
19
|
-
gem 'therubyrhino'
|
|
20
|
-
else
|
|
21
|
-
gem 'therubyracer'
|
|
22
|
-
end
|
|
23
|
-
|
|
24
18
|
# For documentation
|
|
25
19
|
gem 'yard'
|
|
26
20
|
gem 'yard-sinatra'
|
|
@@ -28,7 +22,16 @@ gem 'kramdown'
|
|
|
28
22
|
|
|
29
23
|
# For tests
|
|
30
24
|
gem "minitest", "~> 5.0.1"
|
|
25
|
+
gem "minitest-happy"
|
|
31
26
|
gem "mocha", '~> 0.14.0', :require => false
|
|
32
27
|
|
|
33
28
|
gem 'json', '~> 1.7.7'
|
|
34
29
|
gem "foreman"
|
|
30
|
+
|
|
31
|
+
platforms :jruby do
|
|
32
|
+
gem 'therubyrhino'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
platforms :ruby do
|
|
36
|
+
gem 'therubyracer'
|
|
37
|
+
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
artoo (1.0.0.
|
|
4
|
+
artoo (1.0.0.rc2)
|
|
5
5
|
celluloid (~> 0.14.1)
|
|
6
6
|
celluloid-io (~> 0.14.1)
|
|
7
7
|
multi_json (~> 1.6)
|
|
8
8
|
pry (~> 0.9)
|
|
9
9
|
rake (~> 10.0)
|
|
10
10
|
reel (~> 0.4.0.pre)
|
|
11
|
+
thor (~> 0.18.1)
|
|
11
12
|
|
|
12
13
|
GEM
|
|
13
14
|
remote: http://rubygems.org/
|
|
14
15
|
specs:
|
|
15
|
-
bootstrap-sass (2.3.1
|
|
16
|
+
bootstrap-sass (2.3.2.1)
|
|
16
17
|
sass (~> 3.2)
|
|
17
18
|
celluloid (0.14.1)
|
|
18
19
|
timers (>= 1.0.0)
|
|
@@ -25,16 +26,16 @@ GEM
|
|
|
25
26
|
coffee-script (2.2.0)
|
|
26
27
|
coffee-script-source
|
|
27
28
|
execjs
|
|
28
|
-
coffee-script-source (1.6.
|
|
29
|
+
coffee-script-source (1.6.3)
|
|
29
30
|
compass (0.12.2)
|
|
30
31
|
chunky_png (~> 1.2)
|
|
31
32
|
fssm (>= 0.2.7)
|
|
32
33
|
sass (~> 3.1)
|
|
33
|
-
dotenv (0.
|
|
34
|
+
dotenv (0.8.0)
|
|
34
35
|
execjs (1.4.0)
|
|
35
36
|
multi_json (~> 1.0)
|
|
36
|
-
ffi (1.
|
|
37
|
-
ffi (1.
|
|
37
|
+
ffi (1.9.0)
|
|
38
|
+
ffi (1.9.0-java)
|
|
38
39
|
foreman (0.63.0)
|
|
39
40
|
dotenv (>= 0.7)
|
|
40
41
|
thor (>= 0.13.6)
|
|
@@ -56,25 +57,27 @@ GEM
|
|
|
56
57
|
execjs (~> 1.0)
|
|
57
58
|
guard (>= 1.1.0)
|
|
58
59
|
sprockets (~> 2.0)
|
|
59
|
-
hike (1.2.
|
|
60
|
+
hike (1.2.3)
|
|
60
61
|
http (0.4.0)
|
|
61
62
|
certified
|
|
62
63
|
http_parser.rb
|
|
63
64
|
http_parser.rb (0.5.3)
|
|
65
|
+
http_parser.rb (0.5.3-java)
|
|
64
66
|
json (1.7.7)
|
|
65
67
|
json (1.7.7-java)
|
|
66
|
-
kramdown (1.0
|
|
68
|
+
kramdown (1.1.0)
|
|
67
69
|
libv8 (3.11.8.17)
|
|
68
70
|
listen (0.7.3)
|
|
69
|
-
lumberjack (1.0.
|
|
71
|
+
lumberjack (1.0.4)
|
|
70
72
|
metaclass (0.0.1)
|
|
71
73
|
method_source (0.8.1)
|
|
72
|
-
minitest (5.0.
|
|
74
|
+
minitest (5.0.6)
|
|
73
75
|
minitest-happy (1.0.0)
|
|
74
76
|
mocha (0.14.0)
|
|
75
77
|
metaclass (~> 0.0.1)
|
|
76
|
-
multi_json (1.7.
|
|
78
|
+
multi_json (1.7.7)
|
|
77
79
|
nio4r (0.4.6)
|
|
80
|
+
nio4r (0.4.6-java)
|
|
78
81
|
pry (0.9.12.2)
|
|
79
82
|
coderay (~> 1.0.5)
|
|
80
83
|
method_source (~> 0.8)
|
|
@@ -85,7 +88,7 @@ GEM
|
|
|
85
88
|
slop (~> 3.4)
|
|
86
89
|
spoon (~> 0.0)
|
|
87
90
|
rack (1.5.2)
|
|
88
|
-
rake (10.0
|
|
91
|
+
rake (10.1.0)
|
|
89
92
|
rb-inotify (0.8.8)
|
|
90
93
|
ffi (>= 0.5.0)
|
|
91
94
|
reel (0.4.0.pre)
|
|
@@ -99,7 +102,7 @@ GEM
|
|
|
99
102
|
slop (3.4.5)
|
|
100
103
|
spoon (0.0.4)
|
|
101
104
|
ffi
|
|
102
|
-
sprockets (2.
|
|
105
|
+
sprockets (2.10.0)
|
|
103
106
|
hike (~> 1.2)
|
|
104
107
|
multi_json (~> 1.0)
|
|
105
108
|
rack (~> 1.0)
|
|
@@ -107,12 +110,15 @@ GEM
|
|
|
107
110
|
therubyracer (0.11.4)
|
|
108
111
|
libv8 (~> 3.11.8.12)
|
|
109
112
|
ref
|
|
113
|
+
therubyrhino (2.0.2)
|
|
114
|
+
therubyrhino_jar (>= 1.7.3)
|
|
115
|
+
therubyrhino_jar (1.7.4)
|
|
110
116
|
thor (0.18.1)
|
|
111
117
|
tilt (1.4.1)
|
|
112
118
|
timers (1.1.0)
|
|
113
119
|
websocket_parser (0.1.4)
|
|
114
120
|
http
|
|
115
|
-
yard (0.8.6.
|
|
121
|
+
yard (0.8.6.2)
|
|
116
122
|
yard-sinatra (1.0.0)
|
|
117
123
|
yard (~> 0.7)
|
|
118
124
|
|
|
@@ -139,5 +145,6 @@ DEPENDENCIES
|
|
|
139
145
|
sass
|
|
140
146
|
sprockets
|
|
141
147
|
therubyracer
|
|
148
|
+
therubyrhino
|
|
142
149
|
yard
|
|
143
150
|
yard-sinatra
|
data/README.md
CHANGED
|
@@ -88,6 +88,7 @@ Artoo has a extensible system for connecting to hardware devices. The following
|
|
|
88
88
|
|
|
89
89
|
- Arduino (http://www.arduino.cc/) adaptor (https://github.com/hybridgroup/artoo-arduino)
|
|
90
90
|
- ARDrone (http://ardrone2.parrot.com/) adaptor (https://github.com/hybridgroup/artoo-ardrone)
|
|
91
|
+
- Pebble (http://getpebble.com/) adaptor (https://github.com/hybridgroup/artoo-pebble)
|
|
91
92
|
- Roomba (http://www.irobot.com/us/robots/Educators/Create.aspx) adaptor (https://github.com/hybridgroup/artoo-roomba)
|
|
92
93
|
- Sphero (http://www.gosphero.com/) adaptor (https://github.com/hybridgroup/artoo-sphero)
|
|
93
94
|
|
|
@@ -95,6 +96,39 @@ More platforms are coming soon!
|
|
|
95
96
|
|
|
96
97
|
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
98
|
|
|
99
|
+
## Getting Started:
|
|
100
|
+
|
|
101
|
+
### Installation
|
|
102
|
+
|
|
103
|
+
```ruby
|
|
104
|
+
gem install artoo
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
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:
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
gem install artoo-arduino
|
|
111
|
+
gem install artoo-ardrone
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
If you want to connect via serial port directly, and are using MRI, install the hybridgroup-serialport gem:
|
|
117
|
+
|
|
118
|
+
```ruby
|
|
119
|
+
gem install hybridgroup-serialport
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Writing your robot code:
|
|
123
|
+
|
|
124
|
+
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.
|
|
125
|
+
|
|
126
|
+
### Running your robot:
|
|
127
|
+
|
|
128
|
+
```ruby
|
|
129
|
+
ruby myrobot.rb
|
|
130
|
+
```
|
|
131
|
+
|
|
98
132
|
## API:
|
|
99
133
|
|
|
100
134
|
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.
|
|
@@ -171,63 +205,59 @@ work do
|
|
|
171
205
|
end
|
|
172
206
|
```
|
|
173
207
|
|
|
174
|
-
##
|
|
208
|
+
## CLI
|
|
209
|
+
|
|
210
|
+
Artoo has a Command Line Interface (CLI) so you can access important features right from the command line.
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
$ artoo
|
|
214
|
+
Commands:
|
|
215
|
+
artoo console ROBOT # run a robot using the Robi console
|
|
216
|
+
artoo generate SUBCOMMAND ...ARGS # Generates a new robot or adaptor
|
|
217
|
+
artoo help [COMMAND] # Describe available commands or one specific command
|
|
218
|
+
artoo version # Displays the current version
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Console:
|
|
175
222
|
|
|
176
223
|
Artoo includes Robi, a console based on Pry (http://pryrepl.org/) to allow you to interactively debug and control your robot.
|
|
177
224
|
|
|
178
225
|
```
|
|
179
|
-
$
|
|
180
|
-
|
|
181
|
-
I, [2013-
|
|
226
|
+
$ artoo console ./examples/hello.rb
|
|
227
|
+
run robi ./examples/hello.rb from "."
|
|
228
|
+
I, [2013-07-03T17:11:35.793913 #5527] INFO -- : Registering connection 'loop'...
|
|
229
|
+
I, [2013-07-03T17:11:35.794939 #5527] INFO -- : Preparing work...
|
|
182
230
|
robi> start
|
|
183
231
|
Starting main robot...
|
|
184
|
-
I, [2013-
|
|
185
|
-
I, [2013-
|
|
186
|
-
I, [2013-
|
|
232
|
+
I, [2013-07-03T17:11:48.950888 #5527] INFO -- : Initializing connection loop...
|
|
233
|
+
I, [2013-07-03T17:11:48.955804 #5527] INFO -- : Starting work...
|
|
234
|
+
I, [2013-07-03T17:11:48.956152 #5527] INFO -- : Connecting to 'loop' on port '#<Artoo::Port:0xfea0>'...
|
|
235
|
+
robi> list
|
|
236
|
+
#<Artoo::MainRobot:0x100c0>
|
|
187
237
|
robi> hello
|
|
188
238
|
hello
|
|
239
|
+
hello
|
|
189
240
|
robi> stop
|
|
190
241
|
Stopping robots...
|
|
191
242
|
robi> exit
|
|
192
|
-
D, [2013-
|
|
193
|
-
D, [2013-
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## Getting Started:
|
|
197
|
-
|
|
198
|
-
### Installation
|
|
199
|
-
|
|
200
|
-
```ruby
|
|
201
|
-
gem install artoo
|
|
202
|
-
```
|
|
203
|
-
|
|
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:
|
|
205
|
-
|
|
206
|
-
```ruby
|
|
207
|
-
gem install artoo-arduino
|
|
208
|
-
gem install artoo-ardrone
|
|
243
|
+
D, [2013-07-03T17:12:04.413060 #5527] DEBUG -- : Terminating 7 actors...
|
|
244
|
+
D, [2013-07-03T17:12:04.414300 #5527] DEBUG -- : Shutdown completed cleanly
|
|
209
245
|
```
|
|
210
246
|
|
|
211
|
-
|
|
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:
|
|
247
|
+
### Generator
|
|
220
248
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
### Running your robot:
|
|
224
|
-
|
|
225
|
-
```ruby
|
|
226
|
-
ruby myrobot.rb
|
|
227
|
-
```
|
|
249
|
+
Want to integrate a new kind of hardware devices for which there is not an Artoo adaptor yet? You can easily generate a new skeleton Artoo adaptor to help you get started! Simply run the 'artoo generate adaptor' command, and the generator will create a new directory with all of the files in place for your new adaptor gem.
|
|
228
250
|
|
|
229
251
|
## Wiki
|
|
230
252
|
|
|
231
253
|
Check out our [wiki](https://github.com/hybridgroup/artoo/wiki) for more docs
|
|
232
254
|
|
|
255
|
+
## Contributing
|
|
256
|
+
|
|
257
|
+
1. Fork it
|
|
258
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
259
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
260
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
261
|
+
5. Create new Pull Request
|
|
262
|
+
|
|
233
263
|
(c) 2012-2013 The Hybrid Group
|
data/artoo.gemspec
CHANGED
|
@@ -25,7 +25,5 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
s.add_runtime_dependency 'multi_json', '~> 1.6'
|
|
26
26
|
s.add_runtime_dependency 'rake', '~> 10.0'
|
|
27
27
|
s.add_runtime_dependency 'pry', '~> 0.9'
|
|
28
|
-
s.
|
|
29
|
-
s.add_development_dependency 'minitest-happy'
|
|
30
|
-
s.add_development_dependency 'mocha', '~> 0.14.0'
|
|
28
|
+
s.add_runtime_dependency 'thor', '~> 0.18.1'
|
|
31
29
|
end
|
data/bin/artoo
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'thor'
|
|
4
|
+
require 'thor/group'
|
|
5
|
+
require 'artoo/robot'
|
|
6
|
+
require 'artoo/commands/generate'
|
|
7
|
+
require 'artoo/commands/connect'
|
|
8
|
+
require 'artoo/commands/install'
|
|
9
|
+
|
|
10
|
+
Celluloid.logger = nil
|
|
11
|
+
|
|
12
|
+
module CLI
|
|
13
|
+
class Root < Thor
|
|
14
|
+
include Thor::Actions
|
|
15
|
+
|
|
16
|
+
desc 'version', 'Displays the current version'
|
|
17
|
+
def version
|
|
18
|
+
say Artoo::VERSION
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
desc "console ROBOT", "Run a robot using the Robi console"
|
|
22
|
+
def console(robot)
|
|
23
|
+
run("robi #{robot}")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc "generate SUBCOMMAND ...ARGS", "Generates a new robot or adaptor"
|
|
27
|
+
subcommand "generate", Artoo::Commands::Generate
|
|
28
|
+
|
|
29
|
+
desc "connect SUBCOMMAND ...ARGS", "Connects to device"
|
|
30
|
+
subcommand "connect", Artoo::Commands::Connect
|
|
31
|
+
|
|
32
|
+
desc "install SUBCOMMAND ...ARGS", "Installs utility programs"
|
|
33
|
+
subcommand "install", Artoo::Commands::Install
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
CLI::Root.start
|
data/bin/artoo_bind.sh
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# This will create a connection bound to a device located at /dev/<devicename>
|
|
4
|
+
#
|
|
5
|
+
# Requires sudo or ran as root
|
|
6
|
+
#
|
|
7
|
+
# $1 = unbound /dev/rfcommXX
|
|
8
|
+
# $2 = device hardware address from scan
|
|
9
|
+
# $3 = device name
|
|
10
|
+
#
|
|
11
|
+
# Optional parameter
|
|
12
|
+
# $4 = bluetooth radio hcix
|
|
13
|
+
#
|
|
14
|
+
# Example
|
|
15
|
+
#
|
|
16
|
+
# sudo ./artoo_bind.sh 1 00:06:66:4A:43:23 pebble hci1
|
|
17
|
+
#
|
|
18
|
+
#
|
|
19
|
+
if [ -z "$4" ]; then
|
|
20
|
+
addr="hci0"
|
|
21
|
+
else
|
|
22
|
+
addr=$4
|
|
23
|
+
fi
|
|
24
|
+
rfcomm -i $addr bind /dev/rfcomm$1 $2 1
|
|
25
|
+
sudo ln -s /dev/rfcomm$1 /dev/$3
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
NEXT_WAIT_TIME=0
|
|
4
|
-
COMMAND="socat
|
|
4
|
+
COMMAND="socat -d -d FILE:/dev/$2,nonblock,raw,echo=0 TCP-LISTEN:$1,fork"
|
|
5
5
|
until $COMMAND || [ $NEXT_WAIT_TIME -eq 4 ]; do
|
|
6
6
|
echo "retry..."
|
|
7
7
|
sleep $(( NEXT_WAIT_TIME++ ))
|
data/lib/artoo/api/api.rb
CHANGED
|
@@ -57,7 +57,7 @@ module Artoo
|
|
|
57
57
|
# Execute robot command
|
|
58
58
|
# @return [JSON] command
|
|
59
59
|
post '/robots/:robotid/devices/:deviceid/commands/:commandid' do
|
|
60
|
-
result = device(@params['robotid'], @params['deviceid']).command(@params['commandid'], command_params)
|
|
60
|
+
result = device(@params['robotid'], @params['deviceid']).command(@params['commandid'], *command_params)
|
|
61
61
|
return MultiJson.dump({'result' => result})
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
require 'thor/group'
|
|
3
|
+
|
|
4
|
+
module Artoo
|
|
5
|
+
module Commands
|
|
6
|
+
class Connect < Thor
|
|
7
|
+
include Thor::Actions
|
|
8
|
+
include Artoo::Utility
|
|
9
|
+
|
|
10
|
+
desc "scan", "scan for connected devices"
|
|
11
|
+
def scan
|
|
12
|
+
case os
|
|
13
|
+
when :linux
|
|
14
|
+
run("hcitool scan")
|
|
15
|
+
when :macosx
|
|
16
|
+
run("ls /dev/tty.*")
|
|
17
|
+
else
|
|
18
|
+
say "OS not yet supported..."
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc "bind", "bind [ADDRESS] [NAME] binds a device to some connected hardware"
|
|
23
|
+
option :comm, :default => 0, :desc => "Comm number"
|
|
24
|
+
def bind(address, name, hcix=nil)
|
|
25
|
+
case os
|
|
26
|
+
when :linux
|
|
27
|
+
run("bundle exec ./bin/artoo_bind.sh #{comm} #{address} #{name}")
|
|
28
|
+
when :macosx
|
|
29
|
+
say "OSX binds devices on its own volition."
|
|
30
|
+
else
|
|
31
|
+
say "OS not yet supported..."
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
desc "socat", "socat [PORT] [NAME] use socat to connect a socket to a device by name"
|
|
36
|
+
def socat(port, name)
|
|
37
|
+
case os
|
|
38
|
+
when :linux
|
|
39
|
+
run("bundle exec ./bin/artoo_socat_linux.sh #{port} #{name}")
|
|
40
|
+
when :macosx
|
|
41
|
+
run("bundle exec ./bin/artoo_socat_osx.sh #{port} #{name}")
|
|
42
|
+
else
|
|
43
|
+
say "OS not yet supported..."
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
require 'thor/group'
|
|
3
|
+
|
|
4
|
+
module Artoo
|
|
5
|
+
module Commands
|
|
6
|
+
class Install < Thor
|
|
7
|
+
include Thor::Actions
|
|
8
|
+
include Artoo::Utility
|
|
9
|
+
|
|
10
|
+
desc "socat", "install socat utility program"
|
|
11
|
+
def socat
|
|
12
|
+
case os
|
|
13
|
+
when :linux
|
|
14
|
+
run("sudo apt-get update && sudo apt-get install socat")
|
|
15
|
+
when :macosx
|
|
16
|
+
Bundler.with_clean_env do
|
|
17
|
+
run("brew install socat")
|
|
18
|
+
end
|
|
19
|
+
else
|
|
20
|
+
say "OS not yet supported..."
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'thor'
|
|
2
|
+
require 'thor/group'
|
|
3
|
+
require 'artoo/version'
|
|
4
|
+
|
|
5
|
+
module Artoo
|
|
6
|
+
module Generator
|
|
7
|
+
class Adaptor < Thor::Group
|
|
8
|
+
include Thor::Actions
|
|
9
|
+
include Artoo::Utility
|
|
10
|
+
|
|
11
|
+
argument :adaptor_name
|
|
12
|
+
|
|
13
|
+
def self.source_root
|
|
14
|
+
File.dirname(__FILE__)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def adaptor_class_name
|
|
18
|
+
classify(adaptor_name)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def artoo_version
|
|
22
|
+
Artoo::VERSION
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def artoo_adaptor_name
|
|
26
|
+
"artoo-#{adaptor_name}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def copy_adaptor_directory
|
|
30
|
+
say "Creating #{artoo_adaptor_name} adaptor..."
|
|
31
|
+
empty_directory artoo_adaptor_name
|
|
32
|
+
directory "adaptor", artoo_adaptor_name, :recursive => true
|
|
33
|
+
say "Done!"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Artoo Adaptor For <%= adaptor_class_name %>
|
|
2
|
+
|
|
3
|
+
This repository contains the Artoo (http://artoo.io/) adaptor for <%= adaptor_class_name %>.
|
|
4
|
+
|
|
5
|
+
Artoo is a open source micro-framework for robotics using Ruby.
|
|
6
|
+
|
|
7
|
+
For more information abut Artoo, check out our repo at https://github.com/hybridgroup/artoo
|
|
8
|
+
|
|
9
|
+
## Installing
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
gem install artoo-<%= adaptor_name %>
|
|
13
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "artoo-<%= adaptor_name %>/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "artoo-<%= adaptor_name %>"
|
|
7
|
+
s.version = Artoo::<%= adaptor_class_name %>::VERSION
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = ["Your name here"]
|
|
10
|
+
s.email = ["your email here"]
|
|
11
|
+
s.homepage = "Your homepage here"
|
|
12
|
+
s.summary = %q{Artoo adaptor and driver for <%= adaptor_class_name %>}
|
|
13
|
+
s.description = %q{Artoo adaptor and driver for <%= adaptor_class_name %>}
|
|
14
|
+
|
|
15
|
+
s.rubyforge_project = "artoo-<%= adaptor_name %>"
|
|
16
|
+
|
|
17
|
+
s.files = `git ls-files`.split("\n")
|
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
20
|
+
s.require_paths = ["lib"]
|
|
21
|
+
|
|
22
|
+
s.add_runtime_dependency 'artoo', '~> <%= artoo_version %>'
|
|
23
|
+
# TODO: add your development dependencies here
|
|
24
|
+
# EXAMPLE:
|
|
25
|
+
# s.add_development_dependency 'minitest', '~> 5.0'
|
|
26
|
+
# s.add_development_dependency 'minitest-happy'
|
|
27
|
+
# s.add_development_dependency 'mocha', '~> 0.14.0'
|
|
28
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'artoo/adaptors/adaptor'
|
|
2
|
+
|
|
3
|
+
module Artoo
|
|
4
|
+
module Adaptors
|
|
5
|
+
# Connect to a <%= adaptor_name %> device
|
|
6
|
+
# @see device documentation for more information
|
|
7
|
+
class <%= adaptor_class_name %> < Adaptor
|
|
8
|
+
finalizer :finalize
|
|
9
|
+
attr_reader :device
|
|
10
|
+
|
|
11
|
+
# Closes connection with device if connected
|
|
12
|
+
# @return [Boolean]
|
|
13
|
+
def finalize
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Creates a connection with device
|
|
17
|
+
# @return [Boolean]
|
|
18
|
+
def connect
|
|
19
|
+
super
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Closes connection with device
|
|
23
|
+
# @return [Boolean]
|
|
24
|
+
def disconnect
|
|
25
|
+
super
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Uses method missing to call device actions
|
|
29
|
+
# @see device documentation
|
|
30
|
+
def method_missing(method_name, *arguments, &block)
|
|
31
|
+
device.send(method_name, *arguments, &block)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'artoo/drivers/driver'
|
|
2
|
+
|
|
3
|
+
module Artoo
|
|
4
|
+
module Drivers
|
|
5
|
+
# The <%= adaptor_name %> driver behaviors
|
|
6
|
+
class <%= adaptor_class_name %> < Driver
|
|
7
|
+
|
|
8
|
+
# Start driver and any required connections
|
|
9
|
+
def start_driver
|
|
10
|
+
begin
|
|
11
|
+
every(interval) do
|
|
12
|
+
handle_message_events
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
super
|
|
16
|
+
rescue Exception => e
|
|
17
|
+
Logger.error "Error starting <%= adaptor_class_name %> driver!"
|
|
18
|
+
Logger.error e.message
|
|
19
|
+
Logger.error e.backtrace.inspect
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def handle_message_events
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/lib/artoo/utility.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
require 'rbconfig'
|
|
2
|
+
|
|
1
3
|
module Artoo
|
|
2
|
-
# Utility methods used for
|
|
4
|
+
# Utility methods used for various important things
|
|
3
5
|
module Utility
|
|
4
6
|
|
|
5
7
|
# Converts camel_cased_word to constant
|
|
@@ -64,6 +66,24 @@ module Artoo
|
|
|
64
66
|
def current_class
|
|
65
67
|
Celluloid::Actor.current.class
|
|
66
68
|
end
|
|
69
|
+
|
|
70
|
+
def os
|
|
71
|
+
@os ||= (
|
|
72
|
+
host_os = RbConfig::CONFIG['host_os']
|
|
73
|
+
case host_os
|
|
74
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
|
75
|
+
:windows
|
|
76
|
+
when /darwin|mac os/
|
|
77
|
+
:macosx
|
|
78
|
+
when /linux/
|
|
79
|
+
:linux
|
|
80
|
+
when /solaris|bsd/
|
|
81
|
+
:unix
|
|
82
|
+
else
|
|
83
|
+
raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
|
|
84
|
+
end
|
|
85
|
+
)
|
|
86
|
+
end
|
|
67
87
|
end
|
|
68
88
|
end
|
|
69
89
|
|
data/lib/artoo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: artoo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0.
|
|
4
|
+
version: 1.0.0.rc2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ron Evans
|
|
@@ -12,7 +12,7 @@ authors:
|
|
|
12
12
|
autorequire:
|
|
13
13
|
bindir: bin
|
|
14
14
|
cert_chain: []
|
|
15
|
-
date: 2013-07-
|
|
15
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: celluloid
|
|
@@ -99,52 +99,27 @@ dependencies:
|
|
|
99
99
|
- !ruby/object:Gem::Version
|
|
100
100
|
version: '0.9'
|
|
101
101
|
- !ruby/object:Gem::Dependency
|
|
102
|
-
name:
|
|
102
|
+
name: thor
|
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
|
104
104
|
requirements:
|
|
105
105
|
- - ~>
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
|
-
version:
|
|
108
|
-
type: :
|
|
109
|
-
prerelease: false
|
|
110
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
111
|
-
requirements:
|
|
112
|
-
- - ~>
|
|
113
|
-
- !ruby/object:Gem::Version
|
|
114
|
-
version: '5.0'
|
|
115
|
-
- !ruby/object:Gem::Dependency
|
|
116
|
-
name: minitest-happy
|
|
117
|
-
requirement: !ruby/object:Gem::Requirement
|
|
118
|
-
requirements:
|
|
119
|
-
- - '>='
|
|
120
|
-
- !ruby/object:Gem::Version
|
|
121
|
-
version: '0'
|
|
122
|
-
type: :development
|
|
123
|
-
prerelease: false
|
|
124
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
125
|
-
requirements:
|
|
126
|
-
- - '>='
|
|
127
|
-
- !ruby/object:Gem::Version
|
|
128
|
-
version: '0'
|
|
129
|
-
- !ruby/object:Gem::Dependency
|
|
130
|
-
name: mocha
|
|
131
|
-
requirement: !ruby/object:Gem::Requirement
|
|
132
|
-
requirements:
|
|
133
|
-
- - ~>
|
|
134
|
-
- !ruby/object:Gem::Version
|
|
135
|
-
version: 0.14.0
|
|
136
|
-
type: :development
|
|
107
|
+
version: 0.18.1
|
|
108
|
+
type: :runtime
|
|
137
109
|
prerelease: false
|
|
138
110
|
version_requirements: !ruby/object:Gem::Requirement
|
|
139
111
|
requirements:
|
|
140
112
|
- - ~>
|
|
141
113
|
- !ruby/object:Gem::Version
|
|
142
|
-
version: 0.
|
|
114
|
+
version: 0.18.1
|
|
143
115
|
description: Ruby-based microframework for robotics
|
|
144
116
|
email:
|
|
145
117
|
- artoo@hybridgroup.com
|
|
146
118
|
executables:
|
|
147
|
-
-
|
|
119
|
+
- artoo
|
|
120
|
+
- artoo_bind.sh
|
|
121
|
+
- artoo_socat_linux.sh
|
|
122
|
+
- artoo_socat_osx.sh
|
|
148
123
|
- robi
|
|
149
124
|
extensions: []
|
|
150
125
|
extra_rdoc_files: []
|
|
@@ -189,7 +164,10 @@ files:
|
|
|
189
164
|
- api/public/partials/robot-device-detail.html
|
|
190
165
|
- api/public/partials/robot-index.html
|
|
191
166
|
- artoo.gemspec
|
|
192
|
-
- bin/
|
|
167
|
+
- bin/artoo
|
|
168
|
+
- bin/artoo_bind.sh
|
|
169
|
+
- bin/artoo_socat_linux.sh
|
|
170
|
+
- bin/artoo_socat_osx.sh
|
|
193
171
|
- bin/robi
|
|
194
172
|
- examples/ardrone.rb
|
|
195
173
|
- examples/ardrone_multi.rb
|
|
@@ -230,6 +208,9 @@ files:
|
|
|
230
208
|
- lib/artoo/api/device_event_client.rb
|
|
231
209
|
- lib/artoo/api/route_helpers.rb
|
|
232
210
|
- lib/artoo/basic.rb
|
|
211
|
+
- lib/artoo/commands/connect.rb
|
|
212
|
+
- lib/artoo/commands/generate.rb
|
|
213
|
+
- lib/artoo/commands/install.rb
|
|
233
214
|
- lib/artoo/connection.rb
|
|
234
215
|
- lib/artoo/delegator.rb
|
|
235
216
|
- lib/artoo/device.rb
|
|
@@ -242,6 +223,19 @@ files:
|
|
|
242
223
|
- lib/artoo/events.rb
|
|
243
224
|
- lib/artoo/ext/actor.rb
|
|
244
225
|
- lib/artoo/ext/timers.rb
|
|
226
|
+
- lib/artoo/generators/adaptor.rb
|
|
227
|
+
- lib/artoo/generators/adaptor/Gemfile.tt
|
|
228
|
+
- lib/artoo/generators/adaptor/LICENSE
|
|
229
|
+
- lib/artoo/generators/adaptor/README.md.tt
|
|
230
|
+
- lib/artoo/generators/adaptor/Rakefile
|
|
231
|
+
- lib/artoo/generators/adaptor/artoo-%adaptor_name%.gemspec.tt
|
|
232
|
+
- lib/artoo/generators/adaptor/lib/artoo-%adaptor_name%.rb.tt
|
|
233
|
+
- lib/artoo/generators/adaptor/lib/artoo-%adaptor_name%/version.rb.tt
|
|
234
|
+
- lib/artoo/generators/adaptor/lib/artoo/adaptors/%adaptor_name%.rb.tt
|
|
235
|
+
- lib/artoo/generators/adaptor/lib/artoo/drivers/%adaptor_name%.rb.tt
|
|
236
|
+
- lib/artoo/generators/adaptor/test/adaptors/%adaptor_name%_adaptor_test.rb.tt
|
|
237
|
+
- lib/artoo/generators/adaptor/test/drivers/%adaptor_name%_driver_test.rb.tt
|
|
238
|
+
- lib/artoo/generators/adaptor/test/test_helper.rb
|
|
245
239
|
- lib/artoo/main.rb
|
|
246
240
|
- lib/artoo/master.rb
|
|
247
241
|
- lib/artoo/port.rb
|