[Rock-dev] logging ruby task ports

Alexander Duda Alexander.Duda at dfki.de
Mon Feb 4 16:39:20 CET 2013


On 02/04/2013 04:22 PM, Felix Rehrmann wrote:
> Hi all,
>
> I wrote a ruby task to which I add ports that should be logged by the
> Logger of a given deployment. But the logger says that the given name is
> not a proper name (the task can be seen in rock-display).
> Details:
> The task definition and logger access:
>
> require 'orocos'
>
> include Orocos
>
> Orocos.initialize
>
> task = Orocos::RubyTaskContext.new('motion_proxy')
>
> Orocos.load_typekit "base"
> Orocos.load_typekit_for "/AriaTypes/samples/Velocity"
>
> # create ports
> task.create_input_port("motion_in","/base/MotionCommand2D")
> task.create_input_port("duration","/base/Time")
> task.create_input_port("velocity_in","/AriaTypes/samples/Velocity")
> task.create_output_port("motion_out","/base/MotionCommand2D")
> task.create_output_port("velocity_out","/AriaTypes/samples/Velocity")
>
> # logging
> begin
>       logger = Orocos::TaskContext.get 'seekur_Logger'
>       if logger.reportPort(task.name, task.motion_out.name)
>           puts "Logging to #{logger.name}"
>       else
>           puts "Could not report the port #{task.motion_out.name} of this
> task to #{logger.name}"
>           logger = nil
>       end
> rescue
>       logger = nil
>       puts "Not logging! Task seekur_Logger must be available!"
> end
>
> The reportPort operations returns false and in the Logger log one can find:
> 113.000 [ ERROR  ][OrbRunner] no such component /motion_proxy
>
> Would be nice if somebody had an idea what goes wrong.
>
> Thanks
>
> Felix
>
The Task name is wrong. You get the right one with:

logger.reportPort(task.basename, task.motion_out.name)

Alex


More information about the Rock-dev mailing list