[Rock-dev] improvement TaskContext.get
Alexander Duda
Alexander.Duda at dfki.de
Thu Nov 3 14:51:34 CET 2011
TaskContext.get(task_name) has some drawbacks for the following use
case:
Someone is pressing on a button and wants to call an operation on a
specific task. The GUI can be started before the deployments are started
and therefore it must be checked if the task is reachable every time the
button is pressed.
The current implementation checks the nameservice for the task
and raises an error if the task cannot be found. It would be better if
the method would be doing something like:
@cache_task_context ||= Hase.new
task = @cache_task_context[task_name]
if(!task || !task.readable?)
begin
task = Orocos::TaskContext.get task_name
@cache_task_context[task_name] = task
rescue CORBA::ComError
@cache_task_context[task_name] = nil
task = nil
end
end
task
Usage:
def button
task = Orocos::TaskContext.get 'my_task'
task.myOperation() if task
end
Currently I have a helper method for this in Vizkit.rb but I think it
would be nice to move it into the method get
thoughts?
Alex
--
Dipl.-Ing. Alexander Duda
Unterwasserrobotik
DFKI Bremen
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Phone: +49 (0)421 178-456620
Fax: +49 (0)421 178-454150
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