artoo 1.0.0.rc2 → 1.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61bbb3f286d72755f95f57795cf0683aef11570a
4
- data.tar.gz: dc0ff46b67e93f15b8b77fc857eacf11ac4ad620
3
+ metadata.gz: 8dada91f56c875c86f6f1f4a689a27417a65d760
4
+ data.tar.gz: c66e5a9aa2311d76d7af2648bf6a362a14b8ed48
5
5
  SHA512:
6
- metadata.gz: 99bf08c9f0e74dcc39dfdde10e345120e0d81aa61ec491b9a59789b850c2f7663594613eb431586ddbd682c6e5c592c8b4dfbe60244294d6b264a2d1a574eecb
7
- data.tar.gz: 264aba1fde9cc5cee419657502cf295bc861ecb8fa5f7981bef49a0f7b48992f4aae5770cbf17f709f9c05e4d1ef9b633114750015d4c8b6f76fb8c8259aed9b
6
+ metadata.gz: 4b6b2c71e48df2bba926db39e2561b9cd23b8ef6ea74852ee996e78b480c5a8f888c6aeae01099e192e5cf2ead9e1c07b6ab84afea4f1c6b40d03091da2796f0
7
+ data.tar.gz: 2fb9018b0178c87e21f6ae024564f0ea1ee51ee4293b6031bf65bfee2fcfb525e0e3f8be4e77e1d95a42ede9dbc2872330d33d84674b4db7d4cc2429cb2801a4
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ artoo
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ rbx-2.0.0-rc1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- artoo (1.0.0.rc2)
4
+ artoo (1.0.0.rc3)
5
5
  celluloid (~> 0.14.1)
6
6
  celluloid-io (~> 0.14.1)
7
7
  multi_json (~> 1.6)
@@ -62,7 +62,6 @@ GEM
62
62
  certified
63
63
  http_parser.rb
64
64
  http_parser.rb (0.5.3)
65
- http_parser.rb (0.5.3-java)
66
65
  json (1.7.7)
67
66
  json (1.7.7-java)
68
67
  kramdown (1.1.0)
@@ -77,7 +76,6 @@ GEM
77
76
  metaclass (~> 0.0.1)
78
77
  multi_json (1.7.7)
79
78
  nio4r (0.4.6)
80
- nio4r (0.4.6-java)
81
79
  pry (0.9.12.2)
82
80
  coderay (~> 1.0.5)
83
81
  method_source (~> 0.8)
data/README.md CHANGED
@@ -212,12 +212,30 @@ Artoo has a Command Line Interface (CLI) so you can access important features ri
212
212
  ```
213
213
  $ artoo
214
214
  Commands:
215
- artoo console ROBOT # run a robot using the Robi console
215
+ artoo connect SUBCOMMAND ...ARGS # Connects to device
216
+ artoo console ROBOT # Run a robot using the Robi console
216
217
  artoo generate SUBCOMMAND ...ARGS # Generates a new robot or adaptor
217
218
  artoo help [COMMAND] # Describe available commands or one specific command
219
+ artoo install SUBCOMMAND ...ARGS # Installs utility programs
220
+ artoo start ROBOT # Run a robot
218
221
  artoo version # Displays the current version
219
222
  ```
220
223
 
224
+ ### Connect:
225
+
226
+ Artoo makes it a lot easier to connect TCP Socket to Bluetooth and serial port devices using the command line interface:
227
+
228
+ ```
229
+ $ artoo connect
230
+ Commands:
231
+ artoo connect bind # bind [ADDRESS] [NAME] binds a device to some connected hardware
232
+ artoo connect help [COMMAND] # Describe subcommands or one specific subcommand
233
+ artoo connect scan # scan for connected devices
234
+ artoo connect socat # socat [PORT] [NAME] use socat to connect a socket to a serial device by name
235
+ ```
236
+
237
+ You can scan your computer for paired Bluetooth devices, bind them to unix ports, and connect socket to serial interfaces, easily from the command line!
238
+
221
239
  ### Console:
222
240
 
