Saltar al contenido
Skillpedia
Pruebas15 mil · #11102

spawn-vehicles

Qué hace

Esta skill añade coches a una simulación de carreteras de CARLA en marcha y los quita cuando terminas. Está pensada para personas que desarrollan o prueban software de conducción autónoma y necesitan tráfico en la carretera.

Cuándo usarla

  • ✓Cuando quieres carreteras llenas de coches que circulan solos.
  • ✓Cuando necesitas un único coche de prueba en la carretera para que tu software lo controle.
  • ✓Cuando quieres quitar los coches que añadiste para que la simulación quede vacía de nuevo.

Link de la skill

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

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/spawn-vehicles/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Añade 40 coches autónomos a mi simulación de carreteras de CARLA y quítalos cuando termine.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

El agente coloca los coches en los puntos de aparición del mapa y entrega cada uno al sistema de tráfico, que lo conduce por las carreteras. Quitarlos elimina esos coches de la simulación.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de 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 --
Preguntas frecuentes

¿Puedo elegir qué tipo de coches aparecen?

Sí. La skill puede filtrar qué modelos de coche se usan, para elegir ciertos tipos en lugar de aleatorios.

¿Funciona con un simulador lento o inestable?

La skill pone el simulador en modo paso a paso, que el sistema de tráfico necesita para conducir de forma fiable.

¿Puedo colocar un coche concreto en lugar de tráfico?

Sí. Se puede colocar un único vehículo hero o ego, y se le puede dar un nombre para publicar en ROS 2.

Detalles

Descripción original del autor

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

Popularidad

Estrellas en GitHub
15 mil
Posición en el ranking
#11102
Licencia
MIT
Actualizada
2/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas