OATML / oatomobile

A research framework for autonomous driving
https://sites.google.com/view/av-detect-recover-adapt
Apache License 2.0
191 stars 37 forks source link

carla_map.get_waypoint(location) #11

Open MNikdan opened 3 years ago

MNikdan commented 3 years ago

Hello.

I'm trying to visualize the predictions of DIM agent. I was able to do so by using the carnovel benchmark. But in the output videos, the car does not exactly follow the prediction.

Here's a sample of the generated outputs. As you can see in the video, the car is not following the red line. dim.zip

Is there a constraint that prevents the car from getting out of lane?

hzakerynia commented 3 years ago

I have the same problem.

filangelos commented 3 years ago

Hi @MNikdan and @hzakerynia,

There is no constraint that prevents the car from getting out of the lane!

The reason why you observe this behaviour is due to the way predictions are consumed by the SetPointAgent: There are a few key arguments in the initialization of the Agent that you can play with and observe their impact on how the agent behaves with respect to the predictions:

For example, by setting setpoint_index=5 and replan_every_steps=1 (the default values), the agent:

  1. generates a prediction with shape [40, 2],
  2. it keeps only the first [5, 2] (as specified by setpoint_index),
  3. it uses these points to calculate the target speed and the steering angle,
  4. it performs a single step in the environment,
  5. repeat...

If you look carefully at the videos you will see that the agent is really following the setpoint_index point at each timestep. An experiment I would recommend you try is setting replan_every_steps=35 (or something close to 40) and see how the agent does consume the whole prediction!

I hope that helps with your question. Let me know if there are any other related questions.

hzakerynia commented 3 years ago

Hi Thanks for your answer. I used a dummy agent that predict a constant trajectory that goes north-east with default settings. as it's shown in this gif.zip it won't follow the prediction until there is a road. I still think the car doesn't follow predictions if it causes an accident and I think it's because of this part that gets the setpoints from carla.

filangelos commented 3 years ago

Hi @hzakerynia,

Hmm, I think you are right! I hadn't thought that carla_map.get_waypoint(location) would have such an impact! The reason we were using it was that the official CARLA PID controller expects a carla.Waypoint instead of a carla.Location object and that was the easiest way to make the typecasting.

This may require a decent amount of refactoring and we should rerun the suite of experiments and update the numbers accordingly. Let me get back to you when I have this.

At least all the methods use the very same method so there is no bias towards any of the baselines. Nonetheless, that may mean that the final scores may need to be modified.

Anyway, thank you @hzakerynia for spotting that!

Ad4102 commented 3 years ago

Hello.

I'm trying to visualize the predictions of DIM agent. I was able to do so by using the carnovel benchmark. But in the output videos, the car does not exactly follow the prediction.

Here's a sample of the generated outputs. As you can see in the video, the car is not following the red line.

dim.zip

Is there a constraint that prevents the car from getting out of lane?

Hello. Can you share some insight on how do you plot the red line the the dim.zip videos. I have tried all the ways to do it but for one or the other reason I can't. I am try to use autopilot at server side.

MNikdan commented 3 years ago

Hello. I'm trying to visualize the predictions of DIM agent. I was able to do so by using the carnovel benchmark. But in the output videos, the car does not exactly follow the prediction. Here's a sample of the generated outputs. As you can see in the video, the car is not following the red line. dim.zip Is there a constraint that prevents the car from getting out of lane?

Hello. Can you share some insight on how do you plot the red line the the dim.zip videos. I have tried all the ways to do it but for one or the other reason I can't. I am try to use autopilot at server side.

Hello. Sorry I closed the issue by mistake. Something like this should work. Have you tried this?

import functools
from oatomobile.benchmarks.carnovel.benchmark import carnovel

agent_fn = functools.partial(
    AutopilotAgent,
    proximity_tlight_threshold=5.,
    proximity_vehicle_threshold=10.0,
    noise=0,
)

carnovel.evaluate(agent_fn, log_dir='log_dir/', subtasks_id='AbnormalTurns0-v0', monitor=True, render=False)
JaiChandak commented 1 week ago

Hey @MNikdan , I am also trying to play around with testing models on the benchmark but I'm unable to get it running. I even tried running what you suggested

import functools
from oatomobile.benchmarks.carnovel.benchmark import carnovel

agent_fn = functools.partial(
    AutopilotAgent,
    proximity_tlight_threshold=5.,
    proximity_vehicle_threshold=10.0,
    noise=0,
)

carnovel.evaluate(agent_fn, log_dir='log_dir/', subtasks_id='AbnormalTurns0-v0', monitor=True, render=False)

but the script didn't do anything. This is the output at the terminal when I ran it.

pygame 1.9.6 Hello from the pygame community. https://www.pygame.org/contribute.html 0it [00:00, ?it/s]

I wanted to ask if there is another way to test on the benchmark?