activate possible in *.ops file ?

When I want to do an activate of a state machine in an .ops file, the program stops executing (when I exectute the .start() command). When I look at the error state of this program (inError), he returns true. However the state machine I want to activate is very trivial and I have loaded the .osd file of the state machine before.
This is my code :
* .ops file
program EtuRun16
{
var int i = 1
var double j = 2.0
do HMI.log("Info","loaded done");
do scripting.loadStateMachines("../tests/OperationEtuControl2.osd");

do HMI.log("Info","activated done");
do iOperationEtuControl6.activate();

do HMI.log("Info","machine has started up");

do HMI.log("Info", "operational etu");
}
* .osd file
StateMachine OperationEtuControl6
{

initial state Init
{
entry
{

}

}

final state FAIL
{
entry {
}
}
}

RootMachine OperationEtuControl6 iOperationEtuControl6
What can be the reason of this ?

activate possible in *.ops file ?

On Wednesday 20 August 2008 12:03:02 sspr [..] ... wrote:
> When I want to do an activate of a state machine in an .ops file, the
> program stops executing (when I exectute the .start() command). When I
> look at the error state of this program (inError), he returns true.

Possible reasons for a statemachine not wanting to activate is that its
TaskContext is not running.

In RTT 1.4.x, there is also a bug that when you misspell the command, the
activate() is executed on the TaskContext itself and not on the sm.

>
> However the state machine I want to activate is very trivial and I have
> loaded the .osd file of the state machine before. This is my code :
> * .ops file
> program EtuRun16
> {
> var int i = 1
> var double j = 2.0
> do HMI.log("Info","loaded done");
> do scripting.loadStateMachines("../tests/OperationEtuControl2.osd");
>
> do HMI.log("Info","activated done");
> do iOperationEtuControl6.activate();

What happens if you do the same command from the TaskBrowser's commandline ?

Peter

activate possible in *.ops file ?

When I execute the command in the task context, I have no problems. I can do an activate of iOperationEtuControl6, when I press enter, I see this command is done (Status of last Command : done) and I am able to start iOperationEtuControl6. When afterwards I do iOperatioinEtuControl6.inError(), I get false.
In other words, when I do manually all the steps in the .ops file I have no problems, whereas if I execute the whole .ops file by using the loadPrograms and then afterwards EtuRun16.start(), I have problems.

Stefaan

activate possible in

On Wednesday 20 August 2008 14:44:54 sspr [..] ... wrote: > When I execute the command in the task context, I have no problems. I can > do an activate of iOperationEtuControl6, when I press enter, I see this > command is done (Status of last Command : done) and I am able to start > iOperationEtuControl6. When afterwards I do > iOperatioinEtuControl6.inError(), I get false. In other words, when I do > manually all the steps in the .ops file I have no problems, whereas if I > execute the whole .ops file by using the loadPrograms and then afterwards > EtuRun16.start(), I have problems.

This is exactly the bug I was mentioning. Since you only load the state machine in the program script itself, it does not exist when the program is parsed. So iOperationEtuControl6.activate() was translated to this.activate(), which returns false because the taskcontext is already active. I'm sorry for not releasing yet the fixed version... I'll try to release Debian packages this friday.

Your work around is to load the statemachine before you load your program. Then it will work.

Peter