argus 0.0.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +25 -1
  4. data/Rakefile +4 -0
  5. data/lib/argus.rb +5 -0
  6. data/lib/argus/ardrone_control_modes.rb +14 -0
  7. data/lib/argus/at_commander.rb +104 -0
  8. data/lib/argus/cad_type.rb +22 -0
  9. data/lib/argus/cfields.rb +80 -0
  10. data/lib/argus/controller.rb +165 -0
  11. data/lib/argus/drone.rb +62 -0
  12. data/lib/argus/float_encoding.rb +13 -0
  13. data/lib/argus/led_animation.rb +48 -0
  14. data/lib/argus/nav_data.rb +78 -0
  15. data/lib/argus/nav_monitor.rb +83 -0
  16. data/lib/argus/nav_option.rb +35 -0
  17. data/lib/argus/nav_option_checksum.rb +20 -0
  18. data/lib/argus/nav_option_demo.rb +79 -0
  19. data/lib/argus/nav_option_unknown.rb +9 -0
  20. data/lib/argus/nav_option_vision_detect.rb +83 -0
  21. data/lib/argus/nav_streamer.rb +111 -0
  22. data/lib/argus/nav_tag.rb +35 -0
  23. data/lib/argus/null_nav_monitor.rb +13 -0
  24. data/lib/argus/pave_parser.rb +39 -0
  25. data/lib/argus/tcp_video_streamer.rb +20 -0
  26. data/lib/argus/time_queue.rb +62 -0
  27. data/lib/argus/udp_sender.rb +13 -0
  28. data/lib/argus/version.rb +10 -0
  29. data/spec/argus/at_commander_spec.rb +82 -0
  30. data/spec/argus/controller_spec.rb +149 -0
  31. data/spec/argus/float_encoding_spec.rb +12 -0
  32. data/spec/argus/led_animation_spec.rb +21 -0
  33. data/spec/argus/nav_data_spec.rb +147 -0
  34. data/spec/argus/nav_option_checksum_spec.rb +21 -0
  35. data/spec/argus/nav_option_demo_spec.rb +56 -0
  36. data/spec/argus/nav_option_spec.rb +32 -0
  37. data/spec/argus/nav_option_unknown_spec.rb +19 -0
  38. data/spec/argus/nav_option_vision_detect_spec.rb +65 -0
  39. data/spec/argus/nav_streamer_spec.rb +111 -0
  40. data/spec/argus/null_nav_monitor_spec.rb +17 -0
  41. data/spec/argus/time_queue_spec.rb +61 -0
  42. data/spec/argus/udp_sender_spec.rb +33 -0
  43. data/spec/spec_helper.rb +13 -0
  44. metadata +51 -12
@@ -0,0 +1,17 @@
1
+ require 'rspec/given'
2
+ require 'argus/null_nav_monitor'
3
+
4
+ describe Argus::NullNavMonitor do
5
+ Given(:nav) { Argus::NullNavMonitor.new }
6
+
7
+ context "when calling a regular method" do
8
+ When(:result) { nav.start }
9
+ Then { result.should_not have_raised }
10
+ end
11
+
12
+ context "when calling a regular method" do
13
+ When(:result) { nav.callback { } }
14
+ Then { result.should have_raised(Argus::NullNavMonitor::UsageError) }
15
+ end
16
+
17
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+ require 'time'
3
+
4
+ describe TimeQueue do
5
+ Given(:time) { Time.now }
6
+ Given(:tq) { TimeQueue.new }
7
+
8
+ context "with an empty queue" do
9
+ Then { ! tq.any_ready?(time+100) }
10
+ end
11
+
12
+ context "with several items" do
13
+ Given {
14
+ tq.add(time, :zero)
15
+ tq.add(time+2, :two)
16
+ tq.add(time+1, :one)
17
+ }
18
+ Then { ! tq.any_ready?(time-1) }
19
+ Then { tq.any_ready?(time) }
20
+
21
+ Then { tq.all_ready(time-1) == [] }
22
+ Then { tq.all_ready(time ) == [:zero] }
23
+ Then { tq.all_ready(time+1) == [:zero, :one] }
24
+ Then { tq.all_ready(time+2) == [:zero, :one, :two] }
25
+ end
26
+
27
+ describe "#to_s" do
28
+ Given(:time) { Time.parse("12:00:00") }
29
+ Given(:items) { [ ] }
30
+ Given {
31
+ items.each.with_index do |item, i| tq.add(time+i, item) end
32
+ }
33
+
34
+ context "with no items" do
35
+ Then { tq.to_s == "[]" }
36
+ end
37
+
38
+ context "with one item" do
39
+ Given(:items) { [ :zero ] }
40
+ Then { tq.to_s == "[:zero@12:00:00.000]" }
41
+ end
42
+
43
+ context "with four items" do
44
+ Given(:items) { [ :zero, :one, :two, :three ] }
45
+ Then { tq.to_s == "[:zero@12:00:00.000, :one@+1.0, :two@+2.0, ...]" }
46
+ end
47
+ end
48
+
49
+ describe "removing items" do
50
+ Given {
51
+ tq.add(time, :zero)
52
+ tq.add(time+2, :two)
53
+ }
54
+ Given!(:onekey) { tq.add(time+1, :one) }
55
+
56
+ When { tq.remove(onekey) }
57
+ let(:result) { tq.all_ready(time+100) }
58
+
59
+ Then { result == [:zero, :two] }
60
+ end
61
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+ require 'socket'
3
+
4
+ describe Argus::UdpSender do
5
+ Given(:port) { '5500' }
6
+ Given(:host) { 'localhost' }
7
+
8
+ context "with real socket" do
9
+ Given(:socket) { UDPSocket.new }
10
+ Given(:sender) { Argus::UdpSender.new(remote_host: host, port: port) }
11
+ Given!(:server) {
12
+ server = UDPSocket.new
13
+ server.bind(nil, port)
14
+ Thread.new {
15
+ @data, _ = server.recvfrom(1000)
16
+ }
17
+ }
18
+ When {
19
+ sender.send_packet("HI")
20
+ server.join
21
+ }
22
+ Then { @data.should == "HI" }
23
+ end
24
+
25
+ context "with provided socket" do
26
+ Given(:socket) { flexmock(send: nil) }
27
+ Given(:sender) { Argus::UdpSender.new(socket: socket, remote_host: host, port: port) }
28
+
29
+ When { sender.send_packet("HI") }
30
+
31
+ Then { socket.should have_received(:send).with("HI", 0, host, port).once }
32
+ end
33
+ end
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/ruby -wKU
2
+
3
+ require 'rspec/given'
4
+ require 'flexmock'
5
+
6
+ require 'argus'
7
+ require 'support/bytes'
8
+
9
+ RSpec.configure do |config|
10
+ config.mock_with :flexmock
11
+ end
12
+
13
+ RSpec::Given.use_natural_assertions
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: argus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jim Weirich
8
+ - Ron Evans
9
+ - Adrian Zankich
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-11-09 00:00:00.000000000 Z
13
+ date: 2013-09-03 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rspec-given
16
17
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
@@ -22,14 +22,15 @@ dependencies:
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
28
  version: '2.1'
