motional / nuplan-devkit

The devkit of the nuPlan dataset.
https://www.nuplan.org
Other
682 stars 131 forks source link

Incorrect result of sample_indices_with_time_horizon() when num_samples=1 #348

Open emailweixu opened 1 year ago

emailweixu commented 1 year ago

Describe the bug

When the function is called with num_samples=1, the expected result is [int(time_horizon/time_interval)] However, the result is off by 1: [int(time_horizon/time_interval)+1] This can be verified by the following code:

from nuplan.planning.scenario_builder.scenario_utils import sample_indices_with_time_horizon

print(sample_indices_with_time_horizon(1, 2.0, 0.05))  # got 41, expected 40

The consequence of this is that NuPlanScenario.get_past_tracked_objects() does not get the tracked objects at the intended timestamp when num_samples=1