artoo-crazyflie 0.3.0 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0ebd1773008d97ac9a3740e318683471848e356
4
- data.tar.gz: 0efe5b563ba97c1b3fe9329b5b381e586ed2b3c5
3
+ metadata.gz: 5eada782f3bbf17701752f48f6220667965ae6ca
4
+ data.tar.gz: 0dc54ca75c1524f430997578b7b2c6215ba7a591
5
5
  SHA512:
6
- metadata.gz: 6023f5c1c59b52dce95c5223453f9b2cada008ab53de55824d0844779491b4b76bf450de31c4536ef4771fbea1db7abea4b8d2cd2eaacdb99c962e57457ccf00
7
- data.tar.gz: 114fce7dbbb70e452baf284b286aa01a9777a5a660d55d43ffc2dd11e24de73568c932b7bf0f847264f81f90bebf725bdab437e0dbaf61e3239c53834e38b521
6
+ metadata.gz: 4d912e025bd8777841d3a4346db60d4d453313d9b7acba91041e0632e6c4820e71610d36a00f1df3e47bfb3f5d5ce08f1cf77e88ac21495aa9fce7319eee60a5
7
+ data.tar.gz: 239e2e728795c29b8e15a88362027b191c8f3c80c747f27c52ab0e71de9827fa9ac80c0a31a68905c574466d307a37b19257941021325026ad1c3842a3b96643
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- artoo-crazyflie (0.3.0)
4
+ artoo-crazyflie (0.4.0)
5
5
  artoo (>= 1.4.0)
6
6
  hybridgroup-crubyflie
7
7
 
@@ -23,11 +23,9 @@ GEM
23
23
  nio4r (>= 0.5.0)
24
24
  coderay (1.0.9)
25
25
  ffi (1.9.0)
26
- ffi (1.9.0-java)
27
26
  http (0.5.0)
28
27
  http_parser.rb
29
28
  http_parser.rb (0.6.0.beta.2)
30
- http_parser.rb (0.6.0.beta.2-java)
31
29
  hybridgroup-crubyflie (0.1.4)
32
30
  libusb
33
31
  trollop
@@ -41,16 +39,10 @@ GEM
41
39
  metaclass (~> 0.0.1)
42
40
  multi_json (1.8.2)
43
41
  nio4r (0.5.0)
44
- nio4r (0.5.0-java)
45
42
  pry (0.9.12.2)
46
43
  coderay (~> 1.0.5)
47
44
  method_source (~> 0.8)
48
45
  slop (~> 3.4)
49
- pry (0.9.12.2-java)
50
- coderay (~> 1.0.5)
51
- method_source (~> 0.8)
52
- slop (~> 3.4)
53
- spoon (~> 0.0)
54
46
  rake (10.1.0)
55
47
  reel (0.4.0)
56
48
  celluloid (>= 0.15.1)
@@ -59,8 +51,6 @@ GEM
59
51
  http_parser.rb (>= 0.6.0.beta.2)
60
52
  websocket_parser (>= 0.1.4)
61
53
  slop (3.4.6)
62
- spoon (0.0.4)
63
- ffi
64
54
  thor (0.18.1)
65
55
  timers (1.1.0)
66
56
  trollop (2.0)
@@ -0,0 +1,23 @@
1
+ require 'artoo'
2
+
3
+ connection :crazyflie, :adaptor => :crazyflie, :supports_hover => true
4
+ #device :commander, :driver => :crazyflie, :connection => :crazyflie
5
+ device :drone, :driver => :crazyflie_nav, :connection => :crazyflie
6
+
7
+ work do
8
+ #commander.start
9
+
10
+ #puts drone.toc
11
+ # drone.start_get_value("pid_attitude.pitch_kp")
12
+ # drone.start_get_value("pid_attitude.pitch_ki")
13
+ # drone.start_get_value("pid_attitude.pitch_kd")
14
+ drone.log_value("stabilizer.pitch")
15
+ drone.start_logging
16
+
17
+ every(1.seconds) {
18
+ puts drone.log
19
+ #puts drone.values["pid_attitude.pitch_kp"]
20
+ #puts drone.values["pid_attitude.pitch_ki"]
21
+ #puts drone.values["pid_attitude.pitch_kd"]
22
+ }
23
+ end
@@ -0,0 +1,44 @@
1
+ require 'artoo'
2
+
3
+ # connection :crazyflie, :adaptor => :crazyflie, :supports_hover => true
4
+ # device :drone, :driver => :crazyflie, :connection => :crazyflie, :interval => 0.1
5
+
6
+ connection :pebble, :adaptor => :pebble, :port => '127.0.0.1:4567', :id => "378B"
7
+ device :watch, :driver => :pebble, :connection => :pebble
8
+
9
+ work do
10
+ on watch, :media_control => :button_push
11
+
12
+ display_watch
13
+ end
14
+
15
+ def button_push(caller, data)
16
+ return if data.nil?
17
+
18
+ case data.button
19
+ when :previous
20
+ drone.take_off
21
+
22
+ when :next
23
+ drone.land
24
+ drone.stop
25
+
26
+ when :playpause
27
+ if @hovering
28
+ @hovering = false
29
+ drone.hover(:stop)
30
+ drone.land
31
+ drone.stop
32
+ else
33
+ @hovering = true
34
+ drone.hover(:start)
35
+ end
36
+
37
+ else
38
+ puts "WAT"
39
+ end
40
+ end
41
+
42
+ def display_watch
43
+ watch.set_nowplaying_metadata("Takeoff", "Landing", "Hover")
44
+ end
@@ -1,3 +1,4 @@
1
1
  require 'lib/artoo/adaptors/crazyflie'
2
2
  require 'lib/artoo/drivers/crazyflie'
3
+ require 'lib/artoo/drivers/crazyflie_nav'
3
4
  require 'lib/artoo-crazyflie/version'
@@ -1,5 +1,5 @@
1
1
  module Artoo
2
2
  module Crazyflie
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
@@ -0,0 +1,53 @@
1
+ require 'artoo/drivers/driver'
2
+
3
+ module Artoo
4
+ module Drivers
5
+ # The crazyflie driver behaviors
6
+ class CrazyflieNav < Driver
7
+ COMMANDS = [:start_get_value, :toc, :values, :log].freeze
8
+
9
+ attr_reader :values, :log
10
+
11
+ # Start driver and any required connections
12
+ def start_driver
13
+ begin
14
+ @values = {}
15
+ @log = {}
16
+
17
+ super
18
+ rescue Exception => e
19
+ Logger.error "Error starting Crazyflie nav driver!"
20
+ Logger.error e.message
21
+ Logger.error e.backtrace.inspect
22
+ end
23
+ end
24
+
25
+ def toc
26
+ connection.param.toc
27
+ end
28
+
29
+ def start_get_value(value)
30
+ connection.param.get_value(value) do |val|
31
+ @values[value] = val
32
+ end
33
+ end
34
+
35
+ def log_value(value, x=true, y=7, z=7)
36
+ @log_conf_var = ::Crubyflie::LogConfVariable.new(value, x, y, z)
37
+ end
38
+
39
+ def start_logging
40
+ # We want to fetch it every 0.1 secs
41
+ @log_conf = ::Crubyflie::LogConf.new([@log_conf_var], {:period => 10})
42
+
43
+ # With the configuration object, register a log_block
44
+ @block_id = connection.log.create_log_block(@log_conf)
45
+
46
+ # Start logging
47
+ connection.log.start_logging(@block_id) do |data|
48
+ @log = data
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artoo-crazyflie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Zankich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-18 00:00:00.000000000 Z
11
+ date: 2013-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: artoo
@@ -98,10 +98,13 @@ files:
98
98
  - examples/crazy_hover.rb
99
99
  - examples/crazy_joystick.rb
100
100
  - examples/crazy_leapmotion.rb
101
+ - examples/crazy_nav.rb
102
+ - examples/crazy_pebble.rb
101
103
  - lib/artoo-crazyflie.rb
102
104
  - lib/artoo-crazyflie/version.rb
103
105
  - lib/artoo/adaptors/crazyflie.rb
104
106
  - lib/artoo/drivers/crazyflie.rb
107
+ - lib/artoo/drivers/crazyflie_nav.rb
105
108
  - test/adaptors/crazyflie_adaptor_test.rb
106
109
  - test/drivers/crazyflie_driver_test.rb
107
110
  - test/test_helper.rb