Modules
RunOhmUXSim
SoundCARLA Master Launcher
This module provides a graphical user interface (Tkinter) to control the entire SoundCARLA simulation environment. It acts as an orchestrator, launching the CARLA simulator, client scripts, the FMOD audio engine, and traffic managers within their respective virtual environments.
- Key Features:
Configuration management via ‘sim_config.json’.
Dynamic path selection for various Python interpreters (venvs).
Automated startup sequence including port cleanup and server health checks.
Support for rendering options (e.g., DirectX 11).
- class SimulatorGUI[source]
Bases:
objectGUI class for managing and launching simulation processes.
This class encapsulates the entire process management logic for the SoundCARLA environment. It ensures the CARLA server is fully initialized and reachable before triggering dependent clients, such as the FMOD audio engine or manual control scripts.
- config_path
Path to the JSON configuration file (‘sim_config.json’).
- Type:
Path
- dx11_var
Tkinter variable tracking the DirectX 11 rendering preference. If True, the ‘-dx11’ flag is appended to the CARLA launch command.
- Type:
BooleanVar
- MAX_RETRIES = 10
Defines how often the programm retries to connect to the CARLA Simulator
- __init__()[source]
Initializes the GUI window, loads saved paths from config, and constructs the interface components.
- show_main_ui()[source]
Transitions from branding to Main UI seamlessly within the same window handle.
- load_config(defaults)[source]
Loads the simulation configuration from a local JSON file.
Attempts to read ‘sim_config.json’ and merge its contents with the provided default values. If the file does not exist or a parsing error occurs, the method falls back to the defaults to ensure system stability.
- save_config()[source]
Serializes the current application state to the configuration file.
Synchronizes the GUI’s interactive variables (e.g., DirectX 11 preference) with the internal path dictionary before performing an atomic write to ‘sim_config.json’.
- browse_file(key)[source]
Opens a system file dialog to update and persist configuration paths.
This method handles the selection of executables or scripts, updates the internal path dictionary, synchronizes the changes to the ‘sim_config.json’ file, and triggers a UI refresh to reflect the new selection.
- Parameters:
key (str) – The configuration key in self.paths to be updated (e.g., ‘CARLA_SIM’).
- kill_process_on_port(port=2000)[source]
Kills old CARLA servers which might be blocking the port 2000
- Parameters:
port (int, optional) – Specifies the port CARLA server uses. Defaults to 2000.
Note
CARLA uses localhost port 2000 by default. If this is to be modified, all scripts connecting to the server must be adjusted.
- launch_all()[source]
Starts main Thread and calls _run_launch_sequence()
- The sequence follows these stages:
Port Cleanup: Terminates any existing processes on port 2000.
Simulator Start: Launches CARLA with the optional -dx11 flag.
Health Check: Polls the CARLA server until a world connection is established.
Orchestration: Sequentially starts Manual Control, the CARLA Client (cmain.py), FMOD Engine, and Traffic Manager.