[Rock-dev] Access port type name of a service port
Sylvain Joyeux
sylvain.joyeux at dfki.de
Wed Aug 14 13:19:59 CEST 2013
On 08/14/2013 12:42 PM, Christian Rauch wrote:
> In the method "dynamic_connect" I want to get the type of the port on
> both cases: when port is a port given by the task, and when port is a
> port given by a service.
> 'orocos_type_name' just works for the concrete task, whereas 'type.name'
> also works with the service but gives me the wrapper type:
> "/wrappers/VectorX</double>" when I expect '/base/VectorXd'.
>
> How do I get the type name '/base/VectorXd' from the port 'prediction'?
> (type_to_vector seems just to work with "/base/VectorXd" and not with
> "/wrappers/VectorX</double>" as is the same case with
> "/base/samples/IMUSensors_m" and "/base/samples/IMUSensors")
The best way is to convert the syskit port into an orocos port. This can
be done, in every case, by calling #to_orocos_port:
dynamic_connect(gyro_base_child.calibrated_sensors.to_orocos_port, [...])
dynamic_connect(gyro_prediction_child.prediction_port.to_orocos_port,
[...])
You also have to keep in mind that, when you are in a 'on' block like
this, there is no such thing as a service. If your task's port name was
different than the service port name, the code you wrote would not work.
To get the service interface here, you need to use #as
gyro_prediction_child.as(PredictorSrv).prediction_port.to_orocos_port
--
Sylvain Joyeux (Dr.Ing.)
Senior Researcher
Space & Security Robotics
Underwater Robotics
!!! Achtung, neue Telefonnummer!!!
Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Phone: +49 (0)421 178-454136
Fax: +49 (0)421 218-454150
E-Mail: robotik 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