Discussion:
[jade-develop] Send Message
王肖
2013-11-22 07:51:32 UTC
Permalink
Hi All
I want to develop an agent which can cyclic send message to another agent ,the FSMBehaviour is used to make the behaviour cyclic,but the behaviour of send message excutes only once.
wangxiao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20131122/698fd093/attachment.html>
Caire Giovanni
2013-11-25 09:22:53 UTC
Permalink
Hi,

When you have a state in an FSMBehaviour that is visited more than once (as very likely in your case) you have to reset the behavior corresponding to that state before revisiting it. To facilitate this you can use the overloaded version of the registerTransition() method as below

registerTransition(?State1?, ?State2?, ...);
registerTransition (?State2?, ?State3?, ...);
// When the transition below is followed, both State1, State2 and State3 will be revisited --> Include them in the states to be reset
regsiterTransition(?State3?, ?State1?, ..., new String[]{?State1?, ?State2?, ?State3?});

I cannot tell you whether or not this is the reason for the problem you are experiencing, but certainly if you don?t do that, a revisited state will not work properly.

Furthermore you can easily investigate what is happening in an FSMBehaviour by redefining the handleStateEntered(Behaviour state) method of the FSMBehaviour class. This is invoked every time the execution enters in a given state. By printing the name of the state behavior you have a full trace of the visited states.

Bye,

Giovanni

Da: jade-develop-bounces at avalon.tilab.com [mailto:jade-develop-bounces at avalon.tilab.com] Per conto di ??
Inviato: venerd? 22 novembre 2013 08:52
A: jade-develop at avalon.tilab.com
Oggetto: [jade-develop] Send Message

Hi All
I want to develop an agent which can cyclic send message to another agent ,the FSMBehaviour is used to make the behaviour cyclic,but the behaviour of send message excutes only once.
wangxiao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://avalon.cselt.it/pipermail/jade-develop/attachments/20131125/a7415ba4/attachment.html>
Continue reading on narkive:
Loading...