Platforms
- class stonesoup.platform.base.Platform(movement_controller: Movable = None, sensors: MutableSequence[Sensor] = None, id: str = None, shape: Shape = None)[source]
Bases:
BaseA platform that can carry a number of different sensors.
The location of platform mounted sensors will be maintained relative to the sensor position. Platforms move within a 2 or 3 dimensional rectangular cartesian space.
A simple platform is considered to always be aligned with its principle velocity. It does not take into account issues such as bank angle or body deformation (e.g. flex).
Movement is controlled by the Platform’s
Platform.movement_controller, and access to attributes of the Platform is proxied to the movement controller, to allow the Platform to report its own position, orientation etc.If a
movement_controllerargument is not supplied to the constructor, the Platform will try to construct one using unused arguments passed to the Platform’s constructor.It is also possible to specify the
Shapeof a platform, in the event of it representing a vehicle with known geometry, by providing the optional property.Note
This class is abstract and not intended to be instantiated. To get the behaviour of this class use a subclass which gives movement behaviours. Currently, these are
FixedPlatformandMovingPlatform- Parameters:
movement_controller (
Movable, optional) –Movableobject to control the Platform’s movement. Default is None, but it can be constructed transparently by passing Movable’s constructor parameters to the Platform constructor.sensors (
collections.abc.MutableSequence, optional) – A list of N mounted sensors. Defaults to an empty list.id (
str, optional) – The unique platform ID. Default None where random UUID is generated.shape (
Shape, optional) – OptionalShapeobject defining thePlatformshape.
- movement_controller: Movable
Movableobject to control the Platform’s movement. Default is None, but it can be constructed transparently by passing Movable’s constructor parameters to the Platform constructor.
- sensors: MutableSequence[Sensor]
A list of N mounted sensors. Defaults to an empty list.
- add_sensor(sensor: Sensor) None[source]
Add a sensor to the platform.
- Parameters:
sensor (
BaseSensor) – The sensor object to add.
- remove_sensor(sensor: Sensor) None[source]
Remove a sensor from the platform.
- Parameters:
sensor (
BaseSensor) – The sensor object to remove.
- pop_sensor(index: int = -1)[source]
Remove and return a sensor from the platform by index. If no index is specified, remove and return the last sensor in
self.sensors.- Parameters:
index (int) – The index of the sensor to remove. Defaults to the last item in the list.
- property ground_truth_path: GroundTruthPath
Produce a
GroundTruthPathwith the same id and states as the platform.The states property for the platform and ground_truth_path are dynamically linked:
self.ground_truth_path.states is self.statesSo after platform.move() the ground_truth_path will contain the new state. However, replacing the id, states or movement_controller variables in either the platform or ground truth path will not be reflected in the other object.
platform_gtp = self.ground_truth_pathplatform_gtp.states = []self.states is not platform_gtp.statesPlatform.ground_truth_path produces a new
GroundTruthPathon every instance. It is not an object that is updatedself.ground_truth_path.states is not self.ground_truth_path.states
- property vertices
Vertices are calculated by applying
positionandorientationtoshape. Ifpositionororientationchanges, then vertices will reflect these changes. Ifshapespecifies vertices that connect to more than two other vertices, then the vertex with more connections will be duplicated. This enables correct handling of complex non-convex shapes.
- property relative_edges
Calculates the difference between connected vertices Cartesian coordinates. This is used by
is_visible()ofVisibilityInformed2DSensorwhen calculating the visibility of a state due to obstacles obstructing the line of sight to the target.
- class stonesoup.platform.base.FixedPlatform(movement_controller: Movable = None, sensors: MutableSequence[Sensor] = None, id: str = None, shape: Shape = None)[source]
Bases:
Platform- Parameters:
movement_controller (
Movable, optional) –Movableobject to control the Platform’s movement. Default is None, but it can be constructed transparently by passing Movable’s constructor parameters to the Platform constructor.sensors (
collections.abc.MutableSequence, optional) – A list of N mounted sensors. Defaults to an empty list.id (
str, optional) – The unique platform ID. Default None where random UUID is generated.shape (
Shape, optional) – OptionalShapeobject defining thePlatformshape.
- class stonesoup.platform.base.MovingPlatform(movement_controller: Movable = None, sensors: MutableSequence[Sensor] = None, id: str = None, shape: Shape = None)[source]
Bases:
Platform- Parameters:
movement_controller (
Movable, optional) –Movableobject to control the Platform’s movement. Default is None, but it can be constructed transparently by passing Movable’s constructor parameters to the Platform constructor.sensors (
collections.abc.MutableSequence, optional) – A list of N mounted sensors. Defaults to an empty list.id (
str, optional) – The unique platform ID. Default None where random UUID is generated.shape (
Shape, optional) – OptionalShapeobject defining thePlatformshape.
- class stonesoup.platform.base.MultiTransitionMovingPlatform(movement_controller: Movable = None, sensors: MutableSequence[Sensor] = None, id: str = None, shape: Shape = None)[source]
Bases:
Platform- Parameters:
movement_controller (
Movable, optional) –Movableobject to control the Platform’s movement. Default is None, but it can be constructed transparently by passing Movable’s constructor parameters to the Platform constructor.sensors (
collections.abc.MutableSequence, optional) – A list of N mounted sensors. Defaults to an empty list.id (
str, optional) – The unique platform ID. Default None where random UUID is generated.shape (
Shape, optional) – OptionalShapeobject defining thePlatformshape.
- class stonesoup.platform.base.PathBasedPlatform(path: GroundTruthPath, movement_controller: Movable = None, sensors: MutableSequence[Sensor] = None, id: str = None, shape: Shape = None)[source]
Bases:
MovingPlatform- Parameters:
path (
GroundTruthPath) – Ground truth path used for the platform. This is for use in cases when platform paths are imported from external data, e.g., from a CSV filemovement_controller (
Movable, optional) –Movableobject to control the Platform’s movement. Default is None, but it can be constructed transparently by passing Movable’s constructor parameters to the Platform constructor.sensors (
collections.abc.MutableSequence, optional) – A list of N mounted sensors. Defaults to an empty list.id (
str, optional) – The unique platform ID. Default None where random UUID is generated.shape (
Shape, optional) – OptionalShapeobject defining thePlatformshape.
- path: GroundTruthPath
Ground truth path used for the platform. This is for use in cases when platform paths are imported from external data, e.g., from a CSV file
- class stonesoup.platform.base.Obstacle(movement_controller: Movable = None, sensors: MutableSequence[Sensor] = None, id: str = None, shape: Shape = None)[source]
Bases:
PlatformA platform class representing obstacles in the environment that may block the line of sight to targets, preventing detection and measurement. This platform requires the user to define the
shapeproperty.- Parameters:
movement_controller (
Movable, optional) –Movableobject to control the Platform’s movement. Default is None, but it can be constructed transparently by passing Movable’s constructor parameters to the Platform constructor.sensors (
collections.abc.MutableSequence, optional) – A list of N mounted sensors. Defaults to an empty list.id (
str, optional) – The unique platform ID. Default None where random UUID is generated.shape (
Shape, optional) – OptionalShapeobject defining thePlatformshape.
- classmethod from_obstacle(obstacle: Obstacle, **kwargs) Obstacle[source]
Return a new obstacle instance by providing new properties to an existing obstacle. It is possible to overwrite any property of the original obstacle by defining the required keyword arguments. Any arguments that are undefined remain from the obstacle attribute. The utility of this method is to easily create new obstacles from a single base obstacle, where each will share the shape data of the original, but this is not the limit of its functionality.
- class stonesoup.platform.shape.Shape(shape_data: StateVectors, simplices: Sequence[int] | ndarray = None, shape_mapping: Sequence[int] = (0, 1))[source]
Bases:
BaseA class for handling shapes as polygons which can be subsequently passed to
Platformwhen considering physical presence of the vehicle. This is also used when defining obstacles which require shape in order for simulated sensors to be affected.- Parameters:
shape_data (
StateVectors) – Coordinates defining the vertices of the obstacle relativeto its centroid without any orientation.simplices (
Union[Sequence[int], numpy.ndarray], optional) – ASequenceornp.ndarray, describing the connectivity of vertices specified inshape_data. Should be constructed such that element i is the index of a vertex that i is connected to. For example, simplices for a four sided obstacle may be (1, 2, 3, 0) for consecutively defined vertices. Default assumes thatshape_datais provided such that consecutive vertices are connected, such as the example above.shape_mapping (
Sequence[int], optional) – A mapping forshape_datadimensions to \(xy\) Cartesian position. Default value is (0,1).
- shape_mapping: Sequence[int]
A mapping for
shape_datadimensions to \(xy\) Cartesian position. Default value is (0,1).
- shape_data: StateVectors
Coordinates defining the vertices of the obstacle relativeto its centroid without any orientation.
- simplices: Sequence[int] | ndarray
A
Sequenceornp.ndarray, describing the connectivity of vertices specified inshape_data. Should be constructed such that element i is the index of a vertex that i is connected to. For example, simplices for a four sided obstacle may be (1, 2, 3, 0) for consecutively defined vertices. Default assumes thatshape_datais provided such that consecutive vertices are connected, such as the example above.