[Rock-dev] Asynchronous method to write on InputPorts

Alexander Duda Alexander.Duda at dfki.de
Wed May 21 13:54:47 CEST 2014


On 05/21/2014 01:29 PM, Javier Hidalgo Carrió wrote:
> Hi,
>
> I am trying to write information in an Input port using the
> Orocos::Async interface in ruby.
> My question is how to access to an Input port in an asynchronous manner,
> in a similar way when using the "blocking/non-async" method.
>
> I am trying the following
>
> locomotion_control = Orocos::Async.proxy 'locomotion_control'
> locomotion_control.on_reachable do
>                   motion_cmd = Types::Base::Commands::Motion2D.new
>                   motion_cmd.translation = translation
>                   motion_cmd.rotation =  rotation
>                   port = locomotion_control.port('motion_command')
>                   port.write(motion_cmd)
> end
>
> But the write method is expecting another type. Does anyone know how to
> do it?
> the write method expect something like:
>
>    def write(sample,&block)
>               if block
>       [...]
> end
port.write(sample) do |result,error|
     puts "could not send sample" if error
end

port.write(sample) do |result|
     # will only be called if sample was sent
end

Alex
>
>
> Thanks,
>
> Javier.
>
> _______________________________________________
> Rock-dev mailing list
> Rock-dev at dfki.de
> http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev


-- 
Dipl.-Ing. Alexander Duda
Unterwasserrobotik
Robotics Innovation Center

Hauptgeschäftsstelle Standort Bremen:
  DFKI GmbH
  Robotics Innovation Center
  Robert-Hooke-Straße 1
  28359 Bremen, Germany

  Tel.:     +49 421 178 45-6620
  Zentrale: +49 421 178 45-0
  Fax:      +49 421 178 45-4150 (Faxe bitte namentlich kennzeichnen)
  E-Mail:   Alexander.Duda 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