[Rock-dev] How to explicit assign task ports to service ports?

Matthias Goldhoorn matthias.goldhoorn at dfki.de
Wed Sep 4 10:08:26 CEST 2013


Try apply the attached patch.

@other rock dev's:
Are you fine with that patch, it will change the behavior of the 
function. In the past every given portname-string was interpreted as a 
regular expression, which causes the fault if there ports like this:

a.somename
a.somenameextension

There was no way to get ony the first port out of this function.

Second Problem was/is that the function tool always uses the full_name 
for comparison, that means the port names were compared with "task.port" 
and not ony "port". I added the separation by checking if an "." (dot) 
is present in the given string for the port-resolution.

If no one shouts i apply the patch this afternoon to head.

Matthias


On 03.09.2013 16:27, Christian Rauch wrote:
> Here comes the full backtrace:
> {{{
> 16:26:08.746 (Roby) uncaught exception in an event handler of the 
> start event of Trigger::GyroMonitor:0x4fd5f80
> 16:26:08.746 (Roby) called during the propagation of [16:26:08.479 @7] 
> Trigger::GyroMonitor:0x4fd5f80{conf => [default]}[]/start
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/orocos.rb/lib/orocos/ports_searchable.rb:68:in 
> `find_port': /wrappers/VectorX</double> is provided by multiple ports 
> prediction_value: dbg_prediction_valueN, prediction_value (ArgumentError)
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/orocos.rb/lib/orocos/ports_searchable.rb:68:in 
> `find_port'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/syskit/lib/syskit/task_context.rb:703:in 
> `self_port_to_orocos_port'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/syskit/lib/syskit/port.rb:49:in 
> `to_orocos_port'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/syskit/lib/syskit/composition.rb:160:in `self_port_to_orocos_port' 
>
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/syskit/lib/syskit/port.rb:49:in 
> `to_orocos_port'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/bundles/virgo/models/blueprints/triggers.rb:87:in 
> `block in <class:GyroMonitor>'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/models/task.rb:509:in 
> `block (2 levels) in on'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/event.rb:648:in `call'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/event.rb:648:in `block 
> in call_handlers'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/task_event_generator.rb:89:in 
> `block in each_handler'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/models/task.rb:108:in 
> `block in each_handler'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/models/task.rb:107:in 
> `each'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/models/task.rb:107:in 
> `each_handler'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/task_event_generator.rb:89:in 
> `each_handler'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/event.rb:646:in 
> `call_handlers'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/event.rb:635:in `block 
> in fire'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:591:in 
> `propagation_context'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/event.rb:623:in `fire'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/task_event_generator.rb:65:in 
> `fire'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/event.rb:713:in 
> `emit_without_propagation'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:942:in 
> `block (2 levels) in event_propagation_step'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:591:in 
> `propagation_context'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:940:in 
> `block in event_propagation_step'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:496:in 
> `block in gather_propagation'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:591:in 
> `propagation_context'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:496:in 
> `gather_propagation'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:939:in 
> `event_propagation_step'
> 16:26:08.747 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:704:in 
> `block in event_propagation_phase'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:683:in 
> `gather_errors'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:700:in 
> `event_propagation_phase'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:1300:in 
> `process_events'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:1755:in 
> `block (2 levels) in event_loop'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/support.rb:182:in 
> `synchronize'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:1754:in 
> `block in event_loop'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:1732:in 
> `loop'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:1732:in 
> `event_loop'
> 16:26:08.748 (Roby) 
> /home/seekurjr/virgo_next/tools/roby/lib/roby/execution_engine.rb:1612:in 
> `block (3 levels) in run'
> 16:26:08.748 (Roby)
> 16:26:08.748 (Roby) EE: will kill the following tasks because of 
> unhandled exceptions:
> 16:26:08.748 (Roby)   Trigger::GyroMonitor:0x4fd5f80{conf => [default]}[]
> }}}
>
> Regards,
> Christian
>
>
> Am 03.09.2013 16:15, schrieb Matthias Goldhoorn:
>> please set in config/app.yml
>>
>>     8 log:
>>     9     filter_backtraces: false
>>
>> to get a complete backtrace ;)
>>
>> Matthias
>>
>>
>>
>>
>>
>> On 03.09.2013 15:48, Christian Rauch wrote:
>>> I forgot to mention that I am on next. I therefore changed line 315
>>> according to your suggestion, i.e.:
>>> {{{
>>> def method_missing(m, *args, &block)
>>>      if m.to_s =~ /^(\w+)_port$/
>>>          port_name = $1.to_s
>>>          mapped_port_name =
>>> @composition_task.map_child_port(@child_name, port_name)
>>>          [...]
>>> }}}
>>>
>>> The same error occurs and the backtrace is:
>>> {{{
>>> 15:47:25.897 (Roby) uncaught exception in an event handler of the
>>> start event of Trigger::GyroMonitor:0x4da12c8
>>> 15:47:25.897 (Roby) called during the propagation of [15:47:25.620 @8]
>>> Trigger::GyroMonitor:0x4da12c8{conf => [default]}[]/start
>>> 15:47:25.897 (Roby)
>>> /home/seekurjr/virgo_next/tools/orocos.rb/lib/orocos/ports_searchable.rb:68:in 
>>>
>>> `find_port': /wrappers/VectorX</double> is provided by multiple ports
>>> prediction_value: dbg_prediction_valueN, prediction_value 
>>> (ArgumentError)
>>> 15:47:25.897 (Roby)
>>> /home/seekurjr/virgo_next/tools/orocos.rb/lib/orocos/ports_searchable.rb:68:in 
>>>
>>> `find_port'
>>> 15:47:25.897 (Roby)   ./models/blueprints/triggers.rb:87:in `block in
>>> <class:GyroMonitor>'
>>> 15:47:25.898 (Roby)
>>> 15:47:25.898 (Roby) EE: will kill the following tasks because of
>>> unhandled exceptions:
>>> 15:47:25.898 (Roby)   Trigger::GyroMonitor:0x4da12c8{conf => 
>>> [default]}[]
>>> 15:47:25.919 (Robot seekurjr) cleaning up
>>> Logger::Logger:0x4c2f408{orocos_name => seekur_monitor_Logger, conf =>
>>> [default]}[]
>>> }}}
>>>
>>> Regards,
>>> Christian
>>>
>>>
>>> Am 03.09.2013 15:26, schrieb Matthias Goldhoorn:
>>>> i assume this is a mistake within the attribute_missing implementation
>>>> of composition...
>>>>
>>>> try to add (.to_s) to syskit/lib/syskit/composition.rb line 256
>>>>
>>>> 256                         port_name = $1.to_s
>>>>
>>>> and re-run your application. There should also no need to call
>>>> .to_orocos_port
>>>>
>>>> Please attach if this does not solve your problem the whole 
>>>> backtrace..
>>>>
>>>> Matthias
>>>>
>>>>
>>>>
>>>>
>>>> On 03.09.2013 14:57, Christian Rauch wrote:
>>>>> Hello,
>>>>>
>>>>> I assigned a service to a task:
>>>>> {{{
>>>>> provides Trigger::PredictorSrv,
>>>>>             'prediction' =>  'prediction_value',
>>>>>             :as =>  'predictor'
>>>>> }}}
>>>>>
>>>>> whose service port "prediction" is later on accessed by
>>>>> "gyro_prediction_child.as(PredictorSrv).prediction_port.to_orocos_port". 
>>>>>
>>>>>
>>>>>
>>>>> Doing this results in this error:
>>>>> {{{
>>>>> |
>>>>> /home/seekurjr/virgo_next/tools/orocos.rb/lib/orocos/ports_searchable.rb:68:in 
>>>>>
>>>>>
>>>>> `find_port': /wrappers/VectorX</double>  is provided by multiple 
>>>>> ports
>>>>> prediction_value: dbg_prediction_valueN, prediction_value
>>>>> (ArgumentError)
>>>>> }}}
>>>>>
>>>>> I assume here, that the task port name "prediction_value" that I gave
>>>>> explicitly in the definition is used as a search term (two ports 
>>>>> of the
>>>>> task match that substring and have same type) instead as the port I
>>>>> want.
>>>>>
>>>>> Is this the desired behaviour? Can I deactivate this behaviour and 
>>>>> have
>>>>> syskit use that port, that I explicitly gave in my service 
>>>>> assignment?
>>>>>
>>>>> Regards,
>>>>> Christian
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


-- 
  Dipl.-Inf. Matthias Goldhoorn
  Space and Underwater Robotic

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

  Tel.:     +49 421 178 45-4193
  Zentrale: +49 421 178 45-6550
  Fax:      +49 421 178 45-4150
  E-Mail:   matthias.goldhoorn at uni-bremen.de

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

-------------- nächster Teil --------------
Ein Dateianhang mit Bin?rdaten wurde abgetrennt...
Dateiname   : 0001-find_port-only-find-ports-where-the-name-match-if-no.patch
Dateityp    : text/x-patch
Dateigr??e  : 0 bytes
Beschreibung: nicht verf?gbar
URL         : http://www.dfki.de/pipermail/rock-dev/attachments/20130904/184d5115/attachment.bin 


More information about the Rock-dev mailing list