motional / nuplan-devkit

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

Visualize single observation #338

Closed Syzygianinfern0 closed 1 year ago

Syzygianinfern0 commented 1 year ago

How can I visualize the current_input: PlannerInput?

https://github.com/motional/nuplan-devkit/blob/cd3fd8d3d0c4d390fcb74d05fd56f92d9e0c366b/nuplan/planning/simulation/planner/simple_planner.py#L57

Syzygianinfern0 commented 1 year ago

@christopher-motional could you please help me out if possible. Thanks!

christopher-motional commented 1 year ago

Hi @Syzygianinfern0, the devkit doesn't have anything out of the box for visualizing planner input directly, though perhaps you can visualize the scenarios the planner input is extracted from similar to what's being done in the scenario visualization tutorial. You can see here where the PlannerInput is constructed. The important part here is the history buffer which is an extraction of states from the scenario. Looking through the frames in the scenario should give you a picture of what you're interested in -- with a little work you could also try to visualize the history provided at each input by creating a similar method to serialize_scenario that creates a simulation history from past observations similar to what is being done when initializing a simulation history buffer from scenario.

christopher-motional commented 1 year ago

You can also see the visualization callback for visualizing features that get provided to MLPlanners. Hope that helps!

Syzygianinfern0 commented 1 year ago

Thanks! Is there any existing method implemented to export simulations as mp4s?

christopher-motional commented 1 year ago

We don't support exporting simulations as mp4s, however you can use nuBoard (go to the Scenario tab) to visualize the scenarios associated with a set of simulations you generate much like a video file -- it also has a tab for quickly jumping between scenarios. You can see the latter part of the framework tutorial for an example of how to use it

Syzygianinfern0 commented 1 year ago

perhaps you can visualize the scenarios the planner input is extracted from similar to what's being done in the scenario visualization tutorial. You can see here where the PlannerInput is constructed.

@christopher-motional this function requires a "scenario" object. How can I provide the input of the current_state and potentially the "next_state" so that I can visualize the movement of the ego vehicle for a single call of the planner.compute_trajectory()?

Also what is time_us?

patk-motional commented 1 year ago

It is easiest if you use the simulation framework.

Here is an example of running an open_loop simulation.

First, run the simulation. python nuplan/planning/script/run_simulation.py +simulation=open_loop_boxes planner=simple_planner

Inspect it using nuBoard. python nuplan/planning/script/run_nuboard.py