How px4 firmware connects to the gazebo in code level?

I would like to know how the px4 firmware connects to the gazebo simulation in code level. Now I can fly the iris in gazebo through PX4Devguide.
But I would like to know which files the connection process is occurring and the principles of communications between px4 firmware and gazebo. Why drone in gazebo can move?
I have lost in the PX4 firmware code and I haven’t find any relevant information.
can someone help me? Thanks a lot.

I’m not familiar with this code, but I believe it’s entirely through mavlink.


1 Like

The gazebo_mavlink_interface.cpp shows how gazebo receives/sends mavlink messages, but where dose px4 firmware sends/receives mavlink messages from?
When px4 firmware connects a real drone, is the same method to send messages to drone as connectiong to simulation?

PX4 centralizes mavlink send/receive in the mavlink module here -

A bit of an explanation here.

1 Like

Oh! You are a very nice person!:grinning::grinning::grinning: