Re: [robocup-rescue-s] need help

From: rahimi@ce.aut.ac.ir
Date: Thu 17 Feb 2005 - 13:10:44 GMT


Dear Ray,

The problem is not with the result of 'getAgentByID'
as it is checked and cannot be null. But its method
'motionlessPosition()' may return a null object as
you may hear a civilian whose position is not known
to you(note that range of hearing is 30m but range
of perception is 10m).

Sincerely Yours,
Arash Rahimi

--
S.O.S. Member

> Dear Researchers, > > I am working on defining behavior of a custom RCR > agent within YabAPI framework. I got the following > output when hear() function was called: > > OUTPUT > ======== > > Action:HC224316744 hear() :(264179229) say :help_me > Action:HC242920931 hear() :(264179229) say :help_me > Action:HC266726397 hear() :(264179229) say :help_me > Action:HC99154190 hear() :(264179229) say :help_me > Action:HC116720810 hear() :(150429587) say :help_me > Action:HC180331927 hear() :(150429587) say :help_me > Action:HC223417615 hear() :(150429587) say :help_me > Action:HC230085738 hear() :(150429587) say :help_me > java.lang.NullPointerException > at > yab.agent.object.MovingObject.motionlessPosition(MovingObject.java:29) > at > sample.HelperCivilianAgent.hear(HelperCivilianAgent.java:143) > at yab.agent.Agent.hearSay(Agent.java:37) > at yab.agent.Agent.run(Agent.java:74) > Action:HC65981308 hear() :(150429587) say :help_me > java.lang.NullPointerException > at > yab.agent.object.MovingObject.motionlessPosition(MovingObject.java:29) > at > sample.HelperCivilianAgent.hear(HelperCivilianAgent.java:143) > at yab.agent.Agent.hearSay(Agent.java:37) > at yab.agent.Agent.run(Agent.java:74) > Action:HC56383441 hear() :(150429587) say :help_me > java.lang.NullPointerException > at > yab.agent.object.MovingObject.motionlessPosition(MovingObject.java:29) > at > sample.HelperCivilianAgent.hear(HelperCivilianAgent.java:143) > at yab.agent.Agent.hearSay(Agent.java:37) > at yab.agent.Agent.run(Agent.java:74) > Action:HC266268660 hear() :(264179229) say :help_me > java.lang.NullPointerException > at > yab.agent.object.MovingObject.motionlessPosition(MovingObject.java:29) > at > sample.HelperCivilianAgent.hear(HelperCivilianAgent.java:143) > at yab.agent.Agent.hearSay(Agent.java:37) > at yab.agent.Agent.run(Agent.java:74) > > > > > You will find the function definitions toward the end > of the message. > > The check ascertains that the local DisasterSpace > contains the sender object (pls see getAgentByID() > function). When either sender.motionlessPosition() or > mo.motionlessPosition() was called, I got a > NullPointerException. > > I need to know if those errors are direct cause due to > my custom agent or the errors are intended behavior of > the RCR system. > > Thank you so much for your attention. > > Raymond U > > > > > CODE > ======= > > protected void hear(RealObject sender, String > message) { > // do nothing > if (self().hp() == 0) { > super.hear(sender, message); > return; > } > > System.err.println("Action:HC"+self().id+" hear() > :("+sender.id+") say :"+message); > > if (message.equals("help_me")) { > MovingObject mo = getAgentByID(sender.id); > if (mo != null) > lstPosNeedsHelp.add(mo.motionlessPosition()); > else > System.out.println("Debug hear: the agent is > unknown"); > } > super.hear(sender, message); > } > > > > > protected MovingObject getAgentByID(int id) { > RealObject ro = world.get(id); > if (ro instanceof MovingObject) > return (MovingObject) ro; > else > return null; > } > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > 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 17 Feb 2005 - 13:32:11 GMT