Commit 91f19ae7 by serfrape

Remove the .goto action

parent 2c239fc4
...@@ -22,6 +22,7 @@ class BDIAgent(Agent): ...@@ -22,6 +22,7 @@ class BDIAgent(Agent):
async def setup(self): async def setup(self):
template = Template(metadata={"performative": "BDI"}) template = Template(metadata={"performative": "BDI"})
self.add_behaviour(self.BDIBehaviour(), template) self.add_behaviour(self.BDIBehaviour(), template)
super().setup()
def add_behaviour(self, behaviour, template=None): def add_behaviour(self, behaviour, template=None):
if type(behaviour) == self.BDIBehaviour: if type(behaviour) == self.BDIBehaviour:
...@@ -65,19 +66,6 @@ class BDIAgent(Agent): ...@@ -65,19 +66,6 @@ class BDIAgent(Agent):
msg = Message(to=receiver, body=body, metadata=mdata) msg = Message(to=receiver, body=body, metadata=mdata)
self.agent.submit(self.send(msg)) self.agent.submit(self.send(msg))
yield yield
#
@self.agent.bdi_actions.add(".goto", 3)
def _goto(agent, term, intention):
"""Sets the PyGomas destination. Expects args to be x,y,z"""
args = pyson.grounded(term.args, intention.scope)
absx = abs(args[0] - self.agent.movement.position.x)
absz = abs(args[2] - self.agent.movement.position.z)
if (absx < PRECISION_X) and (absz < PRECISION_Z):
self.agent.movement.position.x = args[0]
self.agent.movement.position.z = args[2]
yield
@self.agent.bdi_actions.add(".custom_action", 1) @self.agent.bdi_actions.add(".custom_action", 1)
def _custom_action(agent, term, intention): def _custom_action(agent, term, intention):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment