Skip to content

Sensory Agent

SensoryAgent

Bases: Agent

Abstract base class for sensory agents.

This class provides a template for creating agents that can sense the environment.

Attributes:

Name Type Description
kwargs dict

Additional arguments to pass to the recorder.

Source code in mbodied/agents/sense/sensory_agent.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class SensoryAgent(Agent):
    """Abstract base class for sensory agents.

    This class provides a template for creating agents that can sense the environment.

    Attributes:
        kwargs (dict): Additional arguments to pass to the recorder.
    """

    def __init__(self, **kwargs):
        """Initialize the agent.

        Args:
            **kwargs: Additional arguments to pass to the recorder.
        """
        super().__init__(**kwargs)

    def act(self, **kwargs) -> SensorReading:
        """Abstract method to define the sensing mechanism of the agent.

        Args:
            **kwargs: Additional arguments to pass to the `sense` method.

        Returns:
            Sample: The sensory sample created by the agent.
        """
        raise NotImplementedError

    def sense(self, **kwargs) -> SensorReading:
        """Generate a SensorReading based on given parameters.

        Args:
            **kwargs: Arbitrary keyword arguments for sensory agent to sense on.

        Returns:
            SensorReading: A SensorReading object based on the provided arguments.
        """
        return self.act(**kwargs)

__init__(**kwargs)

Initialize the agent.

Parameters:

Name Type Description Default
**kwargs

Additional arguments to pass to the recorder.

{}
Source code in mbodied/agents/sense/sensory_agent.py
28
29
30
31
32
33
34
def __init__(self, **kwargs):
    """Initialize the agent.

    Args:
        **kwargs: Additional arguments to pass to the recorder.
    """
    super().__init__(**kwargs)

act(**kwargs)

Abstract method to define the sensing mechanism of the agent.

Parameters:

Name Type Description Default
**kwargs

Additional arguments to pass to the sense method.

{}

Returns:

Name Type Description
Sample SensorReading

The sensory sample created by the agent.

Source code in mbodied/agents/sense/sensory_agent.py
36
37
38
39
40
41
42
43
44
45
def act(self, **kwargs) -> SensorReading:
    """Abstract method to define the sensing mechanism of the agent.

    Args:
        **kwargs: Additional arguments to pass to the `sense` method.

    Returns:
        Sample: The sensory sample created by the agent.
    """
    raise NotImplementedError

sense(**kwargs)

Generate a SensorReading based on given parameters.

Parameters:

Name Type Description Default
**kwargs

Arbitrary keyword arguments for sensory agent to sense on.

{}

Returns:

Name Type Description
SensorReading SensorReading

A SensorReading object based on the provided arguments.

Source code in mbodied/agents/sense/sensory_agent.py
47
48
49
50
51
52
53
54
55
56
def sense(self, **kwargs) -> SensorReading:
    """Generate a SensorReading based on given parameters.

    Args:
        **kwargs: Arbitrary keyword arguments for sensory agent to sense on.

    Returns:
        SensorReading: A SensorReading object based on the provided arguments.
    """
    return self.act(**kwargs)