I am trying to understand how to make PWM outputs work in HIL mode because I am using external hardware to simulate the PWM outputs and do further analysis. So, I need to mirror the pwm_out_sim on the actual PWM pins in order to continue my work. I have tried disabling the armed lockdown but it did not work. Can you please help me?
Have you tried this?
Yes but I had to do an extra step of stopping px4io and restarting it with safety off. It kinda works now.
Thanks alot @parakhm95 for your answer.
Your solution worked with little modification. This is what I did:
- I used the latest px4 firmware (v1.11.1 - also works on current master branch)
- I only changed one file (state_machine_helper.cpp): Commented the line
armed->lockdown = true;
insideif (hil_enabled) {
block - I compiled, built and then uploaded this firmware in QGC v3.5.6
- In QGC I disabled HITL then rebooted vehicle and then selected Standard-Plane as the airframe
- I pressed the safety switch to check if my servos are working as per the radio control.
- 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.
- I launched XPlane-11 and started a flight
- In QGC, I opened the HIL widget to connect with X-Plane 11
- 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
Hi @parakhm95. how do you stop px4io and how to restart it with safety off?
I have managed to start HITL simulation and send out the real outputs to my aircraft but it only works in manual mode or stabilized mode. It doesn’t work during mission.
During mission the real outputs keep reacting to the joystick.
Did you have a similar problem?
Hi , @jesus !!! I also encountered the same problem and wanted to drive the real motor in HITL mode. I have a few questions to ask you. Which version of PX4 do you use? Can you tell me the specific operating steps and areas that need to be changed?
I think there was a command-line parameter to stop the PX4IO and restart it. It was a long time ago and so I don’t remember it anymore. Sorry