How to setup multiple distance sensors in PX4/Gazebo SITL

I am building a simulation in Gazebo harmonic on a custom airframe which has 4 lidars. I have the first two sensors in the model’s SDF file with the gz plugin:

`    <plugin filename="gz-sim-sensors-system" name="gz::sim::systems::Sensors">
    </plugin>`

The gz topics get correctly created and published as:

/world/default/model/custom_airframe/link/lidar2_sensor_link/sensor/lidar2/scan
/world/default/model/custom_airframe/link/lidar_sensor_link/sensor/lidar/scan

I have also set distance_sensor to be PublicationMulti in dds_topics.yaml :

`subscriptions_multi:
  - topic: /fmu/in/distance_sensor
    type: px4_msgs::msg::DistanceSensor`

However, I can only get the "/world/default/model/custom_airframe/link/lidar_sensor_link/sensor/lidar/scan/points" gz topic to correctly connect with the PX4 uORB topic distance_sensor.
When looking at the GZBridge.cpp file we can see:

`bool GZBridge::subscribeDistanceSensor(bool required)
{
	std::string lidar_sensor = "/world/" + _world_name + "/model/" + _model_name +
				   "/link/lidar_sensor_link/sensor/lidar/scan";

	if (!_node.Subscribe(lidar_sensor, &GZBridge::laserScantoLidarSensorCallback, this)) {
		PX4_WARN("failed to subscribe to %s", lidar_sensor.c_str());
		return required ? false : true;
	}

	return true;
}`

How can I do have more than one distance_sensor?

You’ll need to change the subscribeDistanceSensor function to look for topics that output gz::msgs::LaserScan that originate from the vehicle model. You’ll have to change the publisher to PublicationMulti and figure out a way to differentiate between instances.

Ok thanks. Before I dive into the changes to the GZBridge, is there a different topic I could use or any other method to populate multiple 1D lidars (rangefinders) sensors in SITL with Gazebo?

Nope, you need to edit the code in GZBridge.cpp