Esempio n. 1
0
    measurement_model=measurement_model)

# DELETER
from stonesoup.deleter.error import CovarianceBasedDeleter
deleter = CovarianceBasedDeleter(covar_trace_thresh=1E-3)


# 5. Running the Tracker

# Single Target Tracker

from stonesoup.tracker.simple import SingleTargetTracker
tracker = SingleTargetTracker(
    initiator=initiator,
    deleter=deleter,
    detector=detections_source,
    data_associator=data_associator,
    updater=updater,
)


# 6. Display Results

tracks = set()
groundtruth_paths = set()  # Store for plotting later
detections = set()  # Store for plotting later

# METRICSGENERATOR 
from stonesoup.metricgenerator.plotter import TwoDPlotter
TwoDPlotter([0, 1], [0, 1], [0, 1]).plot_tracks_truth_detections(tracks, groundtruth_paths, detections)
# DELETER
from stonesoup.deleter.error import CovarianceBasedDeleter

deleter = CovarianceBasedDeleter(covar_trace_thresh=1E3)

# 5. Running the Tracker

# Single Target Tracker

from stonesoup.tracker.simple import SingleTargetTracker

tracker = SingleTargetTracker(
    initiator=initiator,
    deleter=deleter,
    detector=detections_source,
    data_associator=data_associator,
    updater=updater,
)

# 6. Display Results

tracks = set()
#for time,current_tracks in tracker.tracks_gen():
#    tracks = tracks.union(current_tracks)
groundtruth_paths = set()  # Store for plotting later
detections = set()  # Store for plotting later

for step, (time, ctracks) in enumerate(tracker.tracks_gen(), 1):
    tracks.update(ctracks)
    detections |= tracker.detector.detections
Esempio n. 3
0
    None)

initiator = GaussianParticleInitiator(number_particles=500,
                                      initiator=single_point_initiator)

hypothesiser = DistanceHypothesiser(predictor, updater, measure=Mahalanobis(), missed_distance=np.inf)
data_associator = GNNWith2DAssignment(hypothesiser)

from stonesoup.deleter.time import UpdateTimeStepsDeleter
deleter = UpdateTimeStepsDeleter(time_steps_since_update=10)

# Create a Kalman single-target tracker
tracker = SingleTargetTracker(
    initiator=initiator,
    deleter=deleter,
    detector=sim,
    data_associator=data_associator,
    updater=updater
)

# %%
# The final step is to iterate our tracker over the simulation and plot out the results. Because we have a bearing
# only sensor it does not make sense to plot out the detections without animating the resulting plot. This
# animation shows the sensor platform (blue) moving towards the true target position (red). The estimated target
# position is shown in black, radar detections are shown in yellow while the bearing only imager detections are
# coloured green.
from matplotlib import animation
import matplotlib

matplotlib.rcParams['animation.html'] = 'jshtml'
Esempio n. 4
0
deleter = MyDeleter()

# %%
# Setup Hypothesiser and Associator
# ---------------------------------
# Since we know there is only one measurement per scan, we can just use the
# :class:`~.NearestNeighbour` associator to achieve our desired result.
from stonesoup.measures import Euclidean
from stonesoup.dataassociator.neighbour import NearestNeighbour
from stonesoup.hypothesiser.distance import DistanceHypothesiser
from stonesoup.tracker.simple import SingleTargetTracker
meas = Euclidean()
hypothesiser = DistanceHypothesiser(predictor, updater, meas)
associator = NearestNeighbour(hypothesiser)

tracker = SingleTargetTracker(initiator, deleter, detector, associator,
                              updater)

# %%
# Run the Tracker
# ---------------------------------
# We extract the ground truth from the detector and then run the tracker.
# While running the tracker we:
#
# - Extract the measurement that is associated with it.
# - Extract the position components of the estimated state vector.
#
# This allows us to plot the measurements, ground truth, and state estimates.
#
# **Note:** The meas_model.inverse_function() returns a state vector, which
# for our CV model consists of [x, vx, y, vy, z, vz].
from matplotlib import pyplot as plt