Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPDA and SystematicResampler Fixes #152

Closed
wants to merge 6 commits into from

Conversation

JPompeus
Copy link
Contributor

Minor fixes for issues arising when JPDA measurements arrive asynchronously. Descriptions in individual commits.

Particles are sorted by weight before calculating the cumulative sum array. Thus when particles are resampled, they are drawn from the ordered distribution, rather than randomly.
The prediction and measurement prediction for every hypothesis in the multihypothesis were originally set as for the missed detection state. This causes spurious results at the update step if the measurements in the multihypothesis are asynchronous (e.g. grouped by a time-windowing feeder class), and the sensor platform is moving. In this case, the updated state is calculated using the sensor's translation offset at the missed detection timestamp (i.e. the latest timestamp in the window), but for a position measurement taken at the measurement timestamp (which may be earlier in the window).
This fix attaches the prediction/measurement prediction calculated for the measurement to the relevant SingleHypothesis, such that the update is calculated using the correct sensor offset for the measurement timestamp.
accidental commit
Accidental commit
Particles are sorted before calculating the cumulative sum array. Thus when particles are resampled, they are drawn from the ordered distribution, rather than randomly.
The prediction and measurement prediction were originally set for every hypothesis in the multihypothesis as for the missed detection state. This causes spurious results at the update step if the measurements in the multihypothesis are asynchronous (e.g. grouped by a time-windowing feeder class), and the sensor platform is moving. In this case, the updated state is calculated using the sensor's translation offset at the missed detection timestamp (i.e. the latest timestamp in the window), but for a position measurement taken at the measurement timestamp (which may be earlier in the window).
This fix attaches the prediction/measurement prediction calculated for the measurement to the relevant SingleHypothesis, such that the update is calculated using the correct sensor offset for the measurement timestamp.
@@ -24,6 +24,7 @@ def resample(self, particles):

n_particles = len(particles)
weight = Probability(1/n_particles)
particles = sorted(particles, key=lambda x: x.weight, reverse=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use attrgetter for the key.

pro_detect_assoc = Probability.sum(
joint_hypothesis.probability
for joint_hypothesis in joint_hypotheses
if joint_hypothesis.
hypotheses[track].measurement is detection)
hypotheses[track].measurement is hypothesis.measurement)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indentation need removing to fix a flake8 error.

measurement_prediction,
hypothesis.prediction,
hypothesis.measurement,
measurement_prediction=hypothesis.measurement_prediction,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is raising a flake8 error also. Easiest fix would be to change arguments to positional rather keyword arguments as the variables have good descriptive names (noting you'll need to switch probability and measurement_prediction arguments around).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may no longer be an issue following #166.

@sdhiscocks sdhiscocks changed the title Ultra public dev JPDA and SystematicResampler Fixes Dec 4, 2019
@sdhiscocks sdhiscocks requested a review from a team March 20, 2020 16:02
@sdhiscocks
Copy link
Member

Could I ask for someone to review this please? (Ignore Flake8 issues, as these will be fixed on merge)

@jmbarr
Copy link
Contributor

jmbarr commented Mar 30, 2020

Could I ask for someone to review this please? (Ignore Flake8 issues, as these will be fixed on merge)

Quick question. Is it all commits, or just the latest one we're looking at?

@sdhiscocks
Copy link
Member

Could I ask for someone to review this please? (Ignore Flake8 issues, as these will be fixed on merge)

Quick question. Is it all commits, or just the latest one we're looking at?

The net change of all the commits.

@sdhiscocks
Copy link
Member

Closed as will resolved with #193

@sdhiscocks sdhiscocks closed this Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants