Skip to content
Skillpedia
Misc15k Β· #11090

create-sensor

What it does

The skill places sensors on a vehicle or other actor in a CARLA simulation. It is for developers collecting sensor data for autonomous driving tests.

When to use it

  • βœ“When you want a camera, lidar, or other sensor on a simulated car.
  • βœ“When you want to set a sensor's position, resolution, or update rate.
  • βœ“When you want a sensor to publish its data to ROS 2.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/create-sensor/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œAdd an 800 by 600 front camera to the ego car and a roof lidar, then give me their IDs.”

5 new skills a week. 1 minute to read.

How it works

The agent spawns the sensor blueprint, attaches it to the chosen actor with a mount position, and sets attributes such as resolution, field of view, and update rate. It prints the sensor's id so you can read it later.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Create a sensor

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.

Spawn a sensor and (usually) attach it to a vehicle so it moves with it. The sensor persists as an actor; its id is printed so the read-sensor skill can save or display its data. This skill is placement/lifecycle only β€” reading is the other skill.

Instructions

Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh), clear FAILs
- [ ] Step 2: Have a parent actor if attaching (spawn-vehicles ego)
- [ ] Step 3: Spawn the sensor with a type, mount transform, and attributes
- [ ] Step 4: Note the printed id; read it with read-sensor; destroy when done

Commands need CARLA_HOST/CARLA_PORT from scripts/env.sh.

Step 1: Check prerequisites

bash scripts/check_env.sh

Step 3: Spawn

source scripts/env.sh

python3 scripts/sensors.py types                     # list sensor blueprints

# an 800x600 dashcam on the ego (default mount x=1.5, z=2.4)
python3 scripts/sensors.py spawn --type camera.rgb --attach-to hero \
    --attr image_size_x=800 --attr image_size_y=600 --attr fov=90

# a lidar on the ego roof
python3 scripts/sensors.py spawn --type lidar.ray_cast --attach-to hero --z 2.5 \
    --attr range=50 --attr points_per_second=200000 --attr rotation_frequency=20

# a depth camera; a GNSS; a collision sensor
python3 scripts/sensors.py spawn --type camera.depth --attach-to hero
python3 scripts/sensors.py spawn --type other.gnss --attach-to hero
python3 scripts/sensors.py spawn --type other.collision --attach-to hero

python3 scripts/sensors.py destroy                   # remove all sensors

# turn ROS publishing on for sensors that already exist
python3 scripts/sensors.py ros --id 123
python3 scripts/sensors.py ros --filter 'sensor.camera.*' --disable

--attach-to <role> attaches to that vehicle (ego = hero); --parent-id N attaches to any actor; omit both for a world-fixed sensor. --attachment SpringArm gives a smooth chase mount. Repeat --attr key=value for blueprint attributes.

Publishing to ROS 2

Only meaningful on a server started with --ros2 ([[run-carla-server]] ROS2=1).

# a lidar that publishes on rt/carla/hero/lidar/point_cloud
python3 scripts/sensors.py spawn --type lidar.ray_cast --attach-to hero --z 2.4 \
    --ros --ros-name lidar
# a camera with its own TF frame and no transform broadcast
python3 scripts/sensors.py spawn --type camera.rgb --attach-to hero \
    --ros --ros-name front --ros-frame-id front_cam --no-ros-tf

--ros is not optional decoration β€” without it the sensor publishes nothing. A CARLA sensor is only ticked while something listens to its stream (ASensor::Tick returns early otherwise), and enable_for_ros() is what marks the stream as listened-to without a Python client. --ros-name/--ros-frame-id/ --no-ros-tf set the ros_name / ros_frame_id / ros_publish_tf blueprint attributes, which the server reads once at registration: they cannot be changed after spawn.

Topic layout (spawn prints the exact list):

Sensor Topics under the base name Type
any camera /image, /camera_info sensor_msgs/Image, CameraInfo
camera.dvs /image, /camera_info, /point_cloud + PointCloud2
lidar.*, other.radar /point_cloud sensor_msgs/PointCloud2
other.imu (the base name itself) sensor_msgs/Imu
other.gnss (the base name itself) sensor_msgs/NavSatFix
other.collision (the base name itself) carla_msgs/CarlaCollisionEvent
other.lane_invasion, other.obstacle, other.rss none β€” no native publisher exists β€”

Base name is rt/carla/<ros_name>, nested as rt/carla/<parent ros_name>/<ros_name> when attached; unnamed sensors become actor<id>. Transforms go to the single rt/tf topic, parented to the attach parent's frame (or map).

All of this is verified against a live server: a lidar spawned as --attach-to hero --ros-name lidar without --ros produced no topic at all; ros --id N made /carla/hero/lidar/point_cloud and /tf appear at once β€” /tf exists only because a sensor publishes, never from the vehicle alone. Two practical notes:

  • Rates follow the tick. With `s
FAQ

Does this skill read the sensor data?

No. It places and manages the sensor, and reading its output is a separate skill.

What is the default mount position?

The default is 1.5 meters forward and 2.4 meters up on the vehicle.

How do I see which sensor types exist?

The skill has a types command that lists the sensor blueprints.

Details

Original description by the author

Spawns and attaches sensors on a running CARLA server β€” cameras (rgb/depth/semantic/instance/optical-flow/normals), lidar, radar, IMU, GNSS, collision/lane-invasion/obstacle β€” to the ego or any actor, with a mount transform and blueprint attributes (resolution, fov, sensor_tick, lidar range/points, …). Also sets up native ROS 2 publishing (--ros to enable_for_ros, --ros-name/--ros-frame-id topic and TF naming) and prints the topics the sensor will publish. Use when the user asks to "add a camera/lidar/sensor", "put a dashcam on the ego", "attach a depth camera", "mount a sensor", or "publish a

repo: carla-simulator/carla

Popularity

GitHub stars
15k
Ranking position
#11090
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills