跳到正文
cccskills
免费在 GitHub 公开

import-carla-vehicle

Import a four-wheel FBX vehicle into a CARLA source build, configure its physics, wheels, and animation, and register it for the Python API. Verify that the resulting vehicle can spawn, drive, and steer.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Imports an FBX vehicle into a CARLA source build as a spawnable vehicle.<make>.<model> — checks the FBX carries CARLA's 4-wheel bone rig, imports the mesh, then assembles the vehicle through CarlaTools' VehicleAuthoringLibrary (physics asset with kinematic wheel bodies, retargeted anim blueprint, four configured wheel blueprints, the vehicle blueprint), registers it in VehicleFactory through CARLA's own add_vehicle_to_vehicle_factory.py, and verifies it spawns, drives and steers. Use when the user asks to "add a car/truck/van to CARLA", "import a vehicle FBX", or needs a custom drivable vehicle spawnable from the Python API.

实测评分 未实测

查看安装方法

适用场景

  • Importing a custom van or truck into CARLA
  • Registering a vehicle for spawning through the Python API
  • Checking why an imported vehicle will not drive or steer
  • Creating vehicle assets now and registering them later

包含的文件(8)

  • SKILL.md12.9 KB
  • references/vehicle_import.md12.9 KB
  • scripts/check_env.sh6.8 KB
  • scripts/check_input.py7.5 KB
  • scripts/editor/build_vehicle.py16.8 KB
  • scripts/env.sh5.0 KB
  • scripts/import_vehicle.py20.2 KB
  • scripts/verify_vehicle.py7.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Import a vehicle into CARLA

Paths. scripts/… and references/… below are relative to the directory holding this SKILL.md. Your working directory is the user's project, not that directory, so prefix them with its absolute path or the command is not found.

python3 scripts/import_vehicle.py ~/models/SK_MyVan.fbx \
    --make ford --model transit --base-type truck --generation 3 --wheel-radius 40

The FBX must be a skeletal mesh whose wheels are bones named Wheel_Front_Left, Wheel_Front_Right, Wheel_Rear_Left, Wheel_Rear_Right. PhysX's PxVehicleDrive4W finds wheels by those exact names — the physics bodies, the WheelSetups and the animation blueprint all address them — so the rig is checked before anything boots.

The result spawns and drives like any native CARLA vehicle:

bp = bp_lib.find('vehicle.ford.transit')
car = world.spawn_actor(bp, world.get_map().get_spawn_points()[0])
car.apply_control(carla.VehicleControl(throttle=0.6, steer=0.2))

Pipeline, schema and constraints: references/vehicle_import.md.

Instructions

Vehicle Import Progress:
- [ ] Step 0: ASK THE USER for make, model, base type, generation and wheel radius
- [ ] Step 1: Check the INPUT FILE first — format, skinned, rig, textures
- [ ] Step 2: Check prerequisites — hand off to build-carla-ue4 on a build FAIL
- [ ] Step 3: Import — boot 1 assembles the vehicle, boot 2 registers it
- [ ] Step 4: Verify it spawns, drives and steers on a running server

Step 0: Ask the user for the attributes

Do this before anything else, every time. Do not infer them from the file name.

askvalueswhy it must be asked
makee.g. ford, tesla, carlafirst half of the blueprint id
modele.g. transit, model3second half of the blueprint id
base typecar / truck / van / bus / motorcycle / bicycleTraffic Manager and most example scripts filter on it
generation1 / 2 / 3asset generation the attribute claims
wheel radiuscentimetresPhysX sizes the suspension from it and nothing in the mesh states it

Optional and worth offering: --wheel-width (defaults to 45% of the radius), --wheel-mass, --steer-angle (default 70°), --special-type (electric, emergency, taxi), --has-lights, --object-type.

Wheel radius is the one number with physical consequences: too small and the car sits in the road, too large and it bounces. Measure it in the authoring scene; failing that, a normal car's wheel diameter is roughly a third of its total height.

