[Rock-dev] accessing ports in syskit compositions via services
Felix Rehrmann
felix.rehrmann at dfki.de
Tue Jun 25 16:47:32 CEST 2013
Hi,
I want the abstraction. My observation basically was, that when you do
*_child in a composition, one
gets the concrete orocos object and to get a port from that, one have to
use the orocos port name.
Given an component that has an output port named "pose_samples" giving
RigidBodyState data.
Given it is used for an orientation data service that provides
RigidBodyState data under the name "orientation_samples".
Then I can access that data with
*_child.pose_samples_port
or
*_child.as(Base::OrientationSrv).orientation_samples_port
For me that is somehow counter intuitive. I assumed that with *_child I
access the abstraction and not the concrete object.
I would have expected that something like this would work:
*_child.orientation_samples_port
And now, I just wanted to know if there is a way, that is more straight
forward to use the abstraction then
the second examples. Or if it is not, whether or not it would be good
idea to make it work like that.
All the best!
Felix
On 06/25/2013 02:25 PM, Matthias Goldhoorn wrote:
> Hi,
> The whole intention about the data services is this abstraction.
> What else do you have in mind, you need to define the "generic
> portname" anywhere...
> How else should be an abstract "portname" defined an dataservice?
>
> I mean creating an data-service is an 3-liner...
>
> Matthias
>
> On 25.06.2013 14:15, Felix Rehrmann wrote:
>> Hi,
>>
>> I have a composition (see below) that has an OrientationSrv, for which I
>> found two ways of accessing the underlying port.
>> One is via the service, the other is via the orocos task. Latter has the
>> problem that it depends on the port name of the orocos
>> task, which might not be named like the service port and in this case
>> actually is not. The access via the service is a bit uncomfortable
>> as it requires the conversion into the data service first. - Is there
>> another solution which allows to access the port via the service? Say
>> a bit more straight forward?
>>
>> Felix
>>
>> 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
>>
>> on :start do |ev|
>> @cmd_writer = system_child.orocos_task.motion_command.writer
>> # The orientation service knows the port under the name
>> orientation_samples.
>> @ori_reader =
>> orientation_child.as(Base::OrientationSrv).orientation_samples_port.reader
>>
>> # The orocos task's port is actually called pose_samples.
>> #@ori_reader = orientation_child.pose_samples_port.reader
>> end
>>
>> ....
>>
>
>
--
Felix Rehrmann
Researcher
DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Phone: +49 (0)421 178 45-4129
Fax: +49 (0)421 218-64150
E-Mail: felix.rehrmann at dfki.de
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/673/0060/3
-----------------------------------------------------------------------
More information about the Rock-dev
mailing list