[robocup-rescue-s] Re: Help about communication process programming

From: Arash Rahimi (rahimi@ce.aut.ac.ir)
Date: Thu 07 Jul 2005 - 04:57:07 GMT


Dear Carla,

in class 'CenterAgent' inherited from 'Agent' the
'act' method is implemented to send 'rest' action.
But of course, you can override it in your
'FireStation' class and put your code in there.

there's also another solution:

you can add a new method - let's call it 'hearDecide' -
to class 'Agent' like this:

protected abstract void hearDecide();

and modify the method 'run' of class 'Agent' as
follows:

   .
   .
   .
if (data instanceof KaSense) {
// add this line here:
   hearDecide();
   KaSense sense = (KaSense) data;
   .
   .
   .

Now as you see, when we receive a 'KA_SENSE'
packet, we are sure that the new cycle is
beginning and as a result we have received
all the messages we should have heard. So,
we call 'hearDecide' to notify the decision
layer about this event. If you implement
'hearDecide', you can use it instead of 'act'
for this purpose.

Regards,
Arash Rahimi,
Member of S.O.S.

> Dear all,
>
> Thanks for your response Arash and Mohammed!
>
> Arash, I understand what you tell me. However, I guess, center agents dont
> implement 'act()' method (?), Is it true?
>
> What do you think?, I need know whether this is the last message
> fireStation
> agent is receiving or not from fireBrigades. I Just am implementing 'hear'
> method in My FireStation agent.
>
> Thanks a lot,
>
> Carla.
>
>>From: "Arash Rahimi" <rahimi@ce.aut.ac.ir>
>>Reply-To: rahimi@ce.aut.ac.ir
>>To: "Carla Quintero" <c_quintero_rocas@hotmail.com>
>>CC: robocup-rescue-s@cc.gatech.edu
>>Subject: Re: Help about communication process programming
>>Date: Wed, 6 Jul 2005 14:23:04 +0430 (IRDT)
>>
>>Dear Carla,
>>
>> The current message-processing scheme in YabAPI is
>>provided to the agent-developers by calling a method
>>named 'hear' when a message is received. The developer
>>can implement this abstract method and put the desired
>>code in it in order to decide if it should be processed
>>and processing it if so. There, the problem is that
>>you don't know whether this is the last message your
>>agent is receiving or not. The other problem is that
>>you have a local view in order to decide whether to
>>read this message or not.
>>
>> Now, the question is how to solve this problem. As
>>the simplest solution, you can save the sender and
>>the content of the message your agent receives in a
>>buffer and then in the 'act' method of the next cycle
>>you can start choosing the messages to read and then
>>process the messages you have chosen. This can be
>>done more systematically by slightly modifying YabAPI
>>in order to do these tasks automatically and provide
>>you with a method to choose the message you have
>>received and then sends the chosen messages to another
>>method in order to be processed.
>>
>>Regards,
>>Arash Rahimi,
>>Member of S.O.S.
>>
>> >
>> > Dear all,
>> >
>> > I am sending messages from the fireBrigade agents to the fireStation
>>each
>> > cycle. I Just am sending 1 message for each fireBrigade each cycle to
>> > fireStation. My question is: For example, If I have 10 fireBrigades
>> and
>>1
>> > fire Station, and it is cycle 60 of simulation, Is it possible
>>firestation
>> > knows if all the 10 fireBrigades have sent his message at cycle 60?.
>> The
>> > reason is that I want one method begins in fireStation agent just when
>>it
>> > has received all the messages from available fireBrigades in some
>> cycle
>> > (It
>> > could be less than 10 messages). I mean, in some cycle it is possible
>> > fireStation does not receive some message from some fireBrigade. I'm
>>not
>> > sure that firestation will receive exactly 10 messages, firestation
>>could
>> > receive just 9 or 8 messages in some cycle for example.
>> >
>> > I'm using Yabapi for programming agents.
>> >
>> > Thanks a lot in advance.
>> >
>> > _________________________________________________________________
>> > MSN Amor: busca tu ½ naranja http://latam.msn.com/amor/
>> >
>> >
>>
>
> _________________________________________________________________
> MSN Amor: busca tu ½ naranja http://latam.msn.com/amor/
>
>

_______________________________________________
robocup-rescue-s mailing list
robocup-rescue-s@mailman.cc.gatech.edu
https://mailman.cc.gatech.edu/mailman/listinfo/robocup-rescue-s



This archive was generated by hypermail 2.1.3 : Thu 07 Jul 2005 - 05:28:13 GMT