Skip to content

CARLA usability fixes (HUD, cleanup, substepping) + Ubuntu/2D defaults#462

Open
servinar wants to merge 5 commits intoBerkeleyLearnVerify:mainfrom
servinar:bugfixes
Open

CARLA usability fixes (HUD, cleanup, substepping) + Ubuntu/2D defaults#462
servinar wants to merge 5 commits intoBerkeleyLearnVerify:mainfrom
servinar:bugfixes

Conversation

@servinar
Copy link
Copy Markdown

@servinar servinar commented May 5, 2026

Description

A bundle of small CARLA-related fixes plus one opinionated default change. Each commit is self-contained — happy to drop or split out individual ones if preferred.

Bug fixes:

  • Allow Ubuntu's apport_python_hook in the excepthook check — On Ubuntu's system Python, apport_python_hook is installed as the default excepthook, which previously caused Scenic to warn and skip installing its own backtrace formatter. Treating it the same as exceptiongroup lets Scenic backtraces format correctly out of the box.
  • Wire up HUD tick() and render() in the CARLA simulator — CarlaSimulation constructed a visuals.HUD but never called tick() or render(), leaving the panel permanently blank. Register on_world_tick for FPS counting and call hud.tick() and hud.render() each step alongside the camera render.
  • Clean up residual CARLA actors before each simulation — When a previous simulation crashed or was interrupted, leftover walkers / vehicles / sensors could remain in the world and affect the next run. New _cleanupWorld() destroys leftovers at the start of createSimulation().
  • Enable CARLA physics substepping — Sets substepping = True, max_substep_delta_time = 0.01, max_substeps = 10 (the configuration recommended by CARLA's docs for synchronous mode). Reduces tunnelling and improves collision behavior at higher speeds.

Opinionated default (open to discussion):

  • Default --2d and mode2D to True. In our usage, the simulator integrations we work with require 2D compatibility mode anyway, so flipping the default removes the need to specify --2d on every invocation. Fully open to dropping this commit if the project would rather keep the existing 3D default.

Issue Link

N/A — issues encountered during development of CARLA-based driving scenarios.

Checklist

  • I have tested the changes locally via pytest and/or other means
  • I have added or updated relevant documentation
  • I have autoformatted the code with black and isort
  • I have added test cases (if applicable)

Additional Notes

The HUD wiring and the auto-cleanup of residual actors were verified end-to-end against a running CARLA server (Town01, ego rear-ended a stopped vehicle). The Ubuntu backtrace fix mirrors the existing exceptiongroup handling.

servinar added 5 commits May 5, 2026 20:09
Ubuntu's apport_python_hook installs an excepthook on system Python by
default, which previously triggered a warning and prevented Scenic from
formatting its backtraces on Ubuntu. Treat it the same as exceptiongroup
and allow overwriting it.
The HUD object was constructed but never updated or rendered, leaving
it permanently blank. Register the HUD's on_world_tick callback so the
server FPS counter and frame number stay current, and call hud.tick()
and hud.render() each step alongside the camera render.
When a previous simulation crashed or left actors behind in the CARLA
world, the next run could see stale walkers, vehicles, controllers, or
sensors and behave unpredictably. Add _cleanupWorld() which destroys
any leftover actors and call it at the start of createSimulation().
CARLA's physics integrator can become unstable at the default
fixed_delta_seconds when objects move quickly, leading to tunnelling
and incorrect collision behavior. Enable substepping with a 10ms cap
on substep delta and up to 10 substeps per tick, the configuration
recommended by CARLA's docs for synchronous mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant