Skip to content

Commit

Permalink
Update to platform to allow it to control the positions of its sensors (
Browse files Browse the repository at this point in the history
#177)

Update to platform to allow it to control the positions of its sensors, rather than saving it to the sensor each time the platform moves.

- Create both fixed and moving sensor platforms
- Force a sensor to be mounted to a platform
- Give sensors a default fixed platform if position and or/orientation are specified
- properties for position, velocity and orientation
- Use mappings between state_vector and position/velocity
- Give Platform a state_vector/timestamp property
- Update tests to match
  • Loading branch information
erogers-dstl committed Apr 27, 2020
1 parent b61928a commit 77061d4
Show file tree
Hide file tree
Showing 21 changed files with 1,649 additions and 591 deletions.
3 changes: 3 additions & 0 deletions docs/source/stonesoup.sensor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Sensors
.. automodule:: stonesoup.sensor.base
:show-inheritance:

.. automodule:: stonesoup.sensor.sensor
:show-inheritance:


Passive
-------
Expand Down
9 changes: 4 additions & 5 deletions stonesoup/models/measurement/base.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# -*- coding: utf-8 -*-
from abc import abstractmethod
from abc import abstractmethod, ABC

import scipy as sp
import numpy as np

from ..base import Model
from ...base import Property


class MeasurementModel(Model):
class MeasurementModel(Model, ABC):
"""Measurement Model base class"""

ndim_state = Property(int, doc="Number of state dimensions")
mapping = Property(
sp.ndarray, doc="Mapping between measurement and state dims")
mapping = Property(np.ndarray, doc="Mapping between measurement and state dims")

@property
def ndim(self):
Expand Down
15 changes: 6 additions & 9 deletions stonesoup/models/measurement/nonlinear.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from abc import ABC
from typing import List
import copy

import numpy as np
Expand All @@ -15,8 +17,7 @@
from .base import MeasurementModel


class CombinedReversibleGaussianMeasurementModel(
ReversibleModel, GaussianModel, MeasurementModel):
class CombinedReversibleGaussianMeasurementModel(ReversibleModel, GaussianModel, MeasurementModel):
r"""Combine multiple models into a single model by stacking them.
The assumption is that all models are Gaussian, and must be combination of
Expand All @@ -29,8 +30,7 @@ class CombinedReversibleGaussianMeasurementModel(
:class:`~.LinearModel` or :class:`~.ReversibleModel`.
"""
mapping = None
model_list = Property(
[MeasurementModel], doc="List of Measurement Models.")
model_list = Property(List[MeasurementModel], doc="List of Measurement Models.")

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -90,9 +90,7 @@ def rvs(self, num_samples=1, **kwargs):
return rvs_vectors.view(Matrix)


class NonLinearGaussianMeasurement(MeasurementModel,
NonLinearModel,
GaussianModel):
class NonLinearGaussianMeasurement(MeasurementModel, NonLinearModel, GaussianModel, ABC):
r"""This class combines the MeasurementModel, NonLinearModel and \
GaussianModel classes. It is not meant to be instantiated directly \
but subclasses should be derived from this class.
Expand Down Expand Up @@ -272,8 +270,7 @@ def rvs(self, num_samples=1, **kwargs):
return out


class CartesianToBearingRange(
NonLinearGaussianMeasurement, ReversibleModel):
class CartesianToBearingRange(NonLinearGaussianMeasurement, ReversibleModel):
r"""This is a class implementation of a time-invariant measurement model, \
where measurements are assumed to be received in the form of bearing \
(:math:`\phi`) and range (:math:`r`), with Gaussian noise in each dimension.
Expand Down

0 comments on commit 77061d4

Please sign in to comment.