pyrcf.components.agents.agent_base

Classes

AgentBase

An agent is an entity that observes the state of the robot and responds with a control

DummyAgent

Dummy Agent for testing pipeline.

Module Contents

class pyrcf.components.agents.agent_base.AgentBase

Bases: pyrcf.components.pyrcf_component.PyRCFComponent

An agent is an entity that observes the state of the robot and responds with a control action.

With this in mind, an agent for classical control cases would be an entity that combines the functions of a ‘local planner’ and ‘controller’ into a single entity called ‘Agent’, which observes the state of the robot interface and responds by sending commands to the robot, so as to follow the objective of following the ‘global plan’ from the global planner.

abstract get_action(robot_state: pyrcf.core.types.RobotState, global_plan: pyrcf.core.types.GlobalMotionPlan, t: float, dt: float) pyrcf.core.types.RobotCmd

Compute the control command to be executed given the current state and the global plan.

Parameters:
  • robot_state (RobotState) – Current robot state. This is equivalent to ‘observation’ in standard learning-based agents.

  • global_plan (GlobalMotionPlan) – The reference global plan to follow.

  • t (float, optional) – the current time signature of the control loop. Defaults to None (controllers may or may not need this).

  • dt (float, optional) – the time since the last control loop. Defaults to None (controllers may or may not need this).

Returns:

The output control command (action) to be sent to the robot.

Return type:

RobotCmd

Raises:

NotImplementedError – Raised if this method is not implemented by the child class.

abstract get_last_output() Tuple[pyrcf.core.types.LocalMotionPlan, pyrcf.core.types.RobotCmd]

Should return the last computed outputs by this agent.

Returns:

Output local plan and control command from this agent.

NOTE: Either of these can be None, if the agent does not compute them.

Return type:

Tuple[LocalMotionPlan, RobotCmd]

class pyrcf.components.agents.agent_base.DummyAgent(squawk: bool = True)

Bases: AgentBase

Dummy Agent for testing pipeline.

_squawk
get_action(robot_state: pyrcf.core.types.RobotState, global_plan: pyrcf.core.types.GlobalMotionPlan, t: float, dt: float) pyrcf.core.types.RobotCmd

This is a dummy method for sanity checking the control loop.

get_last_output() Tuple[pyrcf.core.types.LocalMotionPlan | pyrcf.core.types.RobotCmd]

Should return the last computed outputs by this agent.

Returns:

Output local plan and control command from this agent.

NOTE: Either of these can be None, if the agent does not compute them.

Return type:

Tuple[LocalMotionPlan, RobotCmd]