pyrcf.components.agents.agent_base ================================== .. py:module:: pyrcf.components.agents.agent_base Classes ------- .. autoapisummary:: pyrcf.components.agents.agent_base.AgentBase pyrcf.components.agents.agent_base.DummyAgent Module Contents --------------- .. py:class:: AgentBase Bases: :py:obj:`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. .. py:method:: get_action(robot_state: pyrcf.core.types.RobotState, global_plan: pyrcf.core.types.GlobalMotionPlan, t: float, dt: float) -> pyrcf.core.types.RobotCmd :abstractmethod: Compute the control command to be executed given the current state and the global plan. :param robot_state: Current robot state. This is equivalent to 'observation' in standard learning-based agents. :type robot_state: RobotState :param global_plan: The reference global plan to follow. :type global_plan: GlobalMotionPlan :param t: the current time signature of the control loop. Defaults to None (controllers may or may not need this). :type t: float, optional :param dt: the time since the last control loop. Defaults to None (controllers may or may not need this). :type dt: float, optional :returns: The output control command (action) to be sent to the robot. :rtype: RobotCmd :raises NotImplementedError: Raised if this method is not implemented by the child class. .. py:method:: get_last_output() -> Tuple[pyrcf.core.types.LocalMotionPlan, pyrcf.core.types.RobotCmd] :abstractmethod: 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. :rtype: Tuple[LocalMotionPlan, RobotCmd] .. py:class:: DummyAgent(squawk: bool = True) Bases: :py:obj:`AgentBase` Dummy Agent for testing pipeline. .. py:attribute:: _squawk :value: True .. py:method:: 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. .. py:method:: 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. :rtype: Tuple[LocalMotionPlan, RobotCmd]