Skip to content

Base wrapper


Air Force Research Laboratory (AFRL) Autonomous Capabilities Team (ACT3) Reinforcement Learning (RL) Core.

This is a US Government Work not subject to copyright protection in the US.

The use, dissemination or disclosure of data in this file is subject to limitation or restriction. See accompanying README and LICENSE for details.


BaseWrapperGlue (BaseAgentGlue) ¤

A base object that glues can inherit in order to "wrap" a single glue instance

Source code in corl/glues/base_wrapper.py
class BaseWrapperGlue(BaseAgentGlue):
    """A base object that glues can inherit in order to "wrap" a single glue instance
    """

    def __init__(self, **kwargs) -> None:
        self.config: BaseWrapperGlueValidator
        super().__init__(**kwargs)

    @property
    def get_validator(self) -> typing.Type[BaseWrapperGlueValidator]:
        return BaseWrapperGlueValidator

    def glue(self) -> BaseAgentGlue:
        """Get the wrapped glue instance
        """
        return self.config.wrapped

    def set_agent_removed(self, agent_removed: bool = True) -> None:
        super().set_agent_removed(agent_removed)
        self.glue().set_agent_removed(agent_removed)

get_validator: Type[corl.glues.base_wrapper.BaseWrapperGlueValidator] property readonly ¤

returns the validator for this class

Returns:

Type Description
Type[corl.glues.base_wrapper.BaseWrapperGlueValidator]

BaseAgentGlueValidator -- A pydantic validator to be used to validate kwargs

glue(self) ¤

Get the wrapped glue instance

Source code in corl/glues/base_wrapper.py
def glue(self) -> BaseAgentGlue:
    """Get the wrapped glue instance
    """
    return self.config.wrapped

set_agent_removed(self, agent_removed=True) ¤

Notify the glue that the agent it is 'attached' to has been removed by the simulation

Source code in corl/glues/base_wrapper.py
def set_agent_removed(self, agent_removed: bool = True) -> None:
    super().set_agent_removed(agent_removed)
    self.glue().set_agent_removed(agent_removed)

BaseWrapperGlueValidator (BaseAgentGlueValidator) pydantic-model ¤

wrapped - the wrapped glue instance

Source code in corl/glues/base_wrapper.py
class BaseWrapperGlueValidator(BaseAgentGlueValidator):
    """
    wrapped - the wrapped glue instance
    """
    wrapped: BaseAgentGlue

    class Config:  # pylint: disable=C0115, R0903
        arbitrary_types_allowed = True