HITL & X-plane 11 & QGroundControl

Hello everyone,

I am using Cube Black, X-plane 11, QGC 4.1.2

I am trying to make quadrotor HITL on X-plane 11.

I made a software, which converts MAVLink packets to UDP datagrams for Xplane and vice versa. Now i am trying to use my HITL configuration w/ QGroundControl. Connection between QGroundControl and my CubeBlack is okay but i can’t command takeoff or any kind of mission.

First of all, which messages are enough to fly my vehicle ?
I am able to send HIL_SENSOR + HIL_GPS or HIL_STATE_QUATERNION messages with frequencies around 80-120 hz.

Secondly, I can control the system with joystick via qground or I can embed a flight route by hard coding to my system, but I cannot send a full mission via qgroundcontrol.

When I send a takeoff command, I can see in the mavlinkinspector of qground that I sent an invalid (NaN) position_target_local_ned message.

Can you help me about this issue?

Best regards.

X-plane 11 is not a supported / maintained simulator setup with PX4.

Please check the list of supported simulators: Simulation | PX4 User Guide

Do you know why it is not supported? Cause in past posts i saw some people saying that they are using X-Plane and couldn’t figure out why Px4 stop supporting X-Plane now.

And do you have any idea how can i implement?

Thank you for your fast response.


Do you know why it is not supported? Cause in past posts i saw some people saying that they are using X-Plane and couldn’t figure out why Px4 stop supporting X-Plane now.

@Fatih_Ozkan Yes it worked at somepoint, but AFAIK it is no longer maintained.

The main limitation I see with Xplane is that the simulation depends on the rendering rate, while SITL/HITL needs faster simulation update rates to simulate the sensors.

An alternative is the jsbsim implementation, which works with flightgear: GitHub - PX4/px4-jsbsim-bridge: JSBSim bridge for PX4 SITL/HITL simulations If you want to implement the bridge for Xplane, this would be a good reference for you.

1 Like

Thank you for source.

And can you answer my first question.

Which specific messages i need to fly my vehicle. I determined as HIL_GPS, HIL_STATE_QUATERNION, HIL_SENSOR. Is that right? And i checked the code of JMavSim and few codes of JSBSim. Some sensor, gps values are sending with noise. Is it essential?

@Fatih_Ozkan You can read the documentation on how SITL/HITL works: Simulation | PX4 User Guide

Not sure if you would want to have a noise free simulation - your EKF will still be assuming that your sensor has noise unless you configure otherwise. This will probably end up being “not representative” of the vehicle behaviors you see in the real world

1 Like

I got stucked at even in basics. Now my issue is when i say arm to vehicle it’s not like arming but QGround is showing that vehicle “armed”.
I am trying to make simulation with quad mode with my Quadplane Vtol model.
And in takeoff mode (not just take off in all modes) i think QGroundcontrol can’t send mission command. But also there are no error sign in QGroundControl.

I think its about Position_Target_local_Ned MavLink message. Here is my Position_Target_local_Ned in takeoff mode:


@FairweatherIT Which simulator?

Like i said X-plane 11


I have done the same thing (bridge mavlink<->xplane 11).
I started with the source of this github project mav2xplane

For your first question:
Only hil_sensor and hil_gps are needed.

2 important things:
this previous messages must always arrive to controller at exact same frequency (in my case 40 Hz). If not, the estimator doesn’t work.
If there no noise on hil_sensor, the estimator doesn’t work.

I had also problem with vibrations see here

To get more information, i used the logs extractor which very useful https://logs.px4.io/

@big Would you be able to share the changes on top of mav2xplane?

It would be great if we can get a standard setup running

Thank you for your logical and realistic response. I will dive in.

Appreciate that

Best Regards.

Sorry, i can’t. It’s part of huge internal tool.
ASAP, i’ll try to publish a standalone version of the bridge.

Sir how did you manage time sync.

In mav2xplane scripts i reached this line about time:

static quint64 groundTimeMilliseconds()
return static_cast<quint64>(QDateTime::currentMSecsSinceEpoch());

But couldn’t find QDateTime.

Can you help me about it?


The source depends on framework named Qt.
If you don’t use it, you can use as alternative as QDateTime:
std::chrono:system_clock::now() (STL library)
Good luck!

PS: Every time you see a Qxxx, it’s QT framework