Controllers
This module defines the controller used by the agent to interact with its environment.
Thrust1dController (BaseController)
¤
A controller to apply thrust along a single axis.
Parameters¤
parent_platform : Docking1dPlatform the platform to which the controller belongs config : dict contains configuration proprties control_properties : corl.libraries.property.BoxProp a class to define the acceptable bounds and units of the controller's control
Source code in corl/simulators/docking_1d/controllers.py
class Thrust1dController(BaseController):
"""
A controller to apply thrust along a single axis.
Parameters
----------
parent_platform : Docking1dPlatform
the platform to which the controller belongs
config : dict
contains configuration proprties
control_properties : corl.libraries.property.BoxProp
a class to define the acceptable bounds and units of the controller's control
"""
def __init__(
self,
parent_platform,
config,
control_properties=ThrustProp,
): # pylint: disable=W0102
self.config: Thrust1dControllerValidator # noqa # pylint: disable=undefined-variable
super().__init__(property_class=control_properties, parent_platform=parent_platform, config=config)
@property
def name(self):
"""
Returns
-------
String
name of the controller
"""
return self.config.name
def apply_control(self, control: np.ndarray) -> None:
"""
Applies control to the parent platform
Parameters
----------
control
ndarray describing the control to the platform
"""
self.parent_platform.save_action_to_platform(action=control)
def get_applied_control(self) -> np.ndarray:
"""
Retreive the applied control to the parent platform
Returns
-------
np.ndarray
Previously applied action
"""
return self.parent_platform.get_applied_action()
apply_control(self, control)
¤
Applies control to the parent platform
Parameters¤
control ndarray describing the control to the platform
Source code in corl/simulators/docking_1d/controllers.py
def apply_control(self, control: np.ndarray) -> None:
"""
Applies control to the parent platform
Parameters
----------
control
ndarray describing the control to the platform
"""
self.parent_platform.save_action_to_platform(action=control)
get_applied_control(self)
¤
Retreive the applied control to the parent platform
Returns¤
np.ndarray Previously applied action
Source code in corl/simulators/docking_1d/controllers.py
def get_applied_control(self) -> np.ndarray:
"""
Retreive the applied control to the parent platform
Returns
-------
np.ndarray
Previously applied action
"""
return self.parent_platform.get_applied_action()