nuplan-devkit
nuplan-devkit copied to clipboard
Incorrect result of sample_indices_with_time_horizon() when num_samples=1
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