How to use the stonesoup.types.state.StateVector function in stonesoup

To help you get started, we’ve selected a few stonesoup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dstl / Stone-Soup / stonesoup / sensor / radar.py View on Github external
class RadarRangeBearing(Sensor):
    """A simple radar sensor that generates measurements of targets, using a
    :class:`~.RangeBearingGaussianToCartesian` model, relative to its position.

    Note
    ----
    The current implementation of this class assumes a 3D Cartesian plane.

    """

    position = Property(StateVector,
                        doc="The radar position on a 3D Cartesian plane,\
                             expressed as a 3x1 array of Cartesian coordinates\
                             in the order :math:`x,y,z`")
    orientation = Property(
        StateVector,
        doc="A 3x1 array of angles (rad), specifying the radar orientation in \
            terms of the counter-clockwise rotation around each Cartesian \
            axis in the order :math:`x,y,z`. The rotation angles are positive \
            if the rotation is in the counter-clockwise direction when viewed \
            by an observer looking along the respective rotation axis, \
            towards the origin")
    ndim_state = Property(
        int,
        doc="Number of state dimensions. This is utilised by (and follows in\
            format) the underlying :class:`~.RangeBearingGaussianToCartesian`\
            model")
    mapping = Property(
        [np.array], doc="Mapping between the targets state space and the\
                        sensors measurement capability")
    noise_covar = Property(CovarianceMatrix,
                           doc="The sensor noise covariance matrix. This is \
github dstl / Stone-Soup / stonesoup / sensor / radar.py View on Github external
This method computes and updates the sensor's `dwell_center` property.

        Parameters
        ----------
        timestamp: :class:`datetime.datetime`
            A timestamp signifying when the rotation completes
        """

        # Compute duration since last rotation
        duration = timestamp - self.dwell_center.timestamp

        # Update dwell center
        rps = self.rpm/60  # rotations per sec
        self.dwell_center = State(
            StateVector([[self.dwell_center.state_vector[0, 0]
                          + duration.total_seconds()*rps*2*np.pi]]),
            timestamp
        )
github dstl / Stone-Soup / stonesoup / types / detection.py View on Github external
groundtruth_path = Property(
        GroundTruthPath,
        doc="Ground truth path that this detection came from")


class MissedDetection(Detection):
    """Detection type for a missed detection

    This is same as :class:`~.Detection`, but it is used in
    MultipleHypothesis to indicate the null hypothesis (no
    detections are associated with the specified track).
    """

    state_vector = Property(
        StateVector, default=None,
        doc="State vector. Default `None`.")

    def __init__(self, state_vector=None, *args, **kwargs):
        super().__init__(state_vector, *args, **kwargs)

    def __bool__(self):
        return False
github dstl / Stone-Soup / stonesoup / platform / simple.py View on Github external
for i in range(len(self.sensors)):
            if (hasattr(self, 'transition_model') &
                    (np.absolute(self.state.state_vector[
                        self.mounting_mappings[0]+1]).max() > 0)):
                new_sensor_pos = self._get_rotated_offset(i)
                for j in range(self.mounting_offsets.shape[1]):
                    new_sensor_pos[j] = new_sensor_pos[j] + \
                        (self.state.state_vector[
                            self.mounting_mappings[i, j]])
            else:
                new_sensor_pos = np.zeros([self.mounting_offsets.shape[1], 1])
                for j in range(self.mounting_offsets.shape[1]):
                    new_sensor_pos[j] = (self.state.state_vector[
                        self.mounting_mappings[i, j]] +
                        self.mounting_offsets[i, j])
            self.sensors[i].set_position(StateVector(new_sensor_pos))
            vel = np.zeros([self.mounting_mappings.shape[1], 1])
            for j in range(self.mounting_mappings.shape[1]):
                vel[j, 0] = self.state.state_vector[
                    self.mounting_mappings[i, j] + 1]
            abs_vel, heading = cart2pol(vel[0, 0], vel[1, 0])
            self.sensors[i].set_orientation(
                StateVector([[0], [0], [heading]]))
github dstl / Stone-Soup / stonesoup / sensor / radar.py View on Github external
from ..types.array import CovarianceMatrix
from ..types.detection import Detection
from ..types.state import State, StateVector


class RadarRangeBearing(Sensor):
    """A simple radar sensor that generates measurements of targets, using a
    :class:`~.RangeBearingGaussianToCartesian` model, relative to its position.

    Note
    ----
    The current implementation of this class assumes a 3D Cartesian plane.

    """

    position = Property(StateVector,
                        doc="The radar position on a 3D Cartesian plane,\
                             expressed as a 3x1 array of Cartesian coordinates\
                             in the order :math:`x,y,z`")
    orientation = Property(
        StateVector,
        doc="A 3x1 array of angles (rad), specifying the radar orientation in \
            terms of the counter-clockwise rotation around each Cartesian \
            axis in the order :math:`x,y,z`. The rotation angles are positive \
            if the rotation is in the counter-clockwise direction when viewed \
            by an observer looking along the respective rotation axis, \
            towards the origin")
    ndim_state = Property(
        int,
        doc="Number of state dimensions. This is utilised by (and follows in\
            format) the underlying :class:`~.RangeBearingGaussianToCartesian`\
            model")
github dstl / Stone-Soup / stonesoup / platform / simple.py View on Github external
(self.state.state_vector[
                            self.mounting_mappings[i, j]])
            else:
                new_sensor_pos = np.zeros([self.mounting_offsets.shape[1], 1])
                for j in range(self.mounting_offsets.shape[1]):
                    new_sensor_pos[j] = (self.state.state_vector[
                        self.mounting_mappings[i, j]] +
                        self.mounting_offsets[i, j])
            self.sensors[i].set_position(StateVector(new_sensor_pos))
            vel = np.zeros([self.mounting_mappings.shape[1], 1])
            for j in range(self.mounting_mappings.shape[1]):
                vel[j, 0] = self.state.state_vector[
                    self.mounting_mappings[i, j] + 1]
            abs_vel, heading = cart2pol(vel[0, 0], vel[1, 0])
            self.sensors[i].set_orientation(
                StateVector([[0], [0], [heading]]))
github dstl / Stone-Soup / stonesoup / sensor / radar.py View on Github external
in the sensor's field of view, or ``None``, otherwise. The\
            timestamp of the measurement is set equal to that of the provided\
            state.
        """

        # Read timestamp from ground truth
        timestamp = ground_truth.timestamp

        # Rotate the radar antenna and compute new heading
        self.rotate(timestamp)
        antenna_heading = self.orientation[2, 0] + \
            self.dwell_center.state_vector[0, 0]

        # Set rotation offset of underlying measurement model
        rot_offset =\
            StateVector(
                [[self.orientation[0, 0]],
                 [self.orientation[1, 0]],
                 [antenna_heading]])
        self.measurement_model.rotation_offset = rot_offset

        # Transform state to measurement space and generate
        # random noise
        measurement_vector = self.measurement_model.function(
            ground_truth.state_vector, noise=0, **kwargs)
        if(noise is None):
            measurement_noise = self.measurement_model.rvs()
        else:
            measurement_noise = noise

        # Check if state falls within sensor's FOV
        fov_min = -self.fov_angle/2