# Multiple drone simulation gazebo GCS port

**URL:** <https://discuss.px4.io/t/multiple-drone-simulation-gazebo-gcs-port/40254>\
**Category:** PX4 Autopilot\
**Created:** [August 18, 2024, 2:14pm UTC](https://discuss.px4.io/t/multiple-drone-simulation-gazebo-gcs-port/40254 "2024-08-18T14:14:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryuu](https://discuss.px4.io/user_avatar/discuss.px4.io/ryuu/32/17021_2.png) [@Ryuu](https://discuss.px4.io/u/Ryuu)\
**Post date:** [August 18, 2024, 2:14pm UTC](https://discuss.px4.io/t/multiple-drone-simulation-gazebo-gcs-port/40254/1 "2024-08-18T14:14:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ryuu](https://discuss.px4.io/user_avatar/discuss.px4.io/ryuu/32/17021_2.png) [@Ryuu](https://discuss.px4.io/u/Ryuu)\
**Post date:** [August 18, 2024, 2:20pm UTC](https://discuss.px4.io/t/multiple-drone-simulation-gazebo-gcs-port/40254/2 "2024-08-18T14:20:00Z")

</div>

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

 ![image](https://discuss.px4.io/uploads/default/original/3X/0/8/0846f4a15c364938b9fca4a401ed61a6b5c552e1.jpeg)

---

<div class="post-metadata">

**Author:** ![Ryuu](https://discuss.px4.io/user_avatar/discuss.px4.io/ryuu/32/17021_2.png) [@Ryuu](https://discuss.px4.io/u/Ryuu)\
**Post date:** [August 19, 2024, 1:22am UTC](https://discuss.px4.io/t/multiple-drone-simulation-gazebo-gcs-port/40254/3 "2024-08-19T01:22:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hamishwillee](https://discuss.px4.io/user_avatar/discuss.px4.io/hamishwillee/32/3469_2.png) [@hamishwillee](https://discuss.px4.io/u/hamishwillee)\
**Post date:** [August 21, 2024, 12:13am UTC](https://discuss.px4.io/t/multiple-drone-simulation-gazebo-gcs-port/40254/4 "2024-08-21T00:13:24Z")

</div>

Simulation without ROS on Gazebo classic is covered in [Multi-Vehicle Simulation with Gazebo Classic | PX4 Guide (main)](https://docs.px4.io/main/en/sim_gazebo_classic/multi_vehicle_simulation.html#multiple-vehicle-with-gazebo-classic)

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](https://docs.px4.io/main/en/ros2/multi_vehicle.html#principle-of-operation). 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?

---

<div class="post-metadata">

**Author:** ![Ryuu](https://discuss.px4.io/user_avatar/discuss.px4.io/ryuu/32/17021_2.png) [@Ryuu](https://discuss.px4.io/u/Ryuu)\
**Post date:** [August 21, 2024, 7:49am UTC](https://discuss.px4.io/t/multiple-drone-simulation-gazebo-gcs-port/40254/5 "2024-08-21T07:49:09Z")

</div>

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

 ![image](https://discuss.px4.io/uploads/default/original/3X/e/b/eb8c5ea92dc0b25c9f87a99608fc8d84f0c232f1.png)

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

> <https://github.com/PX4/PX4-Autopilot/blob/3478765c310d3d34fc139dbf62594c41da6f85a9/ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink#L14>

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](https://discuss.px4.io/uploads/default/original/3X/b/0/b0cab6651fe7e1fcbf91302ec3e67d6eff980fb8.png)

---

<div class="post-metadata">

**Author:** ![hamishwillee](https://discuss.px4.io/user_avatar/discuss.px4.io/hamishwillee/32/3469_2.png) [@hamishwillee](https://discuss.px4.io/u/hamishwillee)\
**Post date:** [August 21, 2024, 11:45pm UTC](https://discuss.px4.io/t/multiple-drone-simulation-gazebo-gcs-port/40254/6 "2024-08-21T23:45:48Z")

</div>

> [@Ryuu](#):
>
> because i want to connect GCS in other machine so that i have to forward mavlink data to other

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)](https://docs.px4.io/main/en/dev_setup/dev_env_windows_wsl.html#qgroundcontrol-on-windows)
