carla-map-asset-builder
Docker内のCARLAを使って、fbx + OpenDRIVE(.xodr) から
CARLAマップパッケージ(.tar.gz)をビルドするCLIツールです。
- 必要なファイル(fbx / xodr)は引数で渡す
- CARLAが読むメタデータJSONは引数から自動生成(ユーザーはJSONを意識しない)
- まずは CARLA 0.9.16 をサポート
前提
アセットのcook(取り込み)にはUnreal Engineを含む
ソースビルド済みのCARLA Dockerイメージが必要です。
公式ランタイムイメージ carlasim/carla:0.9.16 単体ではcookできません。
cook可能なイメージ名を --image で渡してください。
セットアップ
uv sync --extra dev
使い方
uv run carla-asset-builder build \
--fbx path/to/mymap.fbx \
--xodr path/to/mymap.xodr \
--image <cook可能なCARLAビルドイメージ> \
--output ./dist
主なオプション:
| オプション | 説明 |
|---|---|
--fbx |
取り込むマップのfbx (必須) |
--xodr |
対応するOpenDRIVE(.xodr) |
--name |
マップ名 (省略時はfbxのファイル名) |
--package |
パッケージ名 (省略時はマップ名) |
--image |
cook可能なCARLAビルドDockerイメージ (必須) |
--output, -o |
出力先 (デフォルト ./dist) |
--carla-version |
対象CARLAバージョン (デフォルト 0.9.16) |
--carla-root |
コンテナ内のCARLAソースルート (デフォルト /home/carla/carla) |
--use-carla-materials / --no-carla-materials |
CARLA標準マテリアル適用 |
--docker-arg |
docker run への追加引数 (複数可、例 --docker-arg=--gpus=all) |
--dry-run |
dockerを実行せず生成コマンドを表示 |
dry-run で中身を確認
uv run carla-asset-builder build --fbx mymap.fbx --xodr mymap.xodr \
--image carla-build:0.9.16 --dry-run
Python APIとして使う
CLIと同じ操作をPythonから直接呼び出せます。
from carla_map_asset_builder import build_map
artifacts = build_map(
fbx="path/to/mymap.fbx",
xodr="path/to/mymap.xodr", # 省略可
name="mymap", # 省略時はfbxのファイル名
image="carla-build:0.9.16", # cook可能なCARLAビルドイメージ
output_dir="./dist",
dry_run=False,
)
# artifacts: 生成された .tar.gz などのパス一覧 (list[pathlib.Path])
より細かく制御したい場合は BuildRequest を組み立てて build() を呼びます
(複数マップを1パッケージにまとめる等)。
from pathlib import Path
from carla_map_asset_builder import BuildRequest, MapAsset, build
request = BuildRequest(
package_name="my_pkg",
maps=[
MapAsset(name="town01", fbx=Path("town01.fbx"), xodr=Path("town01.xodr")),
MapAsset(name="town02", fbx=Path("town02.fbx"), xodr=Path("town02.xodr")),
],
output_dir=Path("./dist"),
image="carla-build:0.9.16",
carla_version="0.9.16",
)
artifacts = build(request)
公開シンボル: build_map, build, BuildRequest, MapAsset, get_ingestor,
SUPPORTED_CARLA_VERSIONS, DEFAULT_CARLA_VERSION。
動作の流れ
- 引数から
Import/レイアウト(fbx / xodr /<package>.json)を一時ディレクトリに生成 - その一時ディレクトリをコンテナに read-only マウントし、
コンテナ内で
make import→make packageを実行 Dist/に生成された.tar.gzを--outputに回収
開発
uv run pytest
テストはDockerを必要としません(メタデータ生成・staging・docker引数組み立てを検証)。
リリース (PyPI)
GitHub Actions による自動リリースを備えています(simple_lanelet2 / tier4/splatsim 方式)。
日常的な流れ:
- PR を作り、
release:major/release:minor/release:patchのいずれか 1つ をラベル付けする - その PR を
mainにマージする release.ymlが自動で:tools/bump_version.pyでpyproject.tomlと__init__.pyのバージョンを上げるvX.Y.Zタグを打って GitHub Release を作成- テスト再実行 → sdist/wheel ビルド → PyPI へ公開
その他の入口:
v*タグを手動 push → そのタグを直接ビルド・公開(hotfix 用)workflow_dispatch(手動実行)→ ビルドのみ、公開はしない(リハーサル)
初回のみ必要な PyPI 側設定(Trusted Publishing):
API トークンは使いません。PyPI の Publishing 設定で pending publisher を1度だけ登録します。
| 項目 | 値 |
|---|---|
| owner | hakuturu583 |
| repository | carla_map_asset_builder |
| workflow | release.yml |
| environment | pypi |
この登録が済むまで publish ステップは失敗し、wheel は artifact として残ります (=リポジトリ外の明示的な設定なしには何も PyPI に届かない、という安全な向き)。
拡張
新しいCARLAバージョンをサポートする場合:
src/carla_map_asset_builder/versions/ に Ingestor を継承したクラスを追加し、
versions/__init__.py の _REGISTRY に登録します。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file carla_map_asset_builder-0.1.0.tar.gz.
File metadata
- Download URL: carla_map_asset_builder-0.1.0.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3373c3c6bc7539078658bd68edbfe2affbdb8fcae00e39816625ff17d76eab96
|
|
| MD5 |
2776b803713827d1800770cbadfa05c0
|
|
| BLAKE2b-256 |
ce4cace79342b98362f5b5ea8a45a7943501590cefb30ec709021d211266b641
|
Provenance
The following attestation bundles were made for carla_map_asset_builder-0.1.0.tar.gz:
Publisher:
release.yml on hakuturu583/carla_map_asset_builder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
carla_map_asset_builder-0.1.0.tar.gz -
Subject digest:
3373c3c6bc7539078658bd68edbfe2affbdb8fcae00e39816625ff17d76eab96 - Sigstore transparency entry: 2460659229
- Sigstore integration time:
-
Permalink:
hakuturu583/carla_map_asset_builder@1d61d8f6e91f99d9c9119bf3d13220f86a69ca7d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hakuturu583
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1d61d8f6e91f99d9c9119bf3d13220f86a69ca7d -
Trigger Event:
push
-
Statement type:
File details
Details for the file carla_map_asset_builder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: carla_map_asset_builder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fd0a25e2cc9b3be69dbdd7bfcb94416297c5dc7e6e4261246903fd93ec96804
|
|
| MD5 |
98bcebac5c0915d6e54fcf60c62a59bc
|
|
| BLAKE2b-256 |
cdcf989328c58ed6984e99efd5c000692181f5084cebd9cbe0f6ddc5e356cf5b
|
Provenance
The following attestation bundles were made for carla_map_asset_builder-0.1.0-py3-none-any.whl:
Publisher:
release.yml on hakuturu583/carla_map_asset_builder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
carla_map_asset_builder-0.1.0-py3-none-any.whl -
Subject digest:
5fd0a25e2cc9b3be69dbdd7bfcb94416297c5dc7e6e4261246903fd93ec96804 - Sigstore transparency entry: 2460659695
- Sigstore integration time:
-
Permalink:
hakuturu583/carla_map_asset_builder@1d61d8f6e91f99d9c9119bf3d13220f86a69ca7d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hakuturu583
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1d61d8f6e91f99d9c9119bf3d13220f86a69ca7d -
Trigger Event:
push
-
Statement type: