HITL output to real servos?

Is it possible to output the virtual HITL aircraft servo actuations to real servo’s plugged into the pixhawk?

Yes I suppose you could, but I’d recommend caution (no ESCs).

There’s a special output mode when HIL is set. If you comment out set OUTPUT_MODE hil you’ll get the normal output mode.

1 Like

commenting this set OUTPUT_MODE hil in current master branch no longer makes the real servos run.
It also blocks Radio connection to the simulator. Hence, neither real servos work nor the simulator plane gets input from the radio.
Any other solution shared by you would be great.

I got it working. This is what I did:

  1. I used the latest px4 firmware (v1.11.1 - also works on current master branch)
  2. I only changed one file (state_machine_helper.cpp): Commented the line armed->lockdown = true; inside if (hil_enabled) { block
  3. I compiled, built and then uploaded this firmware in QGC v3.5.6
  4. In QGC I disabled HITL then rebooted vehicle and then selected Standard-Plane as the airframe
  5. I pressed the safety switch to check if my servos are working as per the radio control.
  6. Then, I enabled HITL, again rebooted the vehicle and selected ‘HIL-Star’ as my airframe.

Note: At this point, the servos should still be active and controlled by radio.

  1. I launched XPlane-11 and started a flight
  2. In QGC, I opened the HIL widget to connect with X-Plane 11
  3. Then, I armed the vehicle

After arming; the real servos and the X-Plane aircraft wings should both be working and you should also be able to fly the plane using the radio.

I hope this helps someone.

1 Like

Hi,I followed your steps but when I enabled HITL and changed the airframe, I cannot control the actuators through radio controller, should I edit other file?

Worked perfectly fine for me. Only the line mentioned in pt. 2 above needs to be changed. What px4 version are you using?
Also can you list down your steps in detail?