[Rock-dev] Syskit::Composition child access within own methods

Christian Rauch Christian.Rauch at dfki.de
Thu Nov 21 10:47:23 CET 2013



Am 21.11.2013 09:57, schrieb Sylvain Joyeux:
> On 11/20/2013 08:26 PM, Christian Rauch wrote:
>> As the on(:start) of the base class is called first, I cannot define
>> this in the on(:start) of the inheriting composition.
> Why is that ? Should work absolutely fine.

The super classes methods are called first.
E.g., adding some debugging output in the on(:start) blocks:
{{{
     class TriggerIF < Syskit::Composition

         on(:start) do |ev|
             puts "start Trigger"
             @trigger = @rl.trigger(get_name, get_sources, get_block)
         end

         [...]
     end
}}}

{{{
     class GyroTrigger < Virgo::TriggerIF
         add Virgo::VectorDoubleTimedSrv, :as => 'sync'

         on(:start) do |ev|
             puts "start GyroTrigger"
         end

         [...]
     end
}}}

You will get:
{{{
start Trigger
start GyroTrigger
}}}
when GyroTrigger is executed (by a definition) over the syskit shell.

This way, the super class will use methods, that are not defined yet.


>
> Looking at your class, you should call the #get_ methods where they are
> used instead of doing it in #initialize
>

-- 
  Christian Rauch
  Space Robotics

  Universität Bremen
  FB 3 - Mathematik und Informatik
  AG Robotik
  Robert-Hooke-Straße 5
  28359 Bremen, Germany

  Tel:     +49 (0)421 178 45-6619
  Empfang: +49 (0)421 178 45-6611
  Fax:     +49 (0)421 178 45-4150
  E-Mail:  Christian.Rauch at dfki.de

  Weitere Informationen: http://www.informatik.uni-bremen.de/robotik



More information about the Rock-dev mailing list