helyos_agent_sdk.connector module

helyos_agent_sdk.connector.parse_assignment_message(self, ch, properties, received_str)

Parse the assignment message and call the callback function. :param ch: RabbitMQ channel :type ch: Channel :param properties: RabbitMQ properties :type properties: BasicProperties :param received_str: Received message :type received_str: string

helyos_agent_sdk.connector.parse_instant_actions(self, ch, properties, received_str)

Parse the instant action messages and call the callback function. :param ch: RabbitMQ channel :type ch: Channel :param properties: RabbitMQ properties :type properties: BasicProperties :param received_str: Received message :type received_str: string

class helyos_agent_sdk.connector.AgentConnector(helyos_client, pose=None, encrypted=False)

Bases: object

agent_status = 'free'
agent_resources = None
current_assignment = None
property agent_idle_status
__init__(helyos_client, pose=None, encrypted=False)

Agent Connector class

Usage: helyos_client = HelyOSClient(‘rabbitmq.host.com’, 5432, uuid=’123-456’) helyos_client.perform_checkin() agentConnector = AgentConnector(helyos_client)

The Agent Connector class provides functionality for consuming and publishing messages in the helyOS framework. It ensures proper data formatting compatible with helyOS.

Parameters
  • helyos_client (HelyOSClient) – Instance of HelyOS Client. The instance should be “checked in”.

  • pose (Pose) – (Optional) save the initial agent position in AgentConnector.agent_pose. This may be useful in callback methods.

  • encrypted (bool) – Set if the published messages should be encrypted, defaults to False.

agent_pose: Pose = Pose(x=0, y=0, z=0, orientations=[0])
assignment_callback(ch, sender, received_msg)
cancel_callback(ch, sender, received_msg)
reserve_callback(ch, sender, received_msg)
release_callback(ch, sender, received_msg)
other_instant_actions_callback(ch, sender, received_msg)
other_assignment_callback(ch, sender, received_msg)
consume_instant_action_messages(reserve_callback=None, release_callback=None, cancel_callback=None, other_callback=None)

Register the callback functions for instant actions

Parameters
  • reserve_callback (func) – reserve_callback(ch:Channel , sender: string, message: WorkProcessResourcesRequest)

  • release_callback (func) – release_callback(ch, sender, message: WorkProcessResourcesRequest)

  • cancel_callback (func(ch, sender, message: AssignmentCancelMessage)) – cancel_callback

  • other_callback (func(ch: Channel, sender:string, message: string)) – Non-helyOS related instant action

consume_assignment_messages(assignment_callback=None, other_callback=None)

Register the callback functions for assignments or order (VDA5050)

Parameters
  • reserve_callback (func) – assignment_callback(ch, method, properties, received_str)

  • other_callback (func(ch, method, properties, received_str)) – Non-helyOS related instant action

start_listening()
stop_listening()
publish_general_updates(body={}, signed=False)

Updates agent properties of agent: name, code, factsheet, x, y etc. This is published in a high-priority queue; the message will not expire until helyOS consume it. Therefore, it is recommended to refrain from using this method at high frequencies. RabbitMQ clients can access this information by use the routing key = ‘agent.{uuid}.update’.

Parameters
  • body (dict) – Any property of the agent.

  • signed (boolean) – A boolean indicating whether the published message must be signed (defaults to False)

publish_state(status: AGENT_STATE, resources: Optional[AgentCurrentResources] = None, assignment_status: Optional[AssignmentCurrentStatus] = None, signed=False)

Updates agent and the work processes status. For a good design, this method should be triggered by events. This is published in a high-priority queue; the message will not expire until helyOS consume it. Therefore, it is recommended to refrain from using this method at high frequencies. RabbitMQ clients can access this information by using the routing key = ‘agent.{uuid}.state’.

Parameters
  • status (string | AGENT_STATE) – Agent status.

  • resources (AgentCurrentResources) – Agent availability information.

  • assignment_status (AssignmentCurrentStatus) – Information about the current (or last) assignment.

  • signed (boolean) – A boolean indicating whether the published message must be signed (defaults to False)

publish_sensors(x, y, z, orientations, sensors={}, signed=False)

Publishes agent position and sensors. The sensor data format is freely defined by the developer. This method should be triggered periodically to ensure a stable helyOS-agent connection. The published information is placed in a low-priority queue and may expire under high load conditions. For high-priority updates, use the method publish_general_updates(). RabbitMQ clients can access this information using the routing key ‘agent.{uuid}.visualization’.

Parameters
  • x (float) – Agent x position

  • y (float) – Agent y position

  • orientations (float list) – Agent and trailer orientations

  • sensors (dict) – Agent sensor, user defined (defaults to {}).

  • signed (boolean) – A boolean indicating whether the published message must be signed (defaults to False)

request_mission(mission_name, data, tools_uuids=[], signed=False)

Request a mission to helyOS. The mission data is freely defined by the application. As example, this method could be triggered in the scenario where the agent needs an extra assignments to complete a mission, or when it delegates an assignment to other agents. RabbitMQ clients can tap this information by using the routing key = ‘agent.{uuid}.mission’.

Parameters
  • mission_name (name) – requested mission, as defined in helyOS dashboard.

  • data (dict) – User-defined data

  • tools_uuids (string list) – UUID list of agents to be reserved for the mission.

  • signed (boolean) – A boolean indicating whether the published message must be signed (defaults to False)