Multiple drone simulation gazebo GCS port

Hi i’m pretty new with multiple vehicle simulation in the gazebo (no ROS). so I have a question, if I ran multiple vehicles do I need to separate GCS port for each instance like 14550 and 14550 + instance?
In my case if I run
Tools/simulation/gazebo-classic/sitl_multiple_run1.sh -t px4_sitl_default -s iris:1,plane:1 -n 2
by by default, it seems all traffic goes out to port 14550.

if i simulate 2 vehicles and open QGC in same local machine, QGC will auto-connect to the vehicle (I guess UDP 14550). but if I want to connect to the simulation from another Machine same lan, I used mavlink-router to forward data from port 14550 to another port i.e 14552 and connect QGC in that machine. but now the simulation not work as expected

first error when I upload the plan. after a few attempts I able to upload

@JulianOes have you ever got a problem like that? i used the latest px4 version and gazebo-classic

Simulation without ROS on Gazebo classic is covered in Multi-Vehicle Simulation with Gazebo Classic | PX4 Guide (main)

The docs indicate:

Each vehicle instance is allocated a unique MAVLink system id (2, 3, 4, etc.). MAVLink system id 1 is skipped in order to have consistency among namespaces. Vehicle instances are accessed from sequentially allocated PX4 remote UDP ports: 14541 - 14548 (additional instances are all accessed using the same remote UDP port: 14549 ).

Looking at those IDs I think that those are links for a companion computer to connect to, NOT a GCS. I suspect that the GCS expects all instances to be on 14550. That would make sense for testing via QGC so you don’t have to set up multiple connections?

@Jaeyoung-Lim Can you advise? Specifically, if you have multi-vehicle sim in Gazebo are there separate ports for companion and GCS? For GCS do you have “multiple UDP ports” too? How is this expected to work?

1 Like

because i want to connect GCS in other machine so that i have to forward mavlink data to other IP address use mavlink-routed. however the message seem dropped frequently

so that’s why i was thinking about separate ports for companion and GCS. i changed

to mavlink start -x -u $udp_gcs_port_local -r 4000000 -f -o $((14551+px4_instance))

and update the typhoon_h480.sdf and plane.sdf file
image

Not an expert, but I don’t think you need to do this to connect GCS to another machine on same network.

In QGC “Applications Settings” > Comms Links you can add a new comms link. Then use the same port, but specify the Server address of the remote machine.

I use this approach on Windows with WSL2 to connect to simulation running in WSL2 from my host - see Windows Development Environment (WSL2-Based) | PX4 Guide (main)