nuplan-devkit icon indicating copy to clipboard operation
nuplan-devkit copied to clipboard

Incorrect result of sample_indices_with_time_horizon() when num_samples=1

Open emailweixu opened this issue 2 years ago • 0 comments

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

emailweixu avatar Aug 25 '23 19:08 emailweixu