Aller au contenu
Skillpedia
Agents15k · #11083

write-leaderboard-agent

Ce qu’il fait

La compétence crée un agent de conduite de départ pour le CARLA Leaderboard et vérifie ses capteurs. Elle s'adresse aux développeurs qui écrivent leur propre agent de conduite autonome pour le simulateur.

Quand l’utiliser

  • ✓Quand vous voulez écrire un nouvel agent de conduite pour le CARLA Leaderboard.
  • ✓Quand vous devez choisir une configuration de capteurs qui respecte les limites d'une piste.
  • ✓Quand votre agent ne se charge pas et que le nom de la classe est peut-être faux.

Lien du skill

https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/leaderboard/write-leaderboard-agent/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/leaderboard/write-leaderboard-agent/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Écris un agent de conduite à caméra et lidar pour la piste de capteurs du Leaderboard, avec un fichier de départ fonctionnel.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent génère une classe squelette avec les fonctions de configuration, de capteurs et d'étape, utilise le constructeur adapté à votre version du Leaderboard, et vérifie la configuration des capteurs par rapport aux limites de la piste avant tout essai.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Write a Leaderboard agent

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.

An agent is one Python file with one class. The Leaderboard imports it by path and instantiates it by a name derived from the file name:

module_name = os.path.basename(args.agent).split('.')[0]   # my_agent.py -> my_agent
# ... the evaluator then looks for the TitleCase, underscore-stripped class

so my_agent.py must contain class MyAgent. That is the first thing that goes wrong, and the error is a bare AttributeError.

Instructions

Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh) — confirms the LB version
- [ ] Step 2: Generate the skeleton for your track and version
- [ ] Step 3: Declare sensors inside the budget; validate offline
- [ ] Step 4: Implement run_step
- [ ] Step 5: Smoke-test on routes_devtest.xml

Step 2: Skeleton

source scripts/env.sh

python3 scripts/agent_tools.py scaffold --name MyAgent --track SENSORS --out ~/team_code
python3 scripts/agent_tools.py scaffold --name MyMapAgent --track MAP --out ~/team_code

The scaffold reads the detected leaderboard version and emits the correct constructor for it — this is the one hard API break between 1.0 and 2.x:

# 1.0 — the base class calls setup() from __init__
def __init__(self, path_to_conf_file): ...

# 2.0 / 2.1 — the evaluator constructs, then calls setup() itself
def __init__(self, carla_host, carla_port, debug=False): ...

A 1.0 agent run under a 2.x evaluator receives a host string where it expects a config path. If you override __init__ at all, match the version; if you do not override it, both work.

Step 3: Sensors

def sensors(self):
    return [
        {'type': 'sensor.camera.rgb', 'id': 'Center',
         'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0,
         'width': 800, 'height': 600, 'fov': 100},
        {'type': 'sensor.lidar.ray_cast', 'id': 'LIDAR',
         'x': 0.7, 'y': 0.0, 'z': 1.60, 'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0},
        {'type': 'sensor.other.imu',  'id': 'IMU', 'x': 0.7, 'y': 0.0, 'z': 1.60,
         'roll': 0.0, 'pitch': 0.0, 'yaw': 0.0},
        {'type': 'sensor.other.gnss', 'id': 'GPS', 'x': 0.7, 'y': -0.4, 'z': 1.60},
        {'type': 'sensor.speedometer', 'id': 'Speed'},
    ]
python3 scripts/agent_tools.py validate --agent ~/team_code/my_agent.py --track SENSORS

validate runs the actual validate_sensor_configuration() from your checkout, so it enforces the real budget for your version and track rather than a copy of it. Budgets (2.0/2.1; qualifier tracks halve them, and match 1.0's):

Sensor SENSORS / MAP *_QUALIFIER and LB 1.0
sensor.camera.rgb 8 4
sensor.lidar.ray_cast 2 1
sensor.other.radar 4 2
sensor.other.gnss 1 1
sensor.other.imu 1 1
sensor.speedometer 1 1
sensor.opendrive_map 1 (MAP tracks only) 1

Three constraints beyond the counts:

  • Every id must be unique — duplicates are rejected outright.
  • Mount radius ≤ 3.0 m from the ego origin: sqrt(x²+y²+z²) > 3.0 is rejected.
  • sensor.opendrive_map on a SENSORS track is rejected, which is the entire difference between the SENSORS and MAP tracks.

You do not control sensor attributes except camera resolution/fov and the mount. agent_wrapper.py hard-codes the rest: lidar is always 64 channels, 85 m range, 10 Hz, 600k points/s with fixed dropoff; radar 1500 points, 100 m; GNSS and IMU noise are fixed. Setting range or channels in your sensor dict is silently ignored. That is deliberate — it is what makes submissions comparable.

Step 4: run_step

def run_step(self, input_data, timestamp):
    # input_data is {id: (frame, data)} for every sensor in sensors()
    frame, img = input_data['Center']          # numpy BGRA, (height, width, 4)
    _, gnss    = input_data['GPS']            # [lat, lon, alt]
    _, imu     = input_data['IMU']            # [ax, ay, az, gx, gy, gz, compass]
    _, speed   = input_data['Speed']          # {'speed': m/s}

    control = carla.VehicleControl()
    control.steer, control.throttle, control.brake = 0.0, 0.5, 0.0
    return control
  • Return a `carla.VehicleContro
Questions fréquentes

Pourquoi mon agent ne se charge-t-il pas ?

Le nom du fichier doit correspondre au nom de la classe : my_agent.py doit donc contenir une classe nommée MyAgent.

Les versions du Leaderboard utilisent-elles le même constructeur ?

Non. Les versions 1.0 et 2.x diffèrent, donc la compétence génère celui qui correspond à votre version.

Couvre-t-elle ROS ?

Oui. Elle couvre les classes de base d'agent pour ROS 1 et ROS 2.

Détails

Description originale de l’auteur

Writes an autonomous agent for the CARLA Leaderboard — an AutonomousAgent subclass with setup/sensors/run_step/destroy, a sensor suite inside the track's budget, and the right constructor signature for the leaderboard version (1.0 and 2.x differ). Generates a working skeleton, validates the sensor configuration against the real per-track limits offline, and covers the ROS1/ROS2 agent base classes. Use when the user asks to "write a leaderboard agent", "make my agent work with the leaderboard", "add sensors to my agent", "port my agent to 2.1", or hits SensorConfigurationInvalid.

repo: carla-simulator/carla

Popularité

Étoiles GitHub
15k
Position au classement
#11083
Licence
MIT
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires