PX4 v1.14/ v1.13 HITL Actual Motors Spinning

Hi all,

Iā€™m an undergrad trying to do HITL with actual ESCs and motors. Iā€™ve been trying to implement HITL with the actual actuators moving with PWM Main but have not gotten it to work so far.

Iā€™m using Ubuntu 20.04, Px 6x, and QGC 3.5.6.

Things Iā€™ve tried:
In v1.13 Px4 Repo

I followed the last step https://discuss.px4.io/t/fixed-wing-hitl-with-gazebo/27206/7:
After Iā€™ve added set OUTPUT_MODE pwm_out in *ROMFS/px4fmu_common/init.d/rc.interface, the motors would spin with the HITL Airframe and the HITL disabled but the drone simulation wonā€™t spin.

I managed to get the drone simulation to spin in the simulation and in real life separately, but never together. Has anyone managed to achieve this with v1.13 or v1.14?

I found HITL/HIL: disable lockdown not working Ā· Issue #14069 Ā· PX4/PX4-Autopilot Ā· GitHub and it seems like someone managed to get it to work in v1.11 but the firmware doesnā€™t build for me.

Other relevant posts I found:

If anyone has any idea on how to fix this, I would appreciate it a ton. Thank you!

2 Likes

Update:

Under pxfmu_common>init.d>rc.interface

If I make the following amendments, I can change which PWM the joystick or RC control will affect based on whether HITL is enabled or disabled under Safety. Is anyone here familiar with this know if thereā€™s a way to get the PWM to output to both simultaneously?

Hi, we managed to output to both real motors via PWM main and the jMavsim simulation by adding

_actuators_0_pub.publish(ORB_ID)actuator_outputs));

into src>modules>simulator>simulator_mav_link.cpp

Then, we launched jmavsim and then QGC (connected by UDP) and disabled HITL to get the real motors and the drone in the simulation to run simultaneously.

All the best to anyone trying to do this as well!

Hi, itā€™s so nice to see good news from you. I just encountered this problem when capturing PWM output from the Pixhawk itself with HITL running. I learned itā€™s blocked but had no ideas to turn this off. Actually, Iā€™m wondering if itā€™s possible for you to share the compiled file of the firmware as I donā€™t get access to Linux for now. Sincere and great appreciation!

Hi there,

I am experiencing an issue with the HITL simulation and seeking some advice.

I am using Pixhawk 6C as my flight controller with PX4 1.14.3. The gazebo version is 11.10.2, QGroundControl is v4.3.0, and I selected the airframe as the generic quadcopter (since it is mentioned that it is compatible with HITL).

I successfully set up my environment according to the HITL documentation: HITL. The iris model is visible and correctly loaded in Gazebo, and it appears that the flight controller is connected to both Gazebo and QGroundControl without any issues. However, I am unable to arm the vehicle using either my transmitter or directly through QGroundControlā€¦

Do you have any idea of why this happens?

I appreciate your help.