Zum Inhalt springen
Skillpedia
Tests15k · #11102

spawn-vehicles

Was er macht

Dieser Skill fügt einer laufenden CARLA-Straßensimulation Autos hinzu und entfernt sie wieder, wenn du fertig bist. Er richtet sich an Menschen, die selbstfahrende Software bauen oder testen und Verkehr auf der Straße brauchen.

Wann du ihn nutzt

  • ✓Wenn du belebte Straßen mit Autos füllen willst, die selbstständig fahren.
  • ✓Wenn du ein einzelnes Testauto auf die Straße setzen willst, das deine Software steuert.
  • ✓Wenn du die hinzugefügten Autos entfernen willst, damit die Simulation wieder leer ist.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/spawn-vehicles/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Kannst du meiner CARLA-Straßensimulation 40 selbstfahrende Autos hinzufügen und sie entfernen, wenn ich fertig bin?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent setzt Autos an die Spawn-Punkte der Karte und übergibt jedes an das Verkehrssystem, das es auf den Straßen fahren lässt. Beim Entfernen werden diese Autos aus der Simulation gelöscht.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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 --
Häufige Fragen

Kann ich wählen, welche Autos erscheinen?

Ja. Der Skill kann die Automodelle filtern, sodass du bestimmte Typen statt zufälliger wählst.

Funktioniert das mit einem langsamen oder instabilen Simulator?

Der Skill setzt den Simulator in den schrittweisen Modus, den das Verkehrssystem für zuverlässiges Fahren braucht.

Kann ich ein bestimmtes Auto statt Verkehr platzieren?

Ja. Ein einzelnes Hero- oder Ego-Fahrzeug kann platziert und für die ROS-2-Ausgabe benannt werden.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
15k
Platz im Ranking
#11102
Lizenz
MIT
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills