chore: add extra function description
This commit is contained in:
@@ -23,6 +23,9 @@ class RICommandAgent(Agent):
|
|||||||
|
|
||||||
class SendCommandsBehaviour(CyclicBehaviour):
|
class SendCommandsBehaviour(CyclicBehaviour):
|
||||||
async def run(self):
|
async def run(self):
|
||||||
|
"""
|
||||||
|
Run the command publishing loop indefinetely.
|
||||||
|
"""
|
||||||
assert self.agent is not None
|
assert self.agent is not None
|
||||||
# Get a message internally (with topic command)
|
# Get a message internally (with topic command)
|
||||||
topic, body = await self.agent.subsocket.recv_multipart()
|
topic, body = await self.agent.subsocket.recv_multipart()
|
||||||
@@ -39,6 +42,9 @@ class RICommandAgent(Agent):
|
|||||||
logger.error("Error processing message: %s", e)
|
logger.error("Error processing message: %s", e)
|
||||||
|
|
||||||
async def setup(self):
|
async def setup(self):
|
||||||
|
"""
|
||||||
|
Setup the command agent
|
||||||
|
"""
|
||||||
logger.info("Setting up %s", self.jid)
|
logger.info("Setting up %s", self.jid)
|
||||||
|
|
||||||
# To the robot
|
# To the robot
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ class RICommunicationAgent(Agent):
|
|||||||
|
|
||||||
class ListenBehaviour(CyclicBehaviour):
|
class ListenBehaviour(CyclicBehaviour):
|
||||||
async def run(self):
|
async def run(self):
|
||||||
|
"""
|
||||||
|
Run the listening (ping) loop indefinetely.
|
||||||
|
"""
|
||||||
assert self.agent is not None
|
assert self.agent is not None
|
||||||
|
|
||||||
# We need to listen and sent pings.
|
# We need to listen and sent pings.
|
||||||
@@ -56,6 +59,9 @@ class RICommunicationAgent(Agent):
|
|||||||
|
|
||||||
|
|
||||||
async def setup(self, max_retries: int = 5):
|
async def setup(self, max_retries: int = 5):
|
||||||
|
"""
|
||||||
|
Try to setup the communication agent, we have 5 retries in case we dont have a response yet.
|
||||||
|
"""
|
||||||
logger.info("Setting up %s", self.jid)
|
logger.info("Setting up %s", self.jid)
|
||||||
retries = 0
|
retries = 0
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ async def lifespan(app: FastAPI):
|
|||||||
logger.info("Internal publishing socket bound to %s", internal_comm_socket)
|
logger.info("Internal publishing socket bound to %s", internal_comm_socket)
|
||||||
|
|
||||||
# Initiate agents
|
# Initiate agents
|
||||||
logger.info(settings.agent_settings.ri_communication_agent_name + '@' + settings.agent_settings.host)
|
|
||||||
logger.info(settings.agent_settings.ri_communication_agent_name)
|
|
||||||
ri_communication_agent = RICommunicationAgent(settings.agent_settings.ri_communication_agent_name + '@' + settings.agent_settings.host,
|
ri_communication_agent = RICommunicationAgent(settings.agent_settings.ri_communication_agent_name + '@' + settings.agent_settings.host,
|
||||||
settings.agent_settings.ri_communication_agent_name,
|
settings.agent_settings.ri_communication_agent_name,
|
||||||
address="tcp://*:5555", bind=True)
|
address="tcp://*:5555", bind=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user