ruby-player 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.md +12 -0
- data/README.md +11 -8
- data/TODO.md +0 -6
- data/lib/ruby-player.rb +1 -0
- data/lib/ruby-player/aio.rb +73 -0
- data/lib/ruby-player/client.rb +10 -2
- data/lib/ruby-player/position2d.rb +30 -29
- data/lib/ruby-player/ranger.rb +3 -29
- data/lib/ruby-player/version.rb +1 -1
- data/ruby-player.gemspec +3 -3
- data/spec/aio_spec.rb +48 -0
- data/spec/client_spec.rb +14 -3
- data/spec/position2d_spec.rb +7 -0
- metadata +59 -20
data/NEWS.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 2012-06-17 0.6.0
|
2
|
+
|
3
|
+
* Deleted deprecated methods.
|
4
|
+
* Added method Position2d#set_pose.
|
5
|
+
* Added alternate method for subscribing:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
robot.ranger(1) # eql robot.subscribe(:ranger, index: 1)
|
9
|
+
```
|
10
|
+
|
11
|
+
* Added *aio* interface.
|
12
|
+
|
1
13
|
## 2012-04-13 0.5.1
|
2
14
|
|
3
15
|
* Fixed bugs in XDR array for ActArray, BlobFinder and Ranger classes.
|
data/README.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
Ruby Player -
|
1
|
+
Ruby Player - client library for the Player (operation system for robots) in pure Ruby. [![Build Status](https://secure.travis-ci.org/flipback/ruby-player.png)](http://travis-ci.org/flipback/ruby-player)
|
2
2
|
|
3
3
|
Summary
|
4
4
|
-------------------------------------
|
5
5
|
Ruby Player provide high level client library to access to Player server in pure Ruby.
|
6
6
|
|
7
|
-
This project is active developing now! *Please don't use it in serious projects.*
|
8
|
-
|
9
7
|
Why?
|
10
8
|
-------------------------------------
|
11
9
|
The Player project distributes bindings of client libraries for Ruby and Python but I think that this project has several reasons to be:
|
@@ -22,17 +20,19 @@ Install
|
|
22
20
|
Example
|
23
21
|
-------------------------------------
|
24
22
|
|
23
|
+
```ruby
|
25
24
|
require 'ruby-player'
|
26
25
|
Player::Client.connect("localhost") do |robot|
|
27
|
-
pos2d = robot.
|
28
|
-
ranger = robot.
|
26
|
+
pos2d = robot.position2d(1)
|
27
|
+
ranger = robot.ranger
|
29
28
|
pos2d.set_speed(vx: 1, vy: 0, va: 0.2)
|
30
29
|
#main loop
|
31
30
|
robot.loop do
|
32
31
|
puts "Position: x=%{px}, y=%{py}, a=%{pa}" % pos2d.state
|
33
|
-
puts "Rangers: #{ranger.collect
|
32
|
+
puts "Rangers: #{ranger.collect(&:range)}"
|
34
33
|
end
|
35
34
|
end
|
35
|
+
```
|
36
36
|
|
37
37
|
API coverage
|
38
38
|
-------------------------------------
|
@@ -40,6 +40,7 @@ The list of support objects and devices of Player.
|
|
40
40
|
|
41
41
|
* Client object
|
42
42
|
* ActArray
|
43
|
+
* AIO
|
43
44
|
* BlobFinder
|
44
45
|
* Gripper
|
45
46
|
* Position2d
|
@@ -57,13 +58,15 @@ Requirements
|
|
57
58
|
References
|
58
59
|
-------------------------------------
|
59
60
|
|
60
|
-
[Home page](http://
|
61
|
+
[Home page](http://flipback.github.com/ruby-player/)
|
62
|
+
|
63
|
+
[Wiki](https://github.com/flipback/ruby-player/wiki)
|
61
64
|
|
62
65
|
[Documentation](http://rubydoc.info/gems/ruby-player/)
|
63
66
|
|
64
67
|
[Player project](http://playerstage.sourceforge.net/)
|
65
68
|
|
66
|
-
[C API Player](http://playerstage.sourceforge.net/doc/Player-
|
69
|
+
[C API Player](http://playerstage.sourceforge.net/doc/Player-svn/player/group__player__clientlib__libplayerc.html)
|
67
70
|
|
68
71
|
Authors
|
69
72
|
-------------------------------------
|
data/TODO.md
CHANGED
@@ -5,10 +5,6 @@ For supported devices
|
|
5
5
|
|
6
6
|
Implement PLAYER_RANGER_DATA_RANGESTAMPED and PLAYER_RANGER_DATA_INTNSTAMPED
|
7
7
|
|
8
|
-
**position2d** - The position2d proxy provides an interface to a mobile robot base
|
9
|
-
|
10
|
-
Implement PLAYER_POSITION2D_CMD_POS command
|
11
|
-
|
12
8
|
Candidates for support
|
13
9
|
--------------------------------------
|
14
10
|
|
@@ -21,8 +17,6 @@ Candidates for support
|
|
21
17
|
Device proxies are not started to develop
|
22
18
|
--------------------------------------
|
23
19
|
|
24
|
-
**aio** - The aio proxy provides an interface to the analog input/output sensors.
|
25
|
-
|
26
20
|
**audio** - The audio proxy provides access to drivers supporting the audio_interface.
|
27
21
|
|
28
22
|
**blinkenlight** - The blinkenlight proxy provides an interface to a (possibly colored and/or blinking) indicator light.
|
data/lib/ruby-player.rb
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Ruby Player - Ruby client library for Player (tools for robots)
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012 Aleksey Timin
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
|
15
|
+
module Player
|
16
|
+
# The aio interface provides access to an analog I/O device.
|
17
|
+
class AIO < Device
|
18
|
+
include Enumerable
|
19
|
+
|
20
|
+
attr_reader :state
|
21
|
+
|
22
|
+
def initialize(dev, client)
|
23
|
+
super
|
24
|
+
@state = { voltages: [] }
|
25
|
+
end
|
26
|
+
|
27
|
+
# The samples [V]
|
28
|
+
# @retrun [Array]
|
29
|
+
def voltages
|
30
|
+
state[:voltages]
|
31
|
+
end
|
32
|
+
|
33
|
+
# The aio interface allows for the voltage level on one output to be set
|
34
|
+
# @param id [Integer] which I/O output to command.
|
35
|
+
# @param voltage [Float] voltage level to set.
|
36
|
+
# @return [AIO] self
|
37
|
+
def set_voltage(id, voltage)
|
38
|
+
send_message(PLAYER_MSGTYPE_CMD, PLAYER_AIO_CMD_STATE, [id, voltage].pack("Ng"))
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
42
|
+
def fill(hdr, msg)
|
43
|
+
case hdr.subtype
|
44
|
+
when PLAYER_AIO_DATA_STATE
|
45
|
+
read_state(msg)
|
46
|
+
else
|
47
|
+
unexpected_message hdr
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Get single sample [V]
|
52
|
+
# @return [Float]
|
53
|
+
def [](id)
|
54
|
+
state[:voltages][id]
|
55
|
+
end
|
56
|
+
|
57
|
+
# @see #set_voltage
|
58
|
+
def []=(id, voltage)
|
59
|
+
set_voltage(id, voltage)
|
60
|
+
end
|
61
|
+
|
62
|
+
def each
|
63
|
+
state[:voltages].each { |v| yield v }
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
def read_state(msg)
|
68
|
+
data = msg.unpack("NNg*")
|
69
|
+
@state[:voltages] = data[2..-1]
|
70
|
+
debug "Got voltages #{data[2..-1]}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/ruby-player/client.rb
CHANGED
@@ -137,10 +137,10 @@ module Player
|
|
137
137
|
# read device identifier
|
138
138
|
dev_addr = DevAddr.decode(msg[0,PLAYERXDR_DEVADDR_SIZE])
|
139
139
|
# read the granted access and driver name
|
140
|
-
data = msg[PLAYERXDR_DEVADDR_SIZE,8].unpack("
|
140
|
+
data = msg[PLAYERXDR_DEVADDR_SIZE,8].unpack("NN")
|
141
141
|
access = data[0]
|
142
142
|
# read driver name
|
143
|
-
drv_name = msg[-data[1]-
|
143
|
+
drv_name = msg[-data[1]-3..-1]
|
144
144
|
|
145
145
|
if access == PLAYER_ERROR_MODE
|
146
146
|
raise_error "Error subscribing to " + dev_addr.interface_name + ":" + dev_addr.index
|
@@ -219,5 +219,13 @@ module Player
|
|
219
219
|
debug "Read #{hdr}"
|
220
220
|
hdr
|
221
221
|
end
|
222
|
+
|
223
|
+
def method_missing(name, *args)
|
224
|
+
if Player.constants.include?("PLAYER_#{name.to_s.upcase}_CODE".to_sym)
|
225
|
+
subscribe(name, index:args[0], access:args[1])
|
226
|
+
else
|
227
|
+
super
|
228
|
+
end
|
229
|
+
end
|
222
230
|
end
|
223
231
|
end
|
@@ -14,7 +14,6 @@
|
|
14
14
|
|
15
15
|
module Player
|
16
16
|
# The position2d proxy provides an interface to a mobile robot base
|
17
|
-
# TODO: Implement PLAYER_POSITION2D_CMD_POS command
|
18
17
|
#
|
19
18
|
# @example
|
20
19
|
# # get proxy object
|
@@ -86,18 +85,6 @@ module Player
|
|
86
85
|
state[:stall] != 0
|
87
86
|
end
|
88
87
|
|
89
|
-
# @deprecated Use {#power?}
|
90
|
-
def power
|
91
|
-
warn "Method `power` is deprecated. Pleas use `power?`"
|
92
|
-
power?
|
93
|
-
end
|
94
|
-
|
95
|
-
# @deprecated Use {#state}
|
96
|
-
def position
|
97
|
-
warn "Method `position` is deprecated. Pleas use `data` for access to position"
|
98
|
-
state
|
99
|
-
end
|
100
|
-
|
101
88
|
# Query robot geometry
|
102
89
|
# @return [Position2d] self
|
103
90
|
def query_geom
|
@@ -112,12 +99,6 @@ module Player
|
|
112
99
|
self
|
113
100
|
end
|
114
101
|
|
115
|
-
# @deprecated Use {#power_on!}
|
116
|
-
def turn_on!
|
117
|
-
warn "Method `turn_on!` is deprecated. Pleas use `power_on!`"
|
118
|
-
power_on!
|
119
|
-
end
|
120
|
-
|
121
102
|
# Turn off motor
|
122
103
|
# @return [Position2d] self
|
123
104
|
def power_off!
|
@@ -125,12 +106,6 @@ module Player
|
|
125
106
|
self
|
126
107
|
end
|
127
108
|
|
128
|
-
# @deprecated Use {#power_off!}
|
129
|
-
def turn_off!
|
130
|
-
warn "Method `turn_off!` is deprecated. Pleas use `power_off!`"
|
131
|
-
power_off!
|
132
|
-
end
|
133
|
-
|
134
109
|
# @return [Position2d] self
|
135
110
|
def direct_speed_control!
|
136
111
|
send_message(PLAYER_MSGTYPE_REQ, PLAYER_POSITION2D_REQ_VELOCITY_MODE, [0].pack("N"))
|
@@ -233,7 +208,7 @@ module Player
|
|
233
208
|
# @option speeds :va rotational speed (rad/s).
|
234
209
|
# @option speeds :stall state of motor
|
235
210
|
# @return [Position2d] self
|
236
|
-
def set_speed(speeds)
|
211
|
+
def set_speed(speeds={})
|
237
212
|
data = [
|
238
213
|
speeds[:vx] || @state[:vx],
|
239
214
|
speeds[:vy] || @state[:vy],
|
@@ -249,7 +224,7 @@ module Player
|
|
249
224
|
# @option speeds :vx forward speed (m/s)
|
250
225
|
# @option speeds :a turning angle (rad).
|
251
226
|
# @return [Position2d] self
|
252
|
-
def set_car(speeds)
|
227
|
+
def set_car(speeds={})
|
253
228
|
data = [
|
254
229
|
speeds[:vx] || @state[:vx],
|
255
230
|
speeds[:a] || 0
|
@@ -264,15 +239,41 @@ module Player
|
|
264
239
|
# @option speeds :vx forward speed (m/s)
|
265
240
|
# @option speeds :a absolutle angle (rad).
|
266
241
|
# @return [Position2d] self
|
267
|
-
def set_speed_head(speeds)
|
242
|
+
def set_speed_head(speeds={})
|
268
243
|
data = [
|
269
244
|
speeds[:vx] || @state[:vx],
|
270
|
-
speeds[:a] || @state[:pa]
|
245
|
+
speeds[:a] || @state[:pa],
|
271
246
|
]
|
272
247
|
send_message(PLAYER_MSGTYPE_CMD, PLAYER_POSITION2D_CMD_VEL_HEAD, data.pack("GG"))
|
273
248
|
self
|
274
249
|
end
|
275
250
|
|
251
|
+
# Set the target pose with motion vel. (gx, gy, ga) is the target pose in the
|
252
|
+
# odometric coordinate system.
|
253
|
+
# @param [Hash] pose
|
254
|
+
# @option pose :gx x coordinate [m]
|
255
|
+
# @option pose :gy y coordinate [m]
|
256
|
+
# @option pose :ga angle [rad]
|
257
|
+
# @option pose :vx forward vel [m/s] (default current)
|
258
|
+
# @option pose :vy sideways vel [m/s] (default current)
|
259
|
+
# @option pose :va rotational speed [rad/s] (default current)
|
260
|
+
# @option pose :stall state of motor (default current)
|
261
|
+
# @return [Position2d] self
|
262
|
+
def set_pose(pose={})
|
263
|
+
data = [
|
264
|
+
pose[:gx].to_f,
|
265
|
+
pose[:gy].to_f,
|
266
|
+
pose[:ga].to_f,
|
267
|
+
pose[:vx] || @state[:vx],
|
268
|
+
pose[:vy] || @state[:vy],
|
269
|
+
pose[:va] || @state[:va],
|
270
|
+
pose[:stall] || @state[:stall]
|
271
|
+
]
|
272
|
+
|
273
|
+
send_message(PLAYER_MSGTYPE_CMD, PLAYER_POSITION2D_CMD_POS, data.pack("GGGGGGN"))
|
274
|
+
self
|
275
|
+
end
|
276
|
+
|
276
277
|
# Stop robot set speed to 0
|
277
278
|
# @return [Position2d] self
|
278
279
|
def stop!
|
data/lib/ruby-player/ranger.rb
CHANGED
@@ -15,19 +15,17 @@
|
|
15
15
|
module Player
|
16
16
|
# The ranger proxy provides an interface to the ranger sensors built into robots
|
17
17
|
# TODO Implement PLAYER_RANGER_DATA_RANGESTAMPED and PLAYER_RANGER_DATA_INTNSTAMPED
|
18
|
-
#
|
18
|
+
# TODO Implement state attr => { ranges: [0.0, 0.0], intensity: [0.0, 0.0] }
|
19
19
|
# @example
|
20
20
|
# ranger = robot.subscribe(:ranger, index: 0)
|
21
21
|
# ranger[0].range #=> 0.2
|
22
22
|
class Ranger < Device
|
23
23
|
include Enumerable
|
24
24
|
|
25
|
-
|
26
25
|
# Configuration of ranger
|
27
26
|
# @see #set_config
|
28
27
|
attr_reader :config
|
29
28
|
|
30
|
-
|
31
29
|
# Device geometry
|
32
30
|
# @return [Hash] geometry { :px, :py. :pz, :proll, :ppitch, :pyaw, :sw, :sl, :sh, :sensors => [geom of sensors] }
|
33
31
|
attr_reader :geom
|
@@ -39,18 +37,6 @@ module Player
|
|
39
37
|
@config = { min_angle: 0.0, max_angle: 0.0, angular_res: 0.0, min_range: 0.0, max_range: 0.0, range_res: 0.0, frequecy: 0.0 }
|
40
38
|
end
|
41
39
|
|
42
|
-
# @deprecated use `ranger.collect { |r| r.range }
|
43
|
-
def rangers
|
44
|
-
warn "Method `rangers` is deprecated. Pleas use `ranger.collect { |r| r.range }`"
|
45
|
-
@sensors.collect { |s| s.range }
|
46
|
-
end
|
47
|
-
|
48
|
-
# @deprecated use `ranger.collect { |r| r.intensity }
|
49
|
-
def intensities
|
50
|
-
warn "Method `intensities` is deprecated. Pleas use `ranger.collect { |r| r.intensity }`"
|
51
|
-
@sensors.collect { |s| s.intensity }
|
52
|
-
end
|
53
|
-
|
54
40
|
# Query ranger geometry
|
55
41
|
# @return [Ranger] self
|
56
42
|
def query_geom
|
@@ -65,12 +51,6 @@ module Player
|
|
65
51
|
self
|
66
52
|
end
|
67
53
|
|
68
|
-
# @deprecated Use {#power_on!}
|
69
|
-
def turn_on!
|
70
|
-
warn "Method `turn_on!` is deprecated. Pleas use `power_on!`"
|
71
|
-
power_on!
|
72
|
-
end
|
73
|
-
|
74
54
|
# Turn off ranger
|
75
55
|
# @return [Ranger] self
|
76
56
|
def power_off!
|
@@ -78,12 +58,6 @@ module Player
|
|
78
58
|
self
|
79
59
|
end
|
80
60
|
|
81
|
-
# @deprecated Use {#power_off!}
|
82
|
-
def turn_off!
|
83
|
-
warn "Method `turn_off!` is deprecated. Pleas use `power_off!`"
|
84
|
-
power_off!
|
85
|
-
end
|
86
|
-
|
87
61
|
# @return [Ranger] self
|
88
62
|
def intensity_enable!
|
89
63
|
send_message(PLAYER_MSGTYPE_REQ, PLAYER_RANGER_REQ_INTNS, [1].pack("N"))
|
@@ -122,6 +96,7 @@ module Player
|
|
122
96
|
def fill(hdr, msg)
|
123
97
|
case hdr.subtype
|
124
98
|
when PLAYER_RANGER_DATA_RANGE
|
99
|
+
# TODO: remove to separate method read_range
|
125
100
|
data = msg.unpack("NNG*")
|
126
101
|
data[2..-1].each_with_index do |r, i|
|
127
102
|
self[i].state[:range] = r
|
@@ -129,6 +104,7 @@ module Player
|
|
129
104
|
|
130
105
|
debug "Got rangers #{@sensors.collect { |s| s.state[:range] }}"
|
131
106
|
when PLAYER_RANGER_DATA_INTNS
|
107
|
+
# TODO: remove to separate method read_intns
|
132
108
|
data = msg.unpack("NNG*")
|
133
109
|
data[2..-1].each_with_index do |ints, i|
|
134
110
|
self[i].state[:intensity] = ints
|
@@ -196,8 +172,6 @@ module Player
|
|
196
172
|
.each_with_index { |k,j| self[i].geom[k] = sizes[3*i + j] }
|
197
173
|
debug("Got sizes for ##{i} sensor: sw=%.2f, sl=%.2f, sh=%.2f" % @sensors[i].geom.values[6,3])
|
198
174
|
end
|
199
|
-
|
200
175
|
end
|
201
|
-
|
202
176
|
end
|
203
177
|
end
|
data/lib/ruby-player/version.rb
CHANGED
data/ruby-player.gemspec
CHANGED
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Player::VERSION
|
8
8
|
s.authors = ["Aleksey Timin"]
|
9
9
|
s.email = ["atimin@gmail.com"]
|
10
|
-
s.homepage = "http://
|
11
|
-
s.summary = %q{Ruby
|
12
|
-
s.description = %q{Ruby Player -
|
10
|
+
s.homepage = "http://flipback.github.com/ruby-player/"
|
11
|
+
s.summary = %q{Ruby player - client library for the Player (operation system for robots) in pure Ruby.}
|
12
|
+
s.description = %q{Ruby Player - client library for the Player (operation system for robots) in pure Ruby.}
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/spec/aio_spec.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
include Player
|
4
|
+
describe AIO do
|
5
|
+
before do
|
6
|
+
client = mock_client
|
7
|
+
@aio = Player::AIO.new(
|
8
|
+
Player::DevAddr.new(host: 0, robot:0, interface: PLAYER_AIO_CODE, index: 0),
|
9
|
+
client
|
10
|
+
)
|
11
|
+
|
12
|
+
mock_sending_message(@aio)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have default values' do
|
16
|
+
@aio.state.should eql(voltages: [])
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should have #voltages attr' do
|
20
|
+
@aio.should_receive(:state).and_return(voltages: [0.2])
|
21
|
+
@aio.voltages.should eql([0.2])
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should set output' do
|
25
|
+
should_send_message(PLAYER_MSGTYPE_CMD, PLAYER_AIO_CMD_STATE, [0, 0.5].pack("Ng"))
|
26
|
+
@aio.set_voltage(0, 0.5)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should set output by #[]=' do
|
30
|
+
should_send_message(PLAYER_MSGTYPE_CMD, PLAYER_AIO_CMD_STATE, [0, 0.5].pack("Ng"))
|
31
|
+
@aio[0] = 0.5
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should fill data' do
|
35
|
+
msg = [ 4, 4, 0.5, 1.0, 2.0, 4.0 ].pack('NNg*')
|
36
|
+
@aio.fill(
|
37
|
+
Player::Header.from_a([0,0,PLAYER_AIO_CODE,0, PLAYER_MSGTYPE_DATA, PLAYER_AIO_DATA_STATE, 0.0, 0, msg.bytesize]),
|
38
|
+
msg
|
39
|
+
)
|
40
|
+
|
41
|
+
@aio.state[:voltages].should eql([0.5, 1.0, 2.0, 4.0])
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should implement Enumerable' do
|
45
|
+
@aio.stub(:state).and_return(voltages: [0.2, 0.4])
|
46
|
+
@aio.each_with_index { |v, i| v.should eql(@aio[i]) }
|
47
|
+
end
|
48
|
+
end
|
data/spec/client_spec.rb
CHANGED
@@ -124,22 +124,33 @@ describe Player::Client do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
describe "Subscribe" do
|
127
|
-
def mock_subscribe(code, index=0)
|
127
|
+
def mock_subscribe(code, index=0, mode=PLAYER_OPEN_MODE)
|
128
128
|
should_send_message(
|
129
129
|
hdr(0, 0, 1, 0, PLAYER_MSGTYPE_REQ, PLAYER_PLAYER_REQ_DEV, 0.0, 0, 28),
|
130
|
-
[0, 0, code, index,
|
130
|
+
[0, 0, code, index, mode, 0, 0].pack("N*")
|
131
131
|
)
|
132
132
|
|
133
133
|
should_request_data
|
134
134
|
|
135
135
|
should_read_message(
|
136
136
|
hdr(16777343, 6665, PLAYER_PLAYER_CODE, 0, PLAYER_MSGTYPE_RESP_ACK, PLAYER_PLAYER_REQ_DEV, 0.0, 0, 35),
|
137
|
-
[0, 6665, code, index,
|
137
|
+
[0, 6665, code, index, mode, 5, 5].pack("N*") + "mock"
|
138
138
|
)
|
139
139
|
|
140
140
|
should_recive_sync
|
141
141
|
end
|
142
142
|
|
143
|
+
it 'should have alternate method for subscribing' do
|
144
|
+
mock_subscribe(PLAYER_POSITION2D_CODE)
|
145
|
+
@cl.position2d
|
146
|
+
|
147
|
+
mock_subscribe(PLAYER_RANGER_CODE, 1)
|
148
|
+
@cl.ranger(1)
|
149
|
+
|
150
|
+
mock_subscribe(PLAYER_GRIPPER_CODE, 2, PLAYER_CLOSE_MODE)
|
151
|
+
@cl.gripper(2, PLAYER_CLOSE_MODE)
|
152
|
+
end
|
153
|
+
|
143
154
|
it 'should for unique devices' do
|
144
155
|
mock_subscribe(PLAYER_POSITION2D_CODE)
|
145
156
|
@cl.subscribe("position2d")
|
data/spec/position2d_spec.rb
CHANGED
@@ -162,6 +162,13 @@ describe Player::Position2d do
|
|
162
162
|
@pos2d.set_speed_head(speed)
|
163
163
|
end
|
164
164
|
|
165
|
+
it 'should set pose' do
|
166
|
+
pose = { gx: 0.4, gy: 0.5, ga: 0.7, vx: 0.1, vy: 0.2, va: 0.3, stall: 1 }
|
167
|
+
should_send_message(PLAYER_MSGTYPE_CMD, PLAYER_POSITION2D_CMD_POS, pose.values.pack("GGGGGGN"))
|
168
|
+
|
169
|
+
@pos2d.set_pose(pose)
|
170
|
+
end
|
171
|
+
|
165
172
|
it 'should have stop' do
|
166
173
|
@pos2d.should_receive(:set_speed).with(vx: 0, vy: 0, va: 0)
|
167
174
|
@pos2d.stop!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-player
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: isna
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 0.0.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.4
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '2.7'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.7'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rake
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0.9'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.9'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: pry
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: yard
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: redcarpet
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: guard-rspec
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ! '>='
|
@@ -87,8 +117,14 @@ dependencies:
|
|
87
117
|
version: '0'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
91
|
-
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: Ruby Player - client library for the Player (operation system for robots)
|
127
|
+
in pure Ruby.
|
92
128
|
email:
|
93
129
|
- atimin@gmail.com
|
94
130
|
executables: []
|
@@ -110,6 +146,7 @@ files:
|
|
110
146
|
- lib/ruby-player.rb
|
111
147
|
- lib/ruby-player/actarray.rb
|
112
148
|
- lib/ruby-player/actuator.rb
|
149
|
+
- lib/ruby-player/aio.rb
|
113
150
|
- lib/ruby-player/blob.rb
|
114
151
|
- lib/ruby-player/blob_finder.rb
|
115
152
|
- lib/ruby-player/client.rb
|
@@ -127,6 +164,7 @@ files:
|
|
127
164
|
- ruby-player.gemspec
|
128
165
|
- spec/actarray_spec.rb
|
129
166
|
- spec/actuator_spec.rb
|
167
|
+
- spec/aio_spec.rb
|
130
168
|
- spec/blob_finder_spec.rb
|
131
169
|
- spec/blob_spec.rb
|
132
170
|
- spec/client_spec.rb
|
@@ -138,7 +176,7 @@ files:
|
|
138
176
|
- spec/power_spec.rb
|
139
177
|
- spec/ranger_spec.rb
|
140
178
|
- spec/spec_helper.rb
|
141
|
-
homepage: http://
|
179
|
+
homepage: http://flipback.github.com/ruby-player/
|
142
180
|
licenses: []
|
143
181
|
post_install_message:
|
144
182
|
rdoc_options: []
|
@@ -158,9 +196,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
196
|
version: '0'
|
159
197
|
requirements: []
|
160
198
|
rubyforge_project:
|
161
|
-
rubygems_version: 1.8.
|
199
|
+
rubygems_version: 1.8.23
|
162
200
|
signing_key:
|
163
201
|
specification_version: 3
|
164
|
-
summary: Ruby
|
202
|
+
summary: Ruby player - client library for the Player (operation system for robots)
|
203
|
+
in pure Ruby.
|
165
204
|
test_files: []
|
166
205
|
has_rdoc:
|