RE: [robocup-rescue-s] YAB API and Agent Properties

From: Baris Eker (baris.eker@cs.com.tr)
Date: Thu 31 Mar 2005 - 07:37:27 GMT


Hello,

I think the example code below gives you an idea about how to do this.

List hmns = POSITION_PRP.eq(mlpos()).extract(world.humanoids);
hmns.remove(self());
logger.writeLog(self().id, "Civilian count at current pos="+hmns.size());
if (!hmns.isEmpty()){
        List brdList = BURIEDNESS_PRP.gt(0).extract(hmns);
        for (int index = 0; index < buriedCount; index++){
                Humanoid hmn = (Humanoid)brdList.get(index);
                System.out.println("Human " + hmn.id + " hp = " + hmn.hp() + " buriednes =
" + hmn.buriedness());
        }
}

If you know the id of the humanoid that you want to query, then you can
use this:

Humanoid target = (Humanoid)world.get(targetId);

However, in that you case, you should have seen the humanoid before,
in order to reach its properties. Otherwise, (I'm not sure about the values)
you may get 0.

Also, you can reach your own agent's hp and buriedness values via
self().hp() or self().buriedness().

Best regards,

Baris Eker
RoboAKUT

-----Original Message-----
From: robocup-rescue-s-bounces@cc.gatech.edu
[mailto:robocup-rescue-s-bounces@cc.gatech.edu]On Behalf Of Barsanti L
Sent: Thursday, March 31, 2005 1:48 AM
To: robocup-rescue-s@cc.gatech.edu
Subject: [robocup-rescue-s] YAB API and Agent Properties

Hello all,
I am using the YAB API to develop an agent, but I am having
a little trouble working with agent properties. I would
like to extract a specific civilians buriedness and hp, but
I can not figure out how. I looked through the code and it
looks like agents store this type of information as a
Property. I know the Condition and Property objects can be
used to get all civilians with hp < x, but how can they be
used to get value of a property for a specific agent?
Any information would be appreciated.

Thanks

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

_______________________________________________
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 31 Mar 2005 - 08:06:56 GMT