plafosim.gui module

plafosim.gui.add_gui_vehicle(vid: int, position: float, lane: int, speed: float, color: tuple = (0, 255, 0), track: bool = False)[source]

Add a vehicle to the GUI.

Parameters:
  • vid (int) – The vehicle’s id

  • position (float) – The vehicle’s current position

  • lane (int) – The vehicle’s current lane

  • speed (float) – The vehicle’s current speed

  • color (tuple) – The vehicle’s current color

  • track (bool) – Whether to track this vehicle within the GUI

plafosim.gui.change_gui_vehicle_color(vid: int, color: tuple)[source]

Change the color of a vehicle in the GUI.

Parameters:
  • vid (int) – The id of the vehicle to change

  • color (tuple) – The color (R, G, B) to use for the vehicle

plafosim.gui.check_and_prepare_gui()[source]

Check and prepare GUI environment.

plafosim.gui.close_gui()[source]

Close the GUI.

plafosim.gui.draw_infrastructures(infrastructures: list, labels: bool)[source]

Draws infrastructures in the GUI.

Parameters:
  • infrastructures (list) – The list of infrastructure objects to add

  • labels (bool) – Whether to draw infrastructure labels

plafosim.gui.draw_ramps(road_length: int, interval: int, labels: bool)[source]

Draws on-/off-ramps in the GUI.

Parameters:
  • road_length (int) – The length of the road in m

  • interval (int) – The ramp interval in m

  • labels (bool) – Whether to draw ramp labels

plafosim.gui.draw_road_end(road_length: int, label: bool)[source]

Draws the end of the road in the GUI.

Parameters:
  • road_length (int) – The length of the road in m

  • label (bool) – Whether to draw a label

plafosim.gui.gui_step(target_step: int, screenshot_filename: str | None = None)[source]

Increases the simulation step in the GUI.

Parameters:
  • target_step (int) – The target simulation step

  • screenshot_filename (str, optional) – The name of the screenshot file

plafosim.gui.move_gui_vehicle(vid: int, position: float, lane: int, speed: float)[source]

Move a vehicle in the GUI.

Parameters:
  • vid (int) – The id of the vehicle to change

  • position (float) – The vehicle’s new position

  • lane (int) – The vehicle’s new lane

  • speed (float) – The vehicle’s new speed

plafosim.gui.prune_vehicles(keep_vids: list)[source]

Prunes vehicles from the GUI.

Parameters:

keep_vids (list) – The ids of the vehicle that should be kept

plafosim.gui.remove_gui_vehicle(vid: int)[source]

Remove a vehicle from the GUI.

Parameters:

vid (int) – The id of the vehicle to remove

plafosim.gui.set_gui_window(road_length: int)[source]

Set the window of the GUI according to the road length.

Parameters:

road_length (int) – The length of the road in m

plafosim.gui.start_gui(config: str, step_length: float, play: bool = True)[source]

Start the GUI.

Parameters:
  • config (str) – The name of the configuration file

  • step_length (float) – The length of one simulation step in s

  • play (bool, optional) – Whether to start the simulation automatically