Sensors

Sensors are parts fitted into slots, with one exception: the IMU, barometer and magnetometer belong to the airframe itself, as the autopilot carries them on the real vehicle. The slots and their accepted types are in the configuration page, and new sensor parts can be added following the Add a part guide.

Available sensors

Sensor

Part

Slot

Fitted by default

IMU, barometer, magnetometer

the airframe

yes

GPS

gps_mast

gps

yes

Gimbal camera, looking down

gimbal_camera

gimbal

no

Sensors ROS API

Flight sensors

ROS Topic

Description

Message type

/<name>/imu

Body IMU

sensor_msgs/msg/Imu

/<name>/air_pressure

Barometer

sensor_msgs/msg/FluidPressure

/<name>/mag

Magnetometer

sensor_msgs/msg/MagneticField

GPS

ROS Topic

Description

Message type

/<name>/gps/fix

Position fix, 10 Hz, about 1.5 m across and 3 m up

sensor_msgs/msg/NavSatFix

Gimbal camera

Fitted with - {slot: gimbal, type: gimbal_camera}. The head is held looking straight down; the gimbal’s axes are not driven. The landing gear shows at the left and right edges of the image.

ROS Topic

Description

Message type

/<name>/gimbal/image

1280x720 at 30 Hz, 81 degrees across, in <name>/gimbal_lens (+x along the view)

sensor_msgs/msg/Image

/<name>/gimbal/camera_info

Camera intrinsics

sensor_msgs/msg/CameraInfo

The world needs gz-sim-sensors-system and a GPU for the camera; the worlds here run it, and it stays idle while no camera is fitted.

<name> is the instance name, x500 for the default instance, or whatever the quad was spawned as (Several vehicles). A part topic follows the part’s own name (gps above), so a part renamed or removed in the config moves or drops its topics (Configuration).

Sensor messages carry the sensor’s frame under the instance name (<name>/base_link for the flight sensors, <name>/gps_antenna for the GPS), which is the frame robot_state_publisher publishes for the instance.

The PX4 variant

Generated with px4:=true, the model has the same four flight sensors a second time, for PX4 in simulation. They are extra: every topic above is still there.

Gazebo topic

Sensor

/world/<world>/model/<name>/link/base_link/sensor/imu_sensor/imu

IMU, 250 Hz

/world/<world>/model/<name>/link/base_link/sensor/air_pressure_sensor/air_pressure

Barometer, 50 Hz

/world/<world>/model/<name>/link/base_link/sensor/magnetometer_sensor/magnetometer

Magnetometer, 100 Hz

/world/<world>/model/<name>/link/base_link/sensor/navsat_sensor/navsat

GPS, 30 Hz

These are the topics PX4 subscribes to, fixed in its code, and they are not bridged to ROS. The world’s name and the instance’s name are part of each, so a variant is generated for one world and one name. model://x500_with_px4 is for the world x500_px4 and the name x500: use it there, under its own name. Included under another <name>, PX4 cannot hear its sensors and its motors still listen on /x500/..., with no error. For another world or name, generate one:

ros2 run x500_gazebo configure_vehicle.py \
  --config "$(ros2 pkg prefix --share x500_description)"/config/x500.yaml \
  --px4 --world my_world.sdf --out-dir $HOME/my_x500

--world takes a world’s name or its SDF file, and --name gives the instance a name of its own.