[Rock-dev] Periodic Mars Plugin as Device in Roby
Christian Rauch
Christian.Rauch at dfki.de
Thu Jul 26 11:39:26 CEST 2012
Am 25.07.2012 12:33, schrieb Thomas Roehr:
> On 25.07.2012 11:13, Christian Rauch wrote:
>> Hi,
>>
>> if I define in Roby that:
>>
>> {{{
>> Robot.devices do
>> device(Dev::SeekurJrSimulation, :as => "simulation_deployment")
>> end
>> }}}
>>
>> {{{
>> class SeekurSimulation::Task
>> driver_for 'Dev::SeekurJrSimulation' do
>> provides Srv::ActuatorControlledSystem
>> end
>> end
>> }}}
>>
>> and the Task itself is defined as periodical in the *.orogen file
>>
>> {{{
>> task_context "Task" do
>> subclasses "simulation::Mars"
>> [...]
>> end
>>
>> deployment "simulation_deployment" do
>> sim = task("seekur_simulation", "Task").periodic(0.1)
>> [...]
>> end
>> }}}
>>
>> I will get the following error when running or instantiating:
>>
>> {{{
>> =
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:140:in
>>
>> `+': nil can't be coerced into Fixnum (TypeError)
>> = Backtrace
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:140:in
>>
>> `+',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:140:in
>>
>> `queue_size',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:291:in
>>
>> `initial_device_information_periodic_triggering',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/component.rb:179:in
>>
>> `each_task_output_port',
>> | (eval):17:in `each_value',
>> | (eval):17:in `each_output_port',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/component.rb:357:in
>>
>> `each_output_port',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/component.rb:153:in
>>
>> `each_output_port',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/component.rb:178:in
>>
>> `each_task_output_port',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:288:in
>>
>> `initial_device_information_periodic_triggering',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:263:in
>>
>> `initial_device_information_common',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:255:in
>>
>> `each',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:255:in
>>
>> `initial_device_information_common',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:287:in
>>
>> `initial_device_information_periodic_triggering',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:243:in
>>
>> `initial_device_information',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:325:in
>>
>> `initial_information',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_computation.rb:177:in
>>
>> `propagate',
>> |
>> /home/christian/rock_virgo/tools/utilrb/lib/utilrb/logger/indent.rb:23:in
>> `nest',
>> |
>> /home/christian/rock_virgo/tools/utilrb/lib/utilrb/logger/forward.rb:19:in
>>
>> `log_nest',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_computation.rb:176:in
>>
>> `propagate',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_computation.rb:173:in
>>
>> `each',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_computation.rb:173:in
>>
>> `propagate',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:172:in
>>
>> `propagate',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb:460:in
>>
>> `compute_connection_policies',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/engine.rb:1584:in
>>
>> `resolve',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/scripts/run.rb:61,
>>
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1924:in
>>
>> `execute',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1820:in
>>
>> `execute',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:622:in
>> `call',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:622:in
>> `gather_external_events',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:512:in
>> `gather_framework_errors',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:622:in
>> `gather_external_events',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1190:in
>>
>> `process_events',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:646:in
>> `gather_errors',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1189:in
>>
>> `process_events',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:476:in
>> `gather_propagation',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:546:in
>> `propagation_context',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:476:in
>> `gather_propagation',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1188:in
>>
>> `process_events',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1669:in
>>
>> `event_loop',
>> | /home/christian/rock_virgo/tools/roby/lib/roby/support.rb:182:in
>> `synchronize',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1667:in
>>
>> `event_loop',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1645:in
>>
>> `loop',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1645:in
>>
>> `event_loop',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1526:in
>>
>> `run',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1519:in
>>
>> `initialize',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1519:in
>>
>> `new',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1519:in
>>
>> `run',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1518:in
>>
>> `synchronize',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1518:in
>>
>> `run',
>> | /home/christian/rock_virgo/tools/roby/lib/roby/support.rb:137:in
>> `condition_variable',
>> |
>> /home/christian/rock_virgo/tools/roby/lib/roby/execution_engine.rb:1517:in
>>
>> `run',
>> | /home/christian/rock_virgo/tools/roby/lib/roby/app.rb:931:in `run',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/scripts/run.rb:51,
>>
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/scripts/common.rb:269:in
>>
>> `run',
>> | /home/christian/rock_virgo/tools/roby/lib/roby/exceptions.rb:333:in
>> `display_exception',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/scripts/common.rb:267:in
>>
>> `run',
>> |
>> /home/christian/rock_virgo/tools/orocos.rb/lib/orocos/roby/scripts/run.rb:50,
>>
>> | /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
>> `gem_original_require',
>> | /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require',
>> | /home/christian/rock_virgo/tools/orocos.rb/bin/rock-roby:15
>> =
>>
>> }}}
>>
>> This is caused by "triggers.map" in
>> "tools/orocos.rb/lib/orocos/roby/dataflow_dynamics.rb" line 130 being
>> empty.
> On a first glance, that looks more like a bug to me.
>
> I does not seem that triggers is empty, but rather there is a nil
> element in the Array - maybe you try to find out why!
'triggers.size' tells me that there are 0 elements in this Array.
Therefore "sample_count(duration)" does not return any value (besides nil).
After enabling "orocos/roby_plugin/DataFlowDynamics: DEBUG" in app.yml,
the debug-file stops at:
{{{
== Gathering Initial Information
computing initial information for
Orocos::RobyPlugin::SeekurSimulation::Task:0xffffffffb3fd510c{orocos_name =>
seekur_simulation, conf => [default], seekur_jr_simulation_name =>
simulation_deployment}[]
initial port dynamics on
Orocos::RobyPlugin::SeekurSimulation::Task:0xffffffffb3fd510c{orocos_name =>
seekur_simulation, conf => [default], seekur_jr_simulation_name =>
simulation_deployment}[] (device)
attached devices: simulation_deployment on seekur_jr_simulation
is triggered with a period of 0.1 seconds
simulation_deployment: 0
}}}
There are no triggers added in "PortDynamics.add_trigger(name, period,
sample_count)" as the "sample_count" (which comes from "device.burst")
is 0 when the period is not set (the last line in the debug file is
given by " #{device.name}: #{device.period} #{device.burst}").
Long story short: The Device does not seems to inherit the period of the
task (bug or feature?). If one wants a Device to provide a periodic
Service, he needs to define the period additionally (besides the *.orogen):
{{{
Robot.devices do
device(Dev::SeekurJrSimulation, :as =>
"simulation_deployment").period(0.1)
end
}}}
A nice feature would be that Devices inherits the periods of their
tasks. This could be the least common multiple of all periods if
multiple tasks are running with different frequencies.
Alternatively a reasonable error message could be given, if the period
of the Device cannot be determined.
Regards,
Christian
> A current workaround could be to compact before inject, i.e.
>
> triggers.map ...
> .compact.inject(&:+)
>
> Best
> Thomas
>>
>> Is there a restriction in using periodic Devices in Roby?
>>
>> Regards,
>> Christian
>>
>>
>
>
--
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-6550
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