Getting PX4 + ROS + Gazebo SIM to work



This is a beginner’s question (new to drone dev). I have been trying to get PX4 + ROS + Gazebo to work and try out fee scenarios in SIM, but with no success.

Followed instructions @

  • Tried launching px4 and gazebo separately (no_sim=1) and also together.
  • Also tried using MAVRos separately and together.

In all the cases the apps are launching perfectly, but the px4 is stuck at below msg

“INFO [simulator] Waiting for initial data on UDP port 14560. Please start the flight simulator to proceed…”

If i start MAVRos: I could see hearbeat’s being sent on port 14540
If i start QGC: I could see hearbeat’s being sent on port 14550

So who will send data/initiate connection in port 14560? I guess the SIM should talk to px4 on 14560 as per docs, buts it’s not happening?

What am I missing?


BTW, the command “roslaunch px4 posix_sitl.launch” does’t work for me, as px4 package is not found (verified through rospack find px4), so I am using “roslaunch launch/posix_sitl.launch”.


After re-reading the docs, the below command works for me using QGC.

make posix_sitl_default gazebo_plane (earlier i was only using gazebo).

Now I am trying to make it work using MAVROS, its able to connect to the PX4 but not sure how to control using MAVROS?


@tk17 You can read the documentation on mavros. It includes some utilities that you can run directly, or you can publish topics/services that mavros can receive


Thanks. But I have a basic question

From my knowledge so far: there are 3 options for ground control (I am looking to use over UDP + WIFI)

  1. QGroundcontrol
  2. MAVROS + Custom Apps
  3. MAVProxy + QGroundControl.

Can you please let me know the advantage of MAVROS, as from what i see QGroundControl is having nice interface and full featured? In the real world which one is preferred?


@tk17 MAVROS is not really something you use for a groundstation. It is a mavlink interface for ROS(Robot Operating System)


I was referring to the diagram#3 @
My use-case is managing the autopilot from ground over WiFi, so in that diagram “ros enabled computer” acting as a ground station is managing autopilot using Qgroundcontrol or directly using MAVlink (I guess this is viz MAVROS). Please correct me if I am wrong?


@tk17 You are right. Correct me if I’m wrong, but my understanding is that you were curious why mavros is needed if you can use qgroundcontrol.

If you want to use ROS or a ROS enabled app to control your vehilce, mavros can be useful. If you simply want to control the drone from the ground station qgroundcontrol is enough for most of the things.


Yes, I was just trying to see advantages of using ROS. But I understand your point.

In the link @

“The biggest advantage of interfacing to SITL through ROS has the same interface with interfacing with a real flight controller. You only need to change the fcl_url on MAVROS.”

So IIUC, this refers to the onboard processor right? (ROS -UART - Flight Controller)


@tk17 That is correct. That was more on the perspective from a ROS user.

Using ROS is more about utilizing the various packages that is available in ROS such as computer vision or robotics related packages. If you are just looking at controlling the drone more or less as a groundstation, I don’t really see much advantage on using ROS.


Thanks, this clarifies my doubts. So if we want the same code to be used onboard/offboard we can go for MAVROS, if we are looking only for offboard then QGC is the best bet.