223
241
  Artoo includes Robi, a console based on Pry (http://pryrepl.org/) to allow you to interactively debug and control your robot.
data/bin/artoo CHANGED
@@ -23,6 +23,15 @@ module CLI
23
23
  run("robi #{robot}")
24
24
  end
25
25
 
26
+ desc "start ROBOT", "Run a robot"
27
+ option :delay, :default => 0, :desc => "Number of seconds to wait for connections"
28
+ def start(robot)
29
+ say "Starting robot..."
30
+ delay = options[:delay].to_i
31
+ sleep(delay) if delay > 0
32
+ run("ruby #{robot}")
33
+ end
34
+
26
35
  desc "generate SUBCOMMAND ...ARGS", "Generates a new robot or adaptor"
27
36
  subcommand "generate", Artoo::Commands::Generate
28
37
 
@@ -21,10 +21,12 @@ module Artoo
21
21
 
22
22
  desc "bind", "bind [ADDRESS] [NAME] binds a device to some connected hardware"
23
23
  option :comm, :default => 0, :desc => "Comm number"
24
- def bind(address, name, hcix=nil)
24
+ option :radio, :default => "hci0", :desc => "Bluetooth radio address"
25
+ def bind(address, name)
25
26
  case os
26
27
  when :linux
27
- run("bundle exec ./bin/artoo_bind.sh #{comm} #{address} #{name}")
28
+ run("rfcomm -i #{options[:radio]} bind /dev/rfcomm#{options[:comm]} #{address} 1")
29
+ run("sudo ln -s /dev/rfcomm#{options[:comm]} /dev/#{name}")
28
30
  when :macosx
29
31
  say "OSX binds devices on its own volition."
30
32
  else
@@ -32,13 +34,28 @@ module Artoo
32
34
  end
33
35
  end
34
36
 
35
- desc "socat", "socat [PORT] [NAME] use socat to connect a socket to a device by name"
37
+ desc "socat", "socat [PORT] [NAME] use socat to connect a socket to a serial device by name"
38
+ option :retries, :default => 0, :desc => "Number of times to retry connecting on failure"
36
39
  def socat(port, name)
40
+ attempts = 1 + options[:retries].to_i
41
+
37
42
  case os
38
43
  when :linux
39
- run("bundle exec ./bin/artoo_socat_linux.sh #{port} #{name}")
44
+ run("sudo chmod a+rw /dev/#{name}")
45
+
46
+ while(attempts > 0) do
47
+ run("socat -d -d FILE:/dev/#{name},nonblock,raw,b115200,echo=0 TCP-LISTEN:#{port},fork")
48
+ break unless $? == 1
49
+ attempts -= 1
50
+ end
51
+
40
52
  when :macosx
41
- run("bundle exec ./bin/artoo_socat_osx.sh #{port} #{name}")
53
+ while(attempts > 0) do
54
+ run("socat -d -d FILE:/dev/#{name},nonblock,raw,echo=0 TCP-LISTEN:#{port},fork")
55
+ break unless $? == 1
56
+ attempts -= 1
57
+ end
58
+
42
59
  else
43
60
  say "OS not yet supported..."
44
61
  end
data/lib/artoo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Artoo
2
2
  unless const_defined?('VERSION')
3
- VERSION = "1.0.0.rc2"
3
+ VERSION = "1.0.0.rc3"
4
4
  end
5
5
  end
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.rc2
4
+ version: 1.0.0.rc3
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-26 00:00:00.000000000 Z
15
+ date: 2013-07-27 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: celluloid
@@ -117,14 +117,13 @@ email:
117
117
  - artoo@hybridgroup.com
118
118
  executables:
119
119
  - artoo
120
- - artoo_bind.sh
121
- - artoo_socat_linux.sh
122
- - artoo_socat_osx.sh
123
120
  - robi
124
121
  extensions: []
125
122
  extra_rdoc_files: []
126
123
  files:
127
124
  - .gitignore
125
+ - .ruby-gemset
126
+ - .ruby-version
128
127
  - .travis.yml
129
128
  - .yardopts
130
129
  - CONTRIBUTORS.md
@@ -165,9 +164,6 @@ files:
165
164
  - api/public/partials/robot-index.html
166
165
  - artoo.gemspec
167
166
  - bin/artoo
168
- - bin/artoo_bind.sh
169
- - bin/artoo_socat_linux.sh
170
- - bin/artoo_socat_osx.sh
171
167
  - bin/robi
172
168
  - examples/ardrone.rb
173
169
  - examples/ardrone_multi.rb
data/bin/artoo_bind.sh DELETED
@@ -1,25 +0,0 @@
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,10 +0,0 @@
1
- #!/bin/bash
2
-
3
- sudo chmod 666 /dev/$2
4
-
5
- NEXT_WAIT_TIME=0
6
- COMMAND="socat -d -d FILE:/dev/$2,nonblock,raw,b115200,echo=0 TCP-LISTEN:$1,fork"
7
- until $COMMAND || [ $NEXT_WAIT_TIME -eq 4 ]; do
8
- echo "retry..."
9
- sleep $(( NEXT_WAIT_TIME++ ))
10
- done
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
-
3
- NEXT_WAIT_TIME=0
4
- COMMAND="socat -d -d FILE:/dev/$2,nonblock,raw,echo=0 TCP-LISTEN:$1,fork"
5
- until $COMMAND || [ $NEXT_WAIT_TIME -eq 4 ]; do
6
- echo "retry..."
7
- sleep $(( NEXT_WAIT_TIME++ ))
8
- done