When a command is done?

Hi all,

I started learning OCL/RTT and I wrote my first programs. I noticed that when I invoke a command, the end condition is correctly checked (the TaskManager reports command done) but the Execution engine continues checking it. For example if I have a command C with end condition E, C is correctly executed only once, E reports true (and the TaskManager notices that) but the execution engine invokes again and again E. Moreover, if I try C.done() it reports false.

Is this the expected behavior?

When a command is done?

On Friday 11 April 2008 09:53:45 Lorenzo Riano wrote:
> Is this the expected behavior?

Maybe you did not understand that anyone can create a command object,
and each command object is separate. Thus when you call a command from
the TaskBrowser, it is a different object than the one in your task. Both can
be called seperately from different places, and one can be done() while the
other has never been executed. They all call the same functions (C and E)
though.

When you press 'enter' in the TaskBrowser, it checks if the last command was
done as well (just before it prints 'done'), which may be also a thing you
were seeing.

Peter

I understand that the

I understand that the command is different. But this way, How can a Task know if its command has finished executing? The easy way should be calling this->command.done() from inside the Task. The somewhat harder way is to check directly the condition E.
Moreover, if I write a Task that looks like:

clas MyTask : public TaskContext {
...
command C;

bool exec_C(void)
bool done_C(void)

MyTask() : C("...",exec_C,done_C,this) {...}

bool exec_C(void) {..}
bool done_C(void) {
log()<<"I am alive"< return true
}
};

then I invoke the command C from the Task browser, I will see anytime the "I am alive" string, meaning that the execution engine is still invoking done_C. Is this normal?

I think I solved the

I think I solved the question. Each time I press enter in the TaskBrowser it checks if the last command is done, so it calls the function done_C. This is why I see each time the function being called. Thanks anyway for your help!

When a command is done?

On Friday 11 April 2008 09:53:45 Lorenzo Riano wrote:
> Hi all,
>
> I started learning OCL/RTT and I wrote my first programs. I noticed that
> when I invoke a command, the end condition is correctly checked (the
> TaskManager reports command done) but the Execution engine continues
> checking it. For example if I have a command C with end condition E, C is
> correctly executed only once, E reports true (and the TaskManager notices
> that) but the execution engine invokes again and again E. Moreover, if I
> try C.done() it reports false.
>
> Is this the expected behavior?

No. When the TaskBrowser says 'done', the C.done() function should also
return true. Also, I don't understand why the Execution Engine checks E. It
shouldn't (or are you using an Orocos script ??). E is only called when a
user (or a script) checks for 'done()' on the command C.

Peter