Possible to use a custom airframe for HITL simulation with X-Plane?

I know there’s a fixed wing and a multicopter airframe that can be used for HIL sim with X-Plane, but how hard would it be to instead use a custom (VTOL) airframe? (I have a model of it in X-Plane already.) Where in the code is this handled?



Do you already have the model working in x-plane? If that’s the case you just need a vtol HIL airframe configuration and appropriate mixer. Are you able to share your x-plane model? I’d be happy to help fill in the gaps.

Thanks dagar! I got the HIL airframe set up and communicating with X-Plane, but QGC keeps telling me that my sensors and GPS have failed, and the GPS fix jumps all over the map. I see only X-Plane 10 is supported and I’m using X-Plane 11. X-Plane 11’s I/Os are set up a little differently that the X-Plane 10 example here, so I may have messed it up… or would it not work with X Plane 11 anyway?

You’d have to look into the differences between X-Plane 10 and 11 and then likely extend QGC support for the newer version. I’d be happy to point you in the right direction if you’re interested in pursuing this. Short term the easier thing to do is use X-Plane 10, or use Gazebo for simulation.

Thanks dagar, I’d definitely be interested in extending QGC support for X-Plane 11… where do I start? :slight_smile:

I’d start on the x-plane side. Are there actual differences between X-Plane 10 and 11 for the network interface?

Apparently there’s no difference, I must have just set up the ports wrong the first time I tried. I’ve just loaded the EasyStar HIL airframe on the Pixhawk and although I couldn’t get the X-Plane model of same to show up in the menu, I selected a Columbia 400 and flew that instead. It seemed to work fine.

It doesn’t play so well with my VTOL airframe, though. It’s a quad-configuration tiltrotor and the X-Plane model uses the VTOL vectored thrust option to control the tilt. Any ideas how I could get the pixhawk to “tell” X-Plane what mode it is in and to map this to the thrust vector?


That’s good news actually, we should be able to make progress on this part. Just to confirm, your model works in x-plane standalone?

This is the regular plane HIL configuration. https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/1000_rc_fw_easystar.hil

We’ll need to create one for your vtol and figure out how the actuators map. Can you expand on how it functions as a vtol? Do all 4 motors tilt or just the front two?

Yep, I can control my VTOL model from the joystick in X-Plane, but controlling it via HIL doesn’t work. I have a HIL config file for it that I just based off the regular config file–do I have to change anything beyond adding “@type Simulation” and “set HIL yes”? I can load this airframe on the Pixhawk and connect it up to my X-Plane model, but the differential thrust controls don’t really work and of course I haven’t figured out how to map the “tilt” function.

As for the airframe - all four motors tilt, so it has differential thrust until mid-way through the transition, then the motors respond only to throttle. It has standard elevator, ailerons and rudder.

I’ve been able to save the HILStar model in XPlane 10 via the plane editor to get a plane that’s compatible with XPlane 11. I can now use this succesfully with XPlane 11. The latest update of X-Plane 11 seemed to improve the reliability of the telemetry output and made HIL work a bit better. It’s still not perfect and I do get occasional GPS jumps, but it’s usable.

Note, to get joystick to work, you will have to arm before any RC data is transmitted to X-Plane.

You will also need to use a standard fixed wing mixer. You can use a non-standard mixer mapping, but you’ll have to modify QGroundControl to remap the HIL outputs from what I could tell.

Good to know regarding saving the HILStar via the plane editor, I’ll try that.

The remapping for the VTOL airframe mixer is not going well… I’ve found the GQC source code responsible for this and have been able to recompile QGC with my changes, but X-Plane seems to not be receiving some of the data I send (thrust vector) and receiving the rest all scrambled (thrust to each of the motors, roll, pitch, yaw).

I believe the data rates and ports are set up correctly because I’ve been able to control a standard AERT X-Plane model using the HILStar airframe, and I know what each of my VTOL airframe’s actuator control outputs are–but I don’t know how those control outputs are getting pulled into the “QGCXPlaneLink::updateActuatorControls(…)” function, nor whether I’m sending them to the correct data groups in X-Plane.

Here is my current setup: In that updateActuatorControls function, I’m sending my motor control signals 1-4 to indices 0-3 of data set 25 (throttle command), my tilt servo command to index 0 of data set 9 (“other flight controls”, 0 is thrust vector which the X-Plane model uses to tilt the motors), and aileron, elevator, and rudder to indices 0-2 of data set 8 (joystick ail/elv/rud). Does that seem like it could work?

