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

Why is ego velocity_y much more smaller than ego_velocity_x #209

Closed
alantes opened this issue Dec 29, 2022 · 2 comments
Closed

Why is ego velocity_y much more smaller than ego_velocity_x #209

alantes opened this issue Dec 29, 2022 · 2 comments

Comments

@alantes
Copy link

alantes commented Dec 29, 2022

Hello, developers! Thank you for your data and dev-kit!

In "2021.10.15.02.36.56_veh-53_02020_02442.db" of Singapore split, the ego vehicle ran a route like this:
image

But the corresponding velocity_x among the way is like:
image

While the velocity_y is like:
image

To me, velocity_y is like noise rather than normal speed.

Here is my code:

velocity_x = []
velocity_y = []
for i in range(len(scenarios_list)):
    scenario = get_default_scenario_from_token(
        NUPLAN_DATA_ROOT, log_db, scenarios_list[i]["token"].hex(), NUPLAN_MAPS_ROOT, NUPLAN_MAP_VERSION
    )
    velocity_x.append(scenario.initial_ego_state.agent.velocity.x)
    velocity_y.append(scenario.initial_ego_state.agent.velocity.y)
@alantes
Copy link
Author

alantes commented Dec 29, 2022

If I calculate velocity by magnitude and heading, the graphs seem much more correct:

import numpy as np
velocity_x = []
velocity_y = []
for i in range(len(scenarios_list)):
    scenario = get_default_scenario_from_token(
        NUPLAN_DATA_ROOT, log_db, scenarios_list[i]["token"].hex(), NUPLAN_MAPS_ROOT, NUPLAN_MAP_VERSION
    )
    heading = scenario.initial_ego_state.rear_axle.heading
    velocity = scenario.initial_ego_state.dynamic_car_state.rear_axle_velocity_2d.magnitude()
    # velocity_x.append(scenario.initial_ego_state.dynamic_car_state.center_acceleration_2d.x)
    # velocity_y.append(scenario.initial_ego_state.dynamic_car_state.center_acceleration_2d.y)
    velocity_x.append(velocity * np.cos(heading))
    velocity_y.append(velocity * np.sin(heading))

v_x:
image

v_y:
image

@patk-motional
Copy link
Collaborator

Hi @alantes,

Sorry for the delay. The reason that the velocity_y is small is that the velocities are in the ego's frame. velocity_x is the longitudinal direction and velocity_y is the lateral direction. Hope this clears up some of your confusions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants