[Rock-dev] accessing ports in syskit compositions via services

Felix Rehrmann felix.rehrmann at dfki.de
Tue Jun 25 14:15:06 CEST 2013


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