Command trouble after update to 1.8.1

Hi everyone,

after I updated from 1.6.x to 1.8.1 the Command Interface doesn't work well anymore.

After updating I built the whole Project new but sometimes the Command methode get called and sometimes not for no apparent reason.

Here is the code:

With this code I try to call the other task's command:
Command parseFile;
parseFile = this->getPeer("Planung")->commands()->getCommand("pre_parseFile");
parseFile(fname);

This is the desired Task/Object to be called:

Planung::Planung(string nam) : TaskContext(nam)
, C_parseFile("pre_parseFile",&Planung::pre_parseFile, Planung::done_parseFile, this)
{
...
this->commands()->addCommand( &C_parseFile, "Bla Blub", "QString","Filename");
...
}

bool Planung::pre_parseFile(QString f) {
cerr<<"Command called!\n";
return true;
}

But pre_parseFile() only gets called sometimes?? There were no warnings or errors during compile time or at runtime.

Can anyone spot the error?!

Thanks in advanced!
Johannes

Command trouble after update to 1.8.1

On Wednesday 25 March 2009 16:33:46 SchickJohannes23 [..] ... wrote:
> Hi everyone,
>
> after I updated from 1.6.x to 1.8.1 the Command Interface doesn't work well
> anymore.
>
> After updating I built the whole Project new but sometimes the Command
> methode get called and sometimes not for no apparent reason.
>
> Here is the code:
>
> With this code I try to call the other task's command:
> Command<bool(QString)> parseFile;
> parseFile =
> this->getPeer("Planung")->commands()->getCommand<bool(QString)>("pre_parseF
>ile"); parseFile(fname);

I'm just thinking of something... are you re-using the same command object
every time ? Do you check the return value when you invoke the command, like
in:

if ( !parseFile.ready() )
   cerr << "Warning, command not ready: may fail to send !"<<endl;
bool ok = parseFile(QString("thefile"));
if (!ok)
   cerr << "Failed to send command, retry next time !" <<endl;

In case the return value is already false, your command was never sent. If you
want to 'queue up' commands, you need to use multiple Command<bool(QString>
objects.

Peter

Command trouble after update to 1.8.1

Peter Soetens wrote:
> On Wednesday 25 March 2009 16:33:46 SchickJohannes23 [..] ... wrote:
>> Hi everyone,
>>
>> after I updated from 1.6.x to 1.8.1 the Command Interface doesn't work well
>> anymore.
>>
>> After updating I built the whole Project new but sometimes the Command
>> methode get called and sometimes not for no apparent reason.
>>
>> Here is the code:
>>
>> With this code I try to call the other task's command:
>> Command<bool(QString)> parseFile;
>> parseFile =
>> this->getPeer("Planung")->commands()->getCommand<bool(QString)>("pre_parseF
>> ile"); parseFile(fname);
>
> I'm just thinking of something... are you re-using the same command object
> every time ? Do you check the return value when you invoke the command, like
> in:
>
>

> if ( !parseFile.ready() )
>    cerr << "Warning, command not ready: may fail to send !"<<endl;
> bool ok = parseFile(QString("thefile"));
> if (!ok)
>    cerr << "Failed to send command, retry next time !" <<endl;
> 

>
> In case the return value is already false, your command was never sent. If you
> want to 'queue up' commands, you need to use multiple Command<bool(QString>
> objects.
>
> Peter

No this command object is really only used once in the whole programm -
but good to know!

Command trouble after update to 1.8.1

On Wednesday 25 March 2009 23:35:01 Johannes Schick wrote:
> Peter Soetens wrote:
> > On Wednesday 25 March 2009 16:33:46 SchickJohannes23 [..] ... wrote:
> >> Hi everyone,
> >>
> >> after I updated from 1.6.x to 1.8.1 the Command Interface doesn't work
> >> well anymore.
> >>
> >> After updating I built the whole Project new but sometimes the Command
> >> methode get called and sometimes not for no apparent reason.
> >>
> >> Here is the code:
> >>
> >> With this code I try to call the other task's command:
> >> Command<bool(QString)> parseFile;
> >> parseFile =
> >> this->getPeer("Planung")->commands()->getCommand<bool(QString)>("pre_par
> >>seF ile"); parseFile(fname);
> >
> > I'm just thinking of something... are you re-using the same command
> > object every time ? Do you check the return value when you invoke the
> > command, like in:
> >
> >

> > if ( !parseFile.ready() )
> >    cerr << "Warning, command not ready: may fail to send !"<<endl;
> > bool ok = parseFile(QString("thefile"));
> > if (!ok)
> >    cerr << "Failed to send command, retry next time !" <<endl;
> > 

> >
> > In case the return value is already false, your command was never sent.
> > If you want to 'queue up' commands, you need to use multiple
> > Command<bool(QString> objects.
> >
> > Peter
>
> No this command object is really only used once in the whole programm -
> but good to know!

Then there's only one way to fix this, and that's trying to reproduce it. For
all clarity: this doesn't happen in 1.6, does it ?

If you could provide sample code, that would be easiest. Otherwise, could you
specify your OROCOS_TARGET (gnulinux ?) and the priorities/schedulers of both
component activities ? I assume you're running on a dual core ?

Create a new bug report on https://www.fmtc.be/bugzilla/orocos to store the
above information such that we can track it.

Thanks for reporting,
Peter

Re: Command trouble after update to 1.8.1

Okay, finally i got time to answer your questions.

First: I tried the new Version 1.8.2 - same thing but it seams slightly better - could be coincidence....

yep OROCOS_TARGET is gnulinux.

Sample code is here:
http://studwww.ira.uka.de/~s_jschic/orocos_test.zip

CPU is
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
stepping : 9

with dual core - but same thing happens on a single processor unit.

Interesting thing I executed the same binary with 1.6 (well i recompiled it of curse) and sometimes the command didn't get called like in 1.8.*. So maybe I've done something wrong...

To change between versions I simply rename the hole orocos directory /opt/orocos (with bin,include, lib, share in it) , move the other verison to /opt/orocos and execute ldconfig. Something wrong about that?!

Well thanks in advanced!

Johannes

sspr wrote:

On Wednesday 25 March 2009 23:35:01 Johannes Schick wrote:
> Peter Soetens wrote:
> > On Wednesday 25 March 2009 16:33:46 SchickJohannes23 [..] ... wrote:
> >> Hi everyone,
> >>
> >> after I updated from 1.6.x to 1.8.1 the Command Interface doesn't work
> >> well anymore.
> >>
> >> After updating I built the whole Project new but sometimes the Command
> >> methode get called and sometimes not for no apparent reason.
> >>
> >> Here is the code:
> >>
> >> With this code I try to call the other task's command:
> >> Command parseFile;
> >> parseFile =
> >> this->getPeer("Planung")->commands()->getCommand("pre_par
> >>seF ile"); parseFile(fname);
> >
> > I'm just thinking of something... are you re-using the same command
> > object every time ? Do you check the return value when you invoke the
> > command, like in:
> >
> >
> > if ( !parseFile.ready() )
> > cerr << "Warning, command not ready: may fail to send !"< > > bool ok = parseFile(QString("thefile"));
> > if (!ok)
> > cerr << "Failed to send command, retry next time !" < > >

> >
> > In case the return value is already false, your command was never sent.
> > If you want to 'queue up' commands, you need to use multiple
> > Command objects.
> >
> > Peter
>
> No this command object is really only used once in the whole programm -
> but good to know!

Then there's only one way to fix this, and that's trying to reproduce it. For
all clarity: this doesn't happen in 1.6, does it ?

If you could provide sample code, that would be easiest. Otherwise, could you
specify your OROCOS_TARGET (gnulinux ?) and the priorities/schedulers of both
component activities ? I assume you're running on a dual core ?

Create a new bug report on https://www.fmtc.be/bugzilla/orocos to store the
above information such that we can track it.

Thanks for reporting,
Peter

Command trouble after update to 1.8.1

On Wednesday 25 March 2009 16:33:46 SchickJohannes23 [..] ... wrote:
> Hi everyone,
>
> after I updated from 1.6.x to 1.8.1 the Command Interface doesn't work well
> anymore.

Thanks for testing 1.8. All our unit tests passed, so it could be that your
application relied on 'implicitly present' behaviour, which got corrected now.

>
> After updating I built the whole Project new but sometimes the Command
> methode get called and sometimes not for no apparent reason.

The only change to commands is that the CommandProcessor processes all
commands in the queue at once in a single step, instead of one command each
step.
- Is the activity of your component periodic or non periodic ?
- If non-periodic, could you call its 'trigger()' function and see if that
processes the not executed commands ?
- Does it work reliably if you don't attach any activity (then the default
SequentialActivity is used).
- Could it be that your function (updateHook() ?) which calls the command is
called less times instead ? I mean, are you sure it is sent in the first place?

Answering these questions could lead us to a solution...

Peter

Re: Command trouble after update to 1.8.1

sspr wrote:

On Wednesday 25 March 2009 16:33:46 SchickJohannes23 [..] ... wrote:
> Hi everyone,
>
> after I updated from 1.6.x to 1.8.1 the Command Interface doesn't work well
> anymore.

Thanks for testing 1.8. All our unit tests passed, so it could be that your
application relied on 'implicitly present' behaviour, which got corrected now.
>
> After updating I built the whole Project new but sometimes the Command
> methode get called and sometimes not for no apparent reason.

The only change to commands is that the CommandProcessor processes all
commands in the queue at once in a single step, instead of one command each
step.
- Is the activity of your component periodic or non periodic ?
- If non-periodic, could you call its 'trigger()' function and see if that
processes the not executed commands ?
- Does it work reliably if you don't attach any activity (then the default
SequentialActivity is used).
- Could it be that your function (updateHook() ?) which calls the command is
called less times instead ? I mean, are you sure it is sent in the first place?

Answering these questions could lead us to a solution...

Peter

Thanks for reply!

1. The caller Task is peridoic the called Task (Planung) is nonperiodic.

2. the updateHook of the non periodic Task is called three times: first after the task is started, second after the command is called and the third time right after the command call (because i used the tigger() function right after i called the commmand (for testing only))

3. Sorry -but what do you mean by "attach any activity" ?!

4. In my opinion the updateHook is always called at the correct time. But the "Planung::pre_parseFile()" is only called sometimes - it seams randomly... maybe a timing problem...

greetings
Johannes

Command trouble after update to 1.8.1

On Wednesday 25 March 2009 21:36:23 SchickJohannes23 [..] ... wrote:
>

sspr wrote:
On Wednesday 25 March 2009 16:33:46 SchickJohannes23 [..] ...
wrote:
> > Hi everyone,
> >
> > after I updated from 1.6.x to 1.8.1 the Command Interface doesn't work
> > well anymore.
>
> Thanks for testing 1.8. All our unit tests passed, so it could be that your
> application relied on 'implicitly present' behaviour, which got corrected
> now.
>
> > After updating I built the whole Project new but sometimes the Command
> > methode get called and sometimes not for no apparent reason.
>
> The only change to commands is that the CommandProcessor processes all
> commands in the queue at once in a single step, instead of one command each
> step.
> - Is the activity of your component periodic or non periodic ?
> - If non-periodic, could you call its 'trigger()' function and see if that
> processes the not executed commands ?
> - Does it work reliably if you don't attach any activity (then the default
> SequentialActivity is used).
> - Could it be that your function (updateHook() ?) which calls the command
> is called less times instead ? I mean, are you sure it is sent in the first
> place?
>
> Answering these questions could lead us to a solution...
>
> Peter
>
>

>
>
> Thanks for reply!
>
> 1. The caller Task is peridoic the called Task (Planung) is nonperiodic.

ok.

>
> 2. the updateHook of the non periodic Task is called three times: first
> after the task is started, second after the command is called and the third
> time right after the command call (because i used the tigger() function
> right after i called the commmand (for testing only))

ok. So that didn't fix it.

>
> 3. Sorry -but what do you mean by "attach any activity" ?!

do this for your Planung object:

planung.setActivity( 0 ); // removes non periodic and puts sequential in place

If you use the deployment component, just don't specify an activity struct.

>
> 4. In my opinion the updateHook is always called at the correct time. But
> the "Planung::pre_parseFile()" is only called sometimes - it seams
> randomly... maybe a timing problem...

In that case, it's a CommandProcessor issue. I'll start digging...

Peter