motional / nuplan-devkit

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

Ego car velocity direction bug. #222

Closed QuanyiLi closed 1 year ago

QuanyiLi commented 1 year ago

Describe the bug

Hi,

I found that the velocity retrieved by get_get_ego_state_at_iteration(step).agent.velocity has a wrong direction, which has approximately +90 degree offset based on state.center.heading. I understand that the velocity direction may have a slight difference from the heading direction, but 90 degree looks like an impossible value.

Setup

on my personal laptop with Ubunu 20.0 with 32g memory.

Steps To Reproduce

Setup:

DATASET_PARAMS=[
        'scenario_builder=nuplan_mini',  # use nuplan mini database (2.5h of 8 autolabeled logs in Las Vegas)
        'scenario_filter=one_continuous_log',  # simulate only one log
        "scenario_filter.log_names=['2021.07.16.20.45.29_veh-35_01095_01486']",
        'scenario_filter.limit_total_scenarios=2',  # use 2 total scenarios
    ],

Reproduce

First, python run_simulation +simulation=closed_loop_nonreactive_agents scenario_filter.limit_total_scenarios=1 planner=simple_planner worker=sequential.

Second, set a breakpoint at simulations_runner.py line 134.

then get the velocity and heading and the diff

nuplan_scenario = self.simulations[0].scenario
state = nuplan_scenario.get_ego_state_at_iteration(0)
velocity_dir = np.arctan2(state.agent.velocity.y, state.agent.velocity.x)
heading_dir = state.waypoint.heading
diff = abs(velocity_dir-heading_dir)

then you will see the diff is about 1.57, which is pi/2, while applying the same calculation to detected objects, the diff is about 0.

Stack Trace

Traceback (most recent call last):
  ...

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

gianmarco-motional commented 1 year ago

Hey!

Ego's velocities are in ego frame, not in global frame.