Multiple PX4 sitl Gazebo on interacting UAV

Hi, I’m working on multiple interacting UAV in Sitl Gazebo controlled by multiple PX4 (vehicles) in QGC. The issue I’m running into is that the setup is different from the gazebo_sitl_multiple_run example since the UAV need to be connected using joints and controlled by multiple PX4 ports/vehicles in QGC. Currently I’ve created a python script to create an .sdf file including the UAV and joints with different ports for mavlink. So far no succes where the second UAV PX4 terminates the first UAV PX4 start.
Question, would it even be possible to use one .sdf with multiple (nested) UAV and joints controlled by multiple PX4 mavlinks? If so would there be an example or tips to get this to work? Thanks.

@Inonyx As long as the mavlink interface plugin in gazebo is configured to have the right TCP port, it should just work: PX4-SITL_gazebo/iris.sdf.jinja at 1b1afca3440df678167818eaf8e38f301b16bcbd · PX4/PX4-SITL_gazebo · GitHub is basically doing exactly that:

For your use case, you just need to do it manually

Thank you for the response. The you point at as far as I understand creates a new (same) instance and increase the port numbers. And then spawns the instances with a certain position offset. What I don’t if this would also be possible with different (nested) instances and joints with mavlink plugin calls like the following .sdf framework as example:

Mavlink plugin (Port: 4560, Udp port: 14560)
___Drone 2
___Joint Drone1 to Drone2
___Mavlink plugin (Port: 4570, Udp port: 14570)

Or how to achieve something similar.

@Inonyx I am not sure if I understand your question. Do you have a problem when doing what you described?