Langsung ke konten
Skillpedia
Testing15k Β· #11102

spawn-vehicles

Fungsinya

Skill ini menambahkan mobil ke simulasi jalan CARLA yang sedang berjalan dan menghapusnya saat Anda selesai. Untuk orang yang membangun atau menguji perangkat lunak mengemudi otonom dan membutuhkan lalu lintas di jalan.

Kapan dipakai

  • βœ“Saat Anda ingin jalan yang ramai diisi mobil yang berkeliling sendiri.
  • βœ“Saat Anda membutuhkan satu mobil uji ditempatkan di jalan agar perangkat lunak Anda dapat mengendalikannya.
  • βœ“Saat Anda ingin membersihkan mobil yang Anda tambahkan agar simulasi kosong kembali.

Link skill

https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/spawn-vehicles/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/spawn-vehicles/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBisakah Anda menambahkan 40 mobil yang mengemudi sendiri ke simulasi jalan CARLA saya, lalu menghapusnya saat saya selesai?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent menempatkan mobil di titik spawn peta dan menyerahkan setiap mobil ke sistem lalu lintas, yang mengemudikannya di sepanjang jalan. Menghapus mobil berarti menghapus mobil tersebut dari simulasi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Spawn autopilot vehicles

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.

Populate the roads with self-driving traffic. Vehicles are placed at the map's predefined spawn points and, by default, handed to the Traffic Manager autopilot at spawn time so they drive the road network autonomously. destroy removes them.

spawn and line make the world synchronous. The Traffic Manager is not reliable driving an asynchronous server: it runs its own loop against a server advancing at whatever rate it likes. Measured on 0.10.0, async, 50 autopilot vehicles with the spawning client alive and holding the TM: only 24 were moving, and the actor count decayed on its own β€” 50 vehicles down to 39 and 15 walkers down to 5 over a couple of minutes. With a fixed timestep and the TM in sync, 37 of 50 move and nothing decays. --no-sync keeps the old behaviour.

The TM cannot be driven by another client's tick

The Traffic Manager steps only when the process that created it ticks the world. Measured on 0.10.0: with a camera client owning a 20 Hz clock and this skill attached as an observer, its 40 vehicles never moved at all β€” no error, just a frozen scene. So a held traffic pool and a lock-step frame capture cannot share a world; record the traffic here and replay it into the capture instead ([[read-sensor]] has the recipe).

The clock rule

The world settings are read before anything else happens:

  • asynchronous β€” this client switches it to synchronous (--delta, default 0.05 s = 20 Hz), puts the TM in sync, and becomes the ticker.
  • already synchronous β€” another client owns the clock. This one never calls tick(); it observes with wait_for_tick(). Ticking a world you do not own silently drops commands β€” it is what stopped spawn-walkers' start() from landing.

The previous settings are restored on release, because a synchronous world with nothing ticking does not advance and looks exactly like a hung server. Stop a holder with Ctrl+C, never kill -9: the restore is in a finally.

The Traffic Manager lives in the client process that created it. So a spawn that exits leaves the vehicles registered with a dead TM: they sit at throttle 0.00 for ever, in async and sync. Pass --hold to keep the TM open (Ctrl+C releases it, and the vehicles then coast to a stop). Measured on 0.10.0: without --hold, 0/50 vehicles move; with it, 49/50 move.

The same is true of controller.ai.walker in [[spawn-walkers]] β€” its controllers stop when their client exits β€” so a scene with both wants two resident processes: this one owning the clock, the walker one held as an observer.

Instructions

Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh), clear FAILs
- [ ] Step 2: Spawn N vehicles with --hold (the TM dies with the process without it)
- [ ] Step 3: Verify visually / via the world-data skill; spawn reports its count
- [ ] Step 4: Ctrl+C the held process, then destroy when done

Commands need CARLA_HOST/CARLA_PORT/TM_PORT from scripts/env.sh. Negative coordinates: pass --at with an = (--at=-24,-57,0.6) so the leading minus isn't parsed as a flag.

Step 1: Check prerequisites

bash scripts/check_env.sh

Step 2-4: Spawn / list / destroy

source scripts/env.sh

# 40 vehicles driving around on autopilot β€” --hold keeps the TM (and so the
# driving) alive; without it they spawn, then freeze when this command returns.
# The world is put in sync at 20 Hz and this client ticks it.
python3 scripts/vehicles.py spawn --count 40 --hold

# leave the world asynchronous (the old behaviour; the TM misbehaves)
python3 scripts/vehicles.py spawn --count 40 --hold --no-sync

# a different fixed timestep
python3 scripts/vehicles.py spawn --count 40 --hold --delta 0.033

# four-wheeled cars only, reproducible
python3 scripts/vehicles.py spawn --count 30 --safe --seed 42

# only Teslas, parked (no autopilot)
python3 scripts/vehicles.py spawn --count 10 --filter 'vehicle.tesla.*' --no-autopilot

# 5 vehicles in one lane, 15 m apart, starting near (x,y,z)
python3 scripts/vehicles.py line --at 30,20,0 --count 5 --gap 15
# ...as a static queue (no autopilot), laid behind the point
python3 scripts/vehicles.py line --at 30,20,0 --count 5 --gap 15 --
Pertanyaan umum

Bisakah saya memilih jenis mobil yang muncul?

Bisa. Skill dapat menyaring model mobil yang digunakan, sehingga Anda bisa memilih jenis tertentu alih-alih acak.

Apakah ini berfungsi dengan simulator yang lambat atau tidak stabil?

Skill mengatur simulator ke mode langkah demi langkah, yang dibutuhkan sistem lalu lintas agar berkendara dengan andal.

Bisakah menempatkan satu mobil tertentu alih-alih lalu lintas?

Bisa. Satu kendaraan hero atau ego dapat ditempatkan, dan dapat diberi nama untuk publikasi ROS 2.

Detail

Deskripsi asli dari pembuat

Spawns vehicles on a running CARLA server and destroys them β€” scattered across the map's spawn points on Traffic Manager autopilot, a row queued in a single lane at a fixed spacing, or a single hero/ego vehicle (optionally named for native ROS 2 publishing with --ros-name). Covers blueprint filtering, the atomic autopilot hand-off, and cleanup. Use when the user asks to "spawn vehicles/cars/traffic", "add N cars driving around", "put cars in a lane 15 m apart", "spawn the ego/hero vehicle", or "remove the vehicles".

repo: carla-simulator/carla

Popularitas

Bintang GitHub
15k
Peringkat
#11102
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa