pyrcf.components.agents.ml_agent_base ===================================== .. py:module:: pyrcf.components.agents.ml_agent_base Classes ------- .. autoapisummary:: pyrcf.components.agents.ml_agent_base.MLAgentBase Module Contents --------------- .. py:class:: MLAgentBase Bases: :py:obj:`pyrcf.components.agents.agent_base.AgentBase`, :py:obj:`abc.ABC` An abstract base class machine-learned controller agents. See docstrings for each method to be implemented. .. py:method:: initialise_robot_cmd(joint_states: pyrcf.core.types.JointStates) :abstractmethod: Override this method in child class if custom initilisation is required (e.g. joint name order). By default, this method sets the joint name and position values to be equal to the input joint states object, with kp and kd set to be the default (in constructor). .. py:method:: update_input_to_model(robot_state: pyrcf.core.types.RobotState, global_plan: pyrcf.core.types.GlobalMotionPlan, t: float, dt: float) -> numpy.ndarray :abstractmethod: Should update (`self._input_ndarray`) using appropriate values (input to model). This method has access to `self._latest_ctrl_cmd` (type `RobotCmd`) as well if needed. (NOTE: `self._latest_ctrl_cmd` is set to be the initial robot joint positions (zero velocities and efforts commands) with `default_kp` and `default_kd` at start). .. py:method:: update_cmd_from_model_output(model_output: numpy.ndarray, robot_state: pyrcf.core.types.RobotState, global_plan: pyrcf.core.types.GlobalMotionPlan, t: float, dt: float) -> None :abstractmethod: Should update `self._latest_robot_cmd` (type `RobotCmd`) using the output from the NN model. :param model_output: the numpy array created from the output tensor from the model after the inference query was done. This is the output of the neural network. This method should use this object to update `self._latest_robot_cmd` to be sent to the robot. :type model_output: np.ndarray .. py:method:: get_action(robot_state: pyrcf.core.types.RobotState, global_plan: pyrcf.core.types.GlobalMotionPlan, t: float = None, dt: float = None) -> pyrcf.core.types.RobotCmd :abstractmethod: Should return the control command given the current robot state and global plan. :param robot_state: The current state information from the robot. :type robot_state: RobotState :param global_plan: the latest global plan generated by the global planner used in the loop. :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 to be sent to the robot. :rtype: RobotCmd