30
29
  description: Argus is a Ruby interface to a Parrot AR Drone quadcopter.Argus is extremely
31
30
  experimental at this point. Use at your own risk.
32
- email: jim.weirich@gmail.com
31
+ email:
32
+ - jim.weirich@gmail.com
33
+ - ron dot evans at gmail dot com
33
34
  executables: []
34
35
  extensions: []
35
36
  extra_rdoc_files:
@@ -38,9 +39,49 @@ extra_rdoc_files:
38
39
  files:
39
40
  - README.md
40
41
  - Rakefile
42
+ - lib/argus.rb
43
+ - lib/argus/ardrone_control_modes.rb
44
+ - lib/argus/at_commander.rb
45
+ - lib/argus/cad_type.rb
46
+ - lib/argus/cfields.rb
47
+ - lib/argus/controller.rb
48
+ - lib/argus/drone.rb
49
+ - lib/argus/float_encoding.rb
50
+ - lib/argus/led_animation.rb
51
+ - lib/argus/nav_data.rb
52
+ - lib/argus/nav_monitor.rb
53
+ - lib/argus/nav_option.rb
54
+ - lib/argus/nav_option_checksum.rb
55
+ - lib/argus/nav_option_demo.rb
56
+ - lib/argus/nav_option_unknown.rb
57
+ - lib/argus/nav_option_vision_detect.rb
58
+ - lib/argus/nav_streamer.rb
59
+ - lib/argus/nav_tag.rb
60
+ - lib/argus/null_nav_monitor.rb
61
+ - lib/argus/pave_parser.rb
62
+ - lib/argus/tcp_video_streamer.rb
63
+ - lib/argus/time_queue.rb
64
+ - lib/argus/udp_sender.rb
65
+ - lib/argus/version.rb
66
+ - spec/spec_helper.rb
67
+ - spec/argus/at_commander_spec.rb
68
+ - spec/argus/controller_spec.rb
69
+ - spec/argus/float_encoding_spec.rb
70
+ - spec/argus/led_animation_spec.rb
71
+ - spec/argus/nav_data_spec.rb
72
+ - spec/argus/nav_option_checksum_spec.rb
73
+ - spec/argus/nav_option_demo_spec.rb
74
+ - spec/argus/nav_option_spec.rb
75
+ - spec/argus/nav_option_unknown_spec.rb
76
+ - spec/argus/nav_option_vision_detect_spec.rb
77
+ - spec/argus/nav_streamer_spec.rb
78
+ - spec/argus/null_nav_monitor_spec.rb
79
+ - spec/argus/time_queue_spec.rb
80
+ - spec/argus/udp_sender_spec.rb
41
81
  - MIT-LICENSE
42
82
  homepage: http://github.com/jimweirich/argus
43
83
  licenses: []
84
+ metadata: {}
44
85
  post_install_message:
45
86
  rdoc_options:
46
87
  - --line-numbers
@@ -52,21 +93,19 @@ rdoc_options:
52
93
  require_paths:
53
94
  - lib
54
95
  required_ruby_version: !ruby/object:Gem::Requirement
55
- none: false
56
96
  requirements:
57
- - - ! '>='
97
+ - - '>='
58
98
  - !ruby/object:Gem::Version
59
99
  version: '1.9'
60
100
  required_rubygems_version: !ruby/object:Gem::Requirement
61
- none: false
62
101
  requirements:
63
- - - ! '>='
102
+ - - '>='
64
103
  - !ruby/object:Gem::Version
65
104
  version: '1.0'
66
105
  requirements: []
67
106
  rubyforge_project: n/a
68
- rubygems_version: 1.8.24
107
+ rubygems_version: 2.0.5
69
108
  signing_key:
70
- specification_version: 3
109
+ specification_version: 4
71
110
  summary: Ruby API for a Parrot AD Drone Quadcopter
72
111
  test_files: []