Step 1: Check the input file — ALWAYS FIRST

python3 scripts/check_input.py ~/models/SK_MyCar.fbx

Expected input, in one place:

requirementdetail
formatFBX, binary or ASCII. Nothing else is importable — .ma, .mb, .blend, .max, .c4d, .obj, USD, glTF, COLLADA all fail here
kinda skinned/skeletal mesh whose wheels are BONES. A rigid body is a prop, not a vehicle
rigthe four canonical wheel bones: Wheel_Front_Left, Wheel_Front_Right, Wheel_Rear_Left, Wheel_Rear_Right, plus a chassis bone (Vehicle_Base by convention; otherwise inferred)
texturesembedded (FBX export option "Embed Media") or texture files beside the FBX. Absolute paths from the author's machine resolve nowhere
contentsone vehicle per file; animation is not needed and is not imported
unitsauthored in cm or m — the importer converts scene units
known separatelythe wheel radius in cm. It is not in the file and PhysX sizes the suspension from it

Exit codes: 0 usable, 1 wheel bones missing, 2 unusable (wrong format, or not skinned).

[input] SK_Ambulance_export.fbx  2493 KB
[input] PASS  binary FBX
[input] PASS  skinned
[input] PASS  all 4 wheel bones present

Extra bones beyond the wheels and chassis are fine — doors, steering wheel, suspension helpers all pass. The texture line is a warning, never fatal.

import_vehicle.py runs this itself and refuses on a 1 or 2.

Step 2: Check prerequisites

bash scripts/check_env.sh

Beyond a runnable editor this checks the things no step here can create: CarlaTools built with VehicleAuthoringLibrary (hard blocker — see C4), add_vehicle_to_vehicle_factory.py, the donor vehicle blueprint, its four donor wheel blueprints, the donor anim blueprint, and that VehicleFactory has its Vehicles member.

This skill never builds. On a FAIL naming UE4, CarlaUE4Editor or CarlaTools, stop and run [[build-carla-ue4]] against that checkout.

Step 3: Import

python3 scripts/import_vehicle.py ~/models/SK_MyVan.fbx \
    --make ford --model transit --base-type truck --generation 3 --wheel-radius 40

Assembly is done by CarlaTools' VehicleAuthoringLibrary, one library call per step, so the skill never reimplements PhysX wheel setup:

steplibrary functionwhat it produces
physicsSetupVehiclePhysicsAssetconvex chassis (simulated) + KINEMATIC spheres on the four wheel bones
animationCreateVehicleAnimBPa retargeted copy of a template anim blueprint
wheelsConfigureWheel ×4four duplicated wheel blueprints; front pair steers, rear pair takes the handbrake
vehicleCreateVehicleBlueprintduplicated donor BP with mesh, anim class and WheelSetups repointed

Reported per run:

[vehicle] mesh       /Game/Carla/Static/Vehicles/TestAmbulance/SK_TestAmbulance...
[vehicle] size       6.37 x 2.35 x 2.43 m
[vehicle] physics    .../SK_TestAmbulance_PhysicsAsset
[vehicle] anim BP    .../AnimBP_TestAmbulance
[vehicle] wheel      Wheel_Front_Left: BP_TestAmbulance_FLW  steers=True
[vehicle] blueprint  /Game/Carla/Blueprints/Vehicles/TestAmbulance/BP_TestAmbulance
[vehicle] CDO mesh   .../SK_TestAmbulance      <- read back, not assumed

The CDO mesh line matters: the mesh lives on an inherited native component, and a recompile would silently revert it to None (C1), so the importer reads it back.

Other flags:

flagwhy
--nameasset name; defaults to the FBX stem
--donordonor vehicle blueprint to duplicate (default BP_Ambulance)
--donor-anim-bpanim blueprint template to retarget
--wheel-width, --wheel-mass, --steer-anglewheel tuning
--object-type, --special-type, --has-lightsextra FVehicleParameters fields
--meshnominate one mesh when a multi-mesh FBX yields several
--no-registerbuild the assets, leave VehicleFactory alone (not spawnable)
--register-onlyregister an already-built blueprint
--skip-input-checkimport without the canonical wheel bones (it will not drive)
--verbosestream the editor log

The two boots

Both are full editor sessions, not the fast commandlet. CreateVehicleAnimBP retargets animations, and UE's retarget path syncs the Content Browser, which builds a Slate window — in a commandlet that asserts and takes the process down mid-assembly (C6). Registration needs a full editor anyway, to compile the factory blueprint.

Boot 2 runs CARLA's own script, which ships with CARLA and is runnable by hand:

Unreal/CarlaUE4/Plugins/CarlaTools/Content/Python/add_vehicle_to_vehicle_factory.py

It appends an FVehicleParameters to VehicleFactory.Vehicles and saves. The skill supplies its arguments and confirms the factory package changed on disk.

Step 4: Verify

Vehicles need a running server. Assume one is already up — do not start one; if the connection fails, say so and let the user start it. A server keeps content from its startup, so it must be restarted after an import for a pass to mean anything.

python3 scripts/verify_vehicle.py --id vehicle.ford.transit

Five checks, because each catches a different way an import looks fine and is not:

checkwhat it catches
in the library and spawnsa missing factory entry, an unloadable mesh
registered attributesa wrong base_type / generation reaching the library
get_physics_control() reports 4 wheelswheel setups or physics bodies wrong
drives ≥ 3 m at full throttlesimulated (not kinematic) wheel bodies — the classic frozen car
heading changes under full steerfront wheels bound to the wrong bones

--keep leaves the vehicle in the world to look at.

Examples

Example 1: a van

User says: "add this van FBX to CARLA"

# step 0: ask make / model / base type / generation / wheel radius first
bash scripts/check_env.sh
python3 scripts/import_vehicle.py ~/models/SK_MyVan.fbx \
    --make ford --model transit --base-type van --generation 3 --wheel-radius 38
python3 scripts/verify_vehicle.py --id vehicle.ford.transit   # after a server restart

Example 2: an emergency vehicle with lights

python3 scripts/import_vehicle.py ~/models/SK_Ambulance.fbx \
    --make carla --model ambulance2 --base-type truck --generation 3 \
    --wheel-radius 40 --special-type emergency --has-lights

Example 3: build now, register later

python3 scripts/import_vehicle.py ~/models/SK_Prototype.fbx \
    --make acme --model proto --base-type car --generation 3 \
    --wheel-radius 35 --no-register
# later
python3 scripts/import_vehicle.py ~/models/SK_Prototype.fbx --register-only \
    --name SK_Prototype --make acme --model proto --base-type car \
    --generation 3 --wheel-radius 35

Troubleshooting

does not carry CARLA's 4-wheeled rig / missing wheel bones Cause: the FBX's joints are not named as PhysX expects. Solution: rename them in the authoring scene and re-export. --skip-input-check imports anyway and produces a car that cannot drive.

no skin cluster — a CARLA vehicle is a SKELETAL mesh Cause: a rigid-body FBX. Solution: the wheels must be bones. A static mesh belongs to [[import-carla-prop]].

CarlaTools does not expose VehicleAuthoringLibrary Cause: CarlaTools predates CARLA PR #9805. Solution: rebuild CarlaTools against a checkout that has it (C4). There is no fallback: building wheel bodies from editor Python is not a reasonable substitute.

SetupVehiclePhysicsAsset failed Cause: the wheel bones exist in the FBX but not in the imported skeleton, or the mesh has no skinned geometry to hull. Solution: check the reported skeleton, then re-export with skinning intact.

the vehicle blueprint's CDO has no SkeletalMesh Cause: the native-component override did not persist — what a recompile after writing the CDO produces (C1). Solution: re-import; never recompile the assembled blueprint.

Vehicle spawns but will not move at full throttle Cause: wheel bodies simulated instead of kinematic, or no bodies on the wheel bones (C2). Solution: re-import so SetupVehiclePhysicsAsset rebuilds them; check the wheel radius is sane.

Vehicle drives but will not steer Cause: the front wheel blueprints have no steer angle, or the wheel order does not match the bone order (C3). Solution: re-import; --steer-angle sets the angle.

Vehicle sits in the road, or bounces Cause: --wheel-radius does not match the mesh (C2). Solution: measure the wheel and re-import.

Vehicle renders untextured Cause: the FBX embeds no textures, so each slot got a blank material (C5). Solution: re-export with Embed Media, or supply the texture files.

Outputs

  • Content/Carla/Static/Vehicles/<Name>/ — SK_<Name>, its skeleton, <Name>_PhysicsAsset, AnimBP_<Name>, and the FBX's materials.
  • Content/Carla/Blueprints/Vehicles/<Name>/BP_<Name>.uasset — the spawnable vehicle.
  • …/BP_<Name>_{FLW,FRW,RLW,RRW}.uasset — the four configured wheel blueprints.
  • Content/Carla/Blueprints/Vehicles/VehicleFactory.uasset — the entry that makes it spawnable as vehicle.<make>.<model>; untouched with --no-register.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Add a message type to CARLA's native ROS 2 interface. Create its C++ data structure, serialization code for transmission, type identity hash, registration, and tests, with Docker-based hash calculation and build checks.

中文简介正在准备中。当前显示英语简介。

  • Adding a standard ROS 2 message type missing from CARLA
  • Defining a custom carla_msgs message
  • Investigating type-hash warnings
carla-simulator/carla1.5万2026年10月23日 更新

Extend CARLA’s native ROS 2 interface to publish sensor data or receive vehicle commands. Covers topic implementation, registration, data connections, and verification, plus adding middleware, the communication layer used to exchange messages.

中文简介正在准备中。当前显示英语简介。

  • Publish obstacle sensor data to ROS 2
  • Add a topic for vehicle speed commands
  • Integrate another communication middleware
carla-simulator/carla1.5万2026年10月23日 更新

Summarize ScenarioRunner results to see which scenarios passed and which checks failed. Compare runs before and after changes, or analyze recorded driving to produce measurements and plots of vehicle distance and deviation from the lane center.

中文简介正在准备中。当前显示英语简介。

  • Checking scenario pass and fail results
  • Comparing results before and after controller changes
  • Plotting vehicle distances from a recorded run
carla-simulator/carla1.5万2026年10月23日 更新

Checks a local CARLA checkout for missing API documentation, outdated references, broken links, and pages absent from navigation. Produces a grouped Markdown report without building the project or running the simulator.

中文简介正在准备中。当前显示英语简介。

  • Reviewing documentation before a release
  • Finding missing or outdated API references
  • Checking broken links and navigation gaps
carla-simulator/carla1.5万2026年10月23日 更新

Read and display CARLA object bounding boxes, then project them onto a camera image as 2D rectangles. Export an annotated PNG and box coordinates in JSON for object detection annotation work.

中文简介正在准备中。当前显示英语简介。

  • Adding vehicle boxes to a camera image
  • Exporting box coordinates for detection annotations
  • Checking vehicle dimensions
carla-simulator/carla1.5万2026年10月23日 更新

Builds CARLA's ue4-dev branch on Linux, producing the Unreal Engine 4.26 editor, server modules, and an installed Python client package. Fetches required content, optionally compiles native ROS 2 support, and verifies the build against a source-built server.

中文简介正在准备中。当前显示英语简介。

  • Building CARLA ue4-dev from source
  • Compiling CARLA with native ROS 2 support
  • Building the Python client for an existing environment
carla-simulator/carla1.5万2026年10月23日 更新

查看 carla-simulator 的全部技能

报告此技能的问题