[Rock-dev] accessing ports in syskit compositions via services
Sylvain Joyeux
sylvain.joyeux at dfki.de
Thu Jun 27 10:21:19 CEST 2013
On 06/25/2013 04:47 PM, Felix Rehrmann wrote:
> And now, I just wanted to know if there is a way, that is more straight
> forward to use the abstraction
Currently, no. I've fixed the task scripting support to work at the
abstraction level, and was thinking that the data_reader / data_writer
accessors should work that way as well. I'll push it to master as soon
as next is ready.
The result will be that you can do:
class RotateTo < Syskit::Composition
add Base::Motion2DControlledSystemSrv, :as => 'system'
add Base::OrientationSrv, :as => 'orientation'
argument :target_angle, :default => 0.0
argument :rate, :default => 0.1
script do
reader = orientation_child.orientation_samples_port.reader
poll do
if value = reader.read_new
end
end
end
end
The technical issue here is that we can't make _child return
_child.as(expected_service), as it would break Roby. As far as I could
tell, we can do that only on contexts that are not accessing the Roby
API directly (i.e. the task scripting).
I'm open for suggestions, though, as I agree that it would be more intuitive
Sylvain
More information about the Rock-dev
mailing list