Discussion:
[Rock-dev] Asynchronous method to write on InputPorts
Javier Hidalgo Carrió
2014-05-21 11:29:01 UTC
Permalink
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


Thanks,

Javier.
Alexander Duda
2014-05-21 11:54:47 UTC
Permalink
Post by Javier Hidalgo Carrió
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?
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
Post by Javier Hidalgo Carrió
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
Javier Hidalgo Carrió
2014-05-21 15:55:09 UTC
Permalink
port.write(sample) do |result,error|
Post by Alexander Duda
puts "could not send sample" if error
end
port.write(sample) do |result|
# will only be called if sample was sent
end
Supergeil!!

Thanks, Javier.
Post by Alexander Duda
Alex
Loading...