Visualization GIF Different Colors

Hi there,

is there a possibility of changing colors of specific vehicle (ego vehicle) in the GIF visualization?
I am searching for something similar like draw_object() where I can use a unique color for the ego vehicle.
Currently all vehicles are blue in my gifs even if I change the color in draw_params (at least I expected the change of color of all vehicles but nothing happened).

Thanks in advance.

Hi,

could you please provide a minimal working example?

Otherwise it is difficult to reproduce your problem.

I just followed the steps of tutorial 2 (optimization) from the commonroad website
and instead of printing the every single graph with matplot (draw_object()), I tried to
export a gif with create_scenario_video():
draw_params = {'dynamic_obstacle': {'vehicle_shape': {'occupancy': {'shape': {'rectangle': {'facecolor': 'g'}}}}}}
gif_path = os.path.join(os.getcwd(), os.path.dirname(__file__), 'gifs/tut2.gif')
create_scenario_video([scenario, ego_vehicle], gif_path, 0, 40, draw_params=draw_params, dt=0.01)

The result is this:

The problem is in your draw_params. The hierarchy is not correctly specified. You can achieve the desired behavior by changing your drawing parameters to:

draw_params = {'dynamic_obstacle': {'shape': {'rectangle': {'facecolor': 'g'}}}}
1 Like

Thank you, works perfect now :slight_smile: