Skip to content

estimator

Base class for all estimators.

Estimator(state_dim, input_dim, obs_dim, dt)

Bases: ABC

Base class for estimator implementations.

Initialize basic parameters.

Parameters:

Name Type Description Default
state_dim int

Dimensionality of the systems states, e.g., x of f(x,u)

required
input_dim int

Dimensionality of the input to the dynamics, e.g., u of f(x,u)

required
obs_dim int

Dimensionality of the observations, e.g., y

required
dt float

Time step between callings.

required
Source code in drone_estimators/estimator.py
def __init__(self, state_dim: int, input_dim: int, obs_dim: int, dt: float):
    """Initialize basic parameters.

    Args:
        state_dim: Dimensionality of the systems states, e.g., x of f(x,u)
        input_dim: Dimensionality of the input to the dynamics, e.g., u of f(x,u)
        obs_dim: Dimensionality of the observations, e.g., y
        dt: Time step between callings.
    """
    self._state_dim = state_dim
    self._obs_dim = obs_dim
    self._input_dim = input_dim
    self._dt = dt
    self._state = np.zeros(self._state_dim)
    self._input = np.zeros(self._input_dim)

reset()

Reset the noise to its initial state.

Source code in drone_estimators/estimator.py
def reset(self):
    """Reset the noise to its initial state."""
    self._state = np.zeros(self._state_dim)
    self._input = np.zeros(self._input_dim)

set_input(u)

Sets the input of the dynamical system. Assuming this class gets called multiple times between controller calls. We therefore store the input as a constant in the class.

Parameters:

Name Type Description Default
u Array

Input to the dynamical system.

required
Source code in drone_estimators/estimator.py
def set_input(self, u: Array):
    """Sets the input of the dynamical system. Assuming this class gets called multiple times between controller calls. We therefore store the input as a constant in the class.

    Args:
        u: Input to the dynamical system.
    """
    # TODO check for shape?
    self.data = self.data.replace(u=u)

step() abstractmethod

Increment the noise step for time dependent noise classes.

Source code in drone_estimators/estimator.py
@abstractmethod
def step(self):
    """Increment the noise step for time dependent noise classes."""
    pass