Skip to main content

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

動作の流れ

  1. 引数から Import/ レイアウト(fbx / xodr / <package>.json)を一時ディレクトリに生成
  2. その一時ディレクトリをコンテナに read-only マウントし、 コンテナ内で make importmake package を実行
  3. Dist/ に生成された .tar.gz--output に回収

開発

uv run pytest

テストはDockerを必要としません(メタデータ生成・staging・docker引数組み立てを検証)。

リリース (PyPI)

GitHub Actions による自動リリースを備えています(simple_lanelet2 / tier4/splatsim 方式)。

日常的な流れ:

  1. PR を作り、release:major / release:minor / release:patch のいずれか 1つ をラベル付けする
  2. その PR を main にマージする
  3. release.yml が自動で:
    • tools/bump_version.pypyproject.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

carla_map_asset_builder-0.1.0.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

carla_map_asset_builder-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

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

Hashes for carla_map_asset_builder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3373c3c6bc7539078658bd68edbfe2affbdb8fcae00e39816625ff17d76eab96
MD5 2776b803713827d1800770cbadfa05c0
BLAKE2b-256 ce4cace79342b98362f5b5ea8a45a7943501590cefb30ec709021d211266b641

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file carla_map_asset_builder-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for carla_map_asset_builder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fd0a25e2cc9b3be69dbdd7bfcb94416297c5dc7e6e4261246903fd93ec96804
MD5 98bcebac5c0915d6e54fcf60c62a59bc
BLAKE2b-256 cdcf989328c58ed6984e99efd5c000692181f5084cebd9cbe0f6ddc5e356cf5b

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page