Skip to content

Generate CARLA blueprints dynamically#401

Merged
dfremont merged 7 commits intoBerkeleyLearnVerify:mainfrom
lola831:dynamic-carla-blueprints
Mar 31, 2026
Merged

Generate CARLA blueprints dynamically#401
dfremont merged 7 commits intoBerkeleyLearnVerify:mainfrom
lola831:dynamic-carla-blueprints

Conversation

@lola831
Copy link
Copy Markdown
Collaborator

@lola831 lola831 commented Oct 21, 2025

Description

This PR generates CARLA blueprints dynamically (per CARLA version).

-snapshot_blueprints.py: connects to CARLA, collects blueprint IDs and bounding-box dimensions for the running server version, categorizes them for Scenic, and writes tools/carla/snapshots/blueprints_<VERSION>.json.

-make_blueprints.py: reads all snapshot JSONs, sorts/normalizes them, and regenerates src/scenic/simulators/carla/blueprints.py.

-Generated blueprints.py: selects the best-matching snapshot for the installed CARLA version and exposes ids, dims, and helper functions.

-Handles versions that lack certain categories (e.g., CARLA 0.10.0 has no bicycles).

-Uses measured dimensions when available; otherwise falls back to defaults.

-Adds vanModels and busModels categories based on CARLA’s base_type.

Issue Link

N/A

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

N/A

@lola831 lola831 requested a review from dfremont October 21, 2025 14:56
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.65%. Comparing base (cbc265d) to head (f6a139a).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #401      +/-   ##
==========================================
- Coverage   89.70%   89.65%   -0.06%     
==========================================
  Files          48       48              
  Lines       13190    13190              
==========================================
- Hits        11832    11825       -7     
- Misses       1358     1365       +7     

see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@dfremont dfremont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general. Besides some minor comments above, my only suggestion is that since blueprints.py is now very long and difficult to read, let's try splitting it into two files. The non-autogenerated part can stay in blueprints.py, but let's move the giant _IDS and _DIMS dictionaries into a separate _blueprintData.py module and then do from _blueprintData import _IDS, _DIMS. The make_blueprints.py script can then just generate _blueprintData.py.

@lola831
Copy link
Copy Markdown
Collaborator Author

lola831 commented Mar 5, 2026

@dfremont Thanks for the review. I split out _IDS / _DIMS into _blueprintData.py and left helpers in blueprints.py as suggested. Also addressed all the other review comments in the latest commits.

@lola831 lola831 requested a review from Eric-Vin March 5, 2026 01:26
Copy link
Copy Markdown
Collaborator

@dfremont dfremont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks Lola!

@dfremont dfremont merged commit 164ad62 into BerkeleyLearnVerify:main Mar 31, 2026
31 checks passed
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.

2 participants