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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/.yardopts +1 -1
  4. data/CONTRIBUTORS.md +16 -0
  5. data/Gemfile +10 -9
  6. data/Gemfile.lock +31 -35
  7. data/README.md +110 -19
  8. data/Rakefile +0 -1
  9. data/api/assets/javascripts/artoo/controllers/robot.js.coffee +5 -8
  10. data/api/public/core.js +7 -12
  11. data/api/public/partials/robot-detail.html +1 -1
  12. data/bin/robi +1 -1
  13. data/examples/christmas_roomba.rb +16 -19
  14. data/examples/hello_api_multiple.rb +3 -2
  15. data/examples/notifications.rb +2 -2
  16. data/examples/sphero_messages.rb +9 -3
  17. data/lib/artoo/adaptors/test.rb +28 -0
  18. data/lib/artoo/connection.rb +5 -0
  19. data/lib/artoo/delegator.rb +1 -1
  20. data/lib/artoo/device.rb +13 -0
  21. data/lib/artoo/drivers/counter.rb +28 -0
  22. data/lib/artoo/drivers/pinger.rb +8 -11
  23. data/lib/artoo/drivers/random.rb +27 -0
  24. data/lib/artoo/drivers/test.rb +23 -0
  25. data/lib/artoo/master.rb +4 -2
  26. data/lib/artoo/robot.rb +11 -103
  27. data/lib/artoo/robot_class_methods.rb +147 -0
  28. data/lib/artoo/version.rb +1 -1
  29. data/test/robot_test.rb +3 -3
  30. data/test/test_helper.rb +1 -2
  31. metadata +10 -44
  32. data/bin/sphero.sh +0 -8
  33. data/bin/sphero_linux_bind.sh +0 -25
  34. data/bin/sphero_linux_socat.sh +0 -8
  35. data/examples/sphero2.rb +0 -26
  36. data/lib/artoo/adaptors/ardrone.rb +0 -41
  37. data/lib/artoo/adaptors/ardrone_navigation.rb +0 -33
  38. data/lib/artoo/adaptors/ardrone_video.rb +0 -35
  39. data/lib/artoo/adaptors/firmata.rb +0 -33
  40. data/lib/artoo/adaptors/roomba.rb +0 -51
  41. data/lib/artoo/adaptors/sphero.rb +0 -58
  42. data/lib/artoo/drivers/ardrone.rb +0 -15
  43. data/lib/artoo/drivers/ardrone_navigation.rb +0 -25
  44. data/lib/artoo/drivers/ardrone_video.rb +0 -27
  45. data/lib/artoo/drivers/button.rb +0 -59
  46. data/lib/artoo/drivers/led.rb +0 -48
  47. data/lib/artoo/drivers/motor.rb +0 -69
  48. data/lib/artoo/drivers/pinger2.rb +0 -27
  49. data/lib/artoo/drivers/roomba.rb +0 -179
  50. data/lib/artoo/drivers/servo.rb +0 -59
  51. data/lib/artoo/drivers/sphero.rb +0 -105
  52. data/lib/artoo/drivers/wiichuck.rb +0 -61
  53. data/lib/artoo/drivers/wiiclassic.rb +0 -139
  54. data/lib/artoo/drivers/wiidriver.rb +0 -102
  55. data/test/adaptors/ardrone_test.rb +0 -24
  56. data/test/adaptors/firmata_test.rb +0 -25
  57. data/test/adaptors/sphero_test.rb +0 -24
  58. data/test/drivers/ardrone_navigation_test.rb +0 -11
  59. data/test/drivers/ardrone_test.rb +0 -11
  60. data/test/drivers/ardrone_video_test.rb +0 -11
  61. data/test/drivers/led_test.rb +0 -56
  62. data/test/drivers/motor_test.rb +0 -40
  63. data/test/drivers/roomba_test.rb +0 -87
  64. data/test/drivers/servo_test.rb +0 -45
  65. data/test/drivers/sphero_test.rb +0 -54
  66. data/test/drivers/wiichuck_test.rb +0 -11
  67. data/test/drivers/wiiclassic_test.rb +0 -11
  68. data/test/drivers/wiidriver_test.rb +0 -54
@@ -1,54 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
2
- require 'artoo/drivers/sphero'
3
-
4
- describe Artoo::Drivers::Sphero do
5
- before do
6
- @device = mock('device')
7
- @driver = Artoo::Drivers::Sphero.new(:parent => @device)
8
- @connection = mock('connection')
9
- @col1 = ::Sphero::Response::CollisionDetected.new("yo", "ho")
10
- @col2 = ::Sphero::Response::CollisionDetected.new("yo", "ho")
11
- @sen1 = ::Sphero::Response::SensorData.new("yo", "ho")
12
- @sen2 = ::Sphero::Response::SensorData.new("lo", "no")
13
- @sen3 = ::Sphero::Response::SensorData.new("jo", "jo")
14
- @pow1 = ::Sphero::Response::PowerNotification.new("yo", "ho")
15
- @pow2 = ::Sphero::Response::PowerNotification.new("yo", "ho")
16
- @connection.stubs(:async_messages).returns([@col1, @col2, @sen1, @sen2, @sen3, @pow1, @pow2])
17
- @device.stubs(:connection).returns(@connection)
18
- end
19
-
20
- it 'Sphero#collisions' do
21
- @driver.collisions.size.must_equal 2
22
- end
23
-
24
- it 'Sphero#power_notifications' do
25
- @driver.power_notifications.size.must_equal 2
26
- end
27
-
28
- it 'Sphero#sensor_data' do
29
- @driver.sensor_data.size.must_equal 3
30
- end
31
-
32
- describe 'color' do
33
- it 'Sphero#color(:red)' do
34
- r, g, b = @driver.color(:red)
35
- r.must_equal 255
36
- g.must_equal 0
37
- b.must_equal 0
38
- end
39
-
40
- it 'Sphero#color(:green)' do
41
- r, g, b = @driver.color(:green)
42
- r.must_equal 0
43
- g.must_equal 255
44
- b.must_equal 0
45
- end
46
-
47
- it 'Sphero#color(r, g, b)' do
48
- r, g, b = @driver.color(2, 4, 6)
49
- r.must_equal 2
50
- g.must_equal 4
51
- b.must_equal 6
52
- end
53
- end
54
- end
@@ -1,11 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
2
- require 'artoo/drivers/wiichuck'
3
-
4
- describe Artoo::Drivers::Wiichuck do
5
- before do
6
- @device = mock('device')
7
- @driver = Artoo::Drivers::Wiichuck.new(:parent => @device)
8
- end
9
-
10
- it 'must do things'
11
- end
@@ -1,11 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
2
- require 'artoo/drivers/wiiclassic'
3
-
4
- describe Artoo::Drivers::Wiiclassic do
5
- before do
6
- @device = mock('device')
7
- @driver = Artoo::Drivers::Wiiclassic.new(:parent => @device)
8
- end
9
-
10
- it 'must do things'
11
- end
@@ -1,54 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
2
- require 'artoo/drivers/wiidriver'
3
-
4
- class Artoo::Drivers::Wiidriver
5
- public :set_joystick_default_value, :calculate_joystick_value, :encrypted?,
6
- :decode, :get_value, :generate_bool
7
- end
8
-
9
- describe Artoo::Drivers::Wiidriver do
10
- before do
11
- @device = mock('device')
12
- @driver = Artoo::Drivers::Wiidriver.new(:parent => @device)
13
- end
14
-
15
- it 'Artoo::Drivers::Wiidriver#set_joystick_default_value' do
16
- val = "101"
17
- @driver.joystick[:test_axis] = nil
18
- @driver.set_joystick_default_value(:test_axis, val)
19
- @driver.joystick[:test_axis].must_equal val
20
- end
21
-
22
- it 'Artoo::Drivers::Wiidriver#calculate_joystick_value' do
23
- @driver.data[:test_axis] = 8
24
- @driver.joystick[:test_origin] = 5
25
- @driver.calculate_joystick_value(:test_axis, :test_origin).must_equal 3
26
- end
27
-
28
- it 'Artoo::Drivers::Wiidriver#encrypted?' do
29
- value = {:data => [0, 0, 0, 0, 0, 0]}
30
- @driver.encrypted?(value).must_equal true
31
- end
32
-
33
- it 'Artoo::Drivers::Wiidriver#encrypted?' do
34
- value = {:data => [1, 2, 3, 4, 5, 6]}
35
- @driver.encrypted?(value).must_equal false
36
- end
37
-
38
- it 'Artoo::Drivers::Wiidriver#decode' do
39
- @driver.decode(22).must_equal 24
40
- @driver.decode(0).must_equal 46
41
- @driver.decode(16).must_equal 30
42
- end
43
-
44
- it 'Artoo::Drivers::Wiidriver#get_value' do
45
- value = {:data => [1, 2, 3, 4, 5, 6], :other_data => [10, 20, 30, 40, 50, 60]}
46
- @driver.get_value(value, 1).must_equal 2
47
- @driver.get_value(value, 5).must_equal 6
48
- end
49
-
50
- it 'Artoo::Drivers::Wiidriver#generate_bool' do
51
- @driver.generate_bool(0).must_equal true
52
- @driver.generate_bool(1).must_equal false
53
- end
54
- end