Another issue I’m having is that the X-Plane VTOL model wants to determine differential throttle to each motor from roll, pitch and yaw commands–whereas I want the Pixhawk to do that, and X-Plane to just spin each motors at the speed the Pixhawk says. Anyone have any ideas for a work-around? Disabling differential throttle for the X-Plane model in Plane maker just makes all the motors spin at the same rate. I’m stumped!

Update… I got my ailerons, elevator rudder and tilt mechanism working! I realized that my MAV_TYPE parameter wasn’t actually being set from the airframe config file for some reason and therefore that updateActuatorControls(…) function was just loading the default airframe every time. Made debugging the VTOL airframe a bit difficult. :stuck_out_tongue: So with that out of the way, I had to move my ail/elev/rudd inputs to data set 11 and my tilt mechanism control to data set 12 index 3 (vect_ratio). That all seems to be working great.

However, the control of the motors is still haywire. I tried to disable the artificial stabilization of our X-Plane model, but that didn’t seem to change anything. It seems like either controls 0-3 are not what I think the are (i.e. they aren’t actually the control signals for motors 1-4) or the data type or range is wrong. The motors all spin up at different rates and show no sign of using differential throttle in vertical mode.

Update again - Adjusted the scaling of the thrust vector (X-Plane wanted a range of 0 to 1, Pixhawk was giving it -1 to 1) and the order of the motors. The plane now responds recognizably to roll, pitch and yaw commands in multicopter mode. But that said, the motors still kick on at different throttle levels (and looking at the requested throttle readout on the display, the throttle setpoints indeed show up as different even when I’m not commanding any differential thrust), so it is rather nauseating to fly! Any idea what could be causing this?

Update 3 - looks like the motor speed issue is the result of a problem sending “sensor” data from X-Plane to the PX4. Data looks good on X-Plane side but crazy by the time it gets to QGC, so the Pixhawk thinks it is moving when it should be still, upside down when it’s right side up, etc. The plane is flyable in manual forward flight and almost flyable in multicopter Acro mode. I’m curious, in MC_att_control there is an inner PID loop for angular rate control, does this loop still run in acro mode or is Acro mode have no artificial stabilization at all?

I didn’t get your updates, but it sounds like you’ve made progress? Is FW roll, pitch getting confused with MC motor actuation? The rate loop in mc_att_control runs in acro mode (MC).

Yep, progress has been made with the airframe–all the controls work and it is flyable, at least sometimes! However I’ve hit a bit of a wall with the data transmission problem. I’ll start up the simulation and all will be well, but after a while what X-Plane and what QGC are displaying for roll, pitch, yaw, altitude, and GPS will wildly diverge. I have no experience with UDP/any comm stuff whatsoever, really, so I’m not sure how to go about debugging this.

Would you be able to share anything showing the problem?
Maybe record your screen or something? That along with the ulog from the autopilot would be a good start for debugging.

Dear annavt

Nowadays I have tried to use QGroundControl with X-Plane 10 in steam for HITL simulation. However, I failed when I followed the official manual. So, I would like to know which version QGroundControl you Use to realize the HITL with X-Plane.


Hi dagar

Nowadays I have tried to use QGroundControl with X-Plane 10 in steam for HITL simulation. However, I failed when I followed the official manual. So, I would like to know which version QGroundControl you Use to realize the HITL with X-Plane.


Hi, you must output data from x-plane on port 49005. Next thing is to setup all parameters that are mentioned in manual. Last thing that needs to be done is connection from qgrouncontrol to x-plane. It should work. I fly on X-plane 11 and everything works. If you have problem with control input, you need to downgrade to px4 1.5.5. I was not able to find why it doesn´t work on newer versions.

What about progress on this topic. Is it possible to fly vtol in x-plane ?

Maybe I found solution. Mapping is possible to do by creating custom mixer. Than in qgroundcontrol repository we need to change QGCXPlaneLink.cc. On line 463 is switch in which mapping is done by sendDataRef() function. All DataRefs are on this (http://www.xsquawkbox.net/xpsdk/docs/DataRefs.html) website. But I didn’t found any parameter for independent thrust vectoring. This will be largest problem.

I set the UDP rate in X-Plane 11 to 99 Hz but only receive packets at about 17 Hz. Hence the estimator diverges and I can’t fly. Has anyone of you experienced the same?