How to make vehicle change lane when there's a parked vehicle blocking current lane

Hi all,

I tried to create vehicle A that’s parked (setting autopilot=False) on the most right lane of the road. However, when another vehicle B (with autopilot set to True) goes into that lane, it is stuck on that lane forever (because vehicle A blocks the lane and is not moving).

I wonder if current Carla version can allow vehicle B to change lane when encounters another vehicle that is not registered to traffic manager?

Any help is appreciated!

Hi, my suggestion here would be to set the parked vehicle A to set_autopilot = True, then setting the target velocity of A to be 0. Or you could force the vehicle B to perform a lane change using the force_lane_change parameter.

However, B should still be able to detect A even if it’s not registered to the Traffic Manager, so something is probably off there. I will try it myself as soon as I can!

Hi @jackbart,

Thanks for the instruction! For some reason, in synchronous mode, when I use set_target_velocity() through PythonAPI to set every vehicle to have a zero velocity vector, it had no impact. The vehicles kept moving as usual directed by traffic manager.

I’ll try some other scenarios too!

That’s because you shouldn’t use set_target_velocity, rather you should use:

  • vehicle_percentage_speed_difference ( self , actor , percentage )
    Sets the difference the vehicle’s intended speed and its current speed limit. Speed limits can be exceeded by setting the perc to a negative value. Default is 30. Exceeding a speed limit can be done using negative percentages.
  • Parameters:
    • actor ( carla.Actor ) – Vehicle whose speed behaviour is being changed.
    • percentage ( float ) – Percentage difference between intended speed and the current limit.

You can read more at this link to the Traffic Manager Python API.

Hi @jackbart,

Thanks a lot for pointing it out!