UAV Toolbox Support Package for PX4 Autopilots - Pixhawk 4 Flight preparation

8 views (last 30 days)
The project I am working on is to design a controller in Simulink using UAV Toolbox Support Package for PX4 Autopilots and distribute it to Pixhawk4 to enable actual flight.
I designed Position&Altitude Controller and Attitude Controller as my model and uploaded it to Pixhawk4 using Build&Deploy.
It was confirmed that the auto code generated by Simulink was generated in the px4_simulink_app folder as follows. I confirmed that auto code generation replaces firmware with newly generated code from existing px4 firmware.
In order to verify the actual hardware flight performance of the controller I designed myself, I tried to conduct a flight test of a quadrotor equipped with a Pixhawk4 through QGrondControl. However, even when Arming at QGroundControl, the motor did not arm and eventually failed the flight test.
What additional work is required to apply the Auto generated Simulink code to the actual flight?
Should I change the input and output variables of the Auto-generated controller to the same as the variables of the code connected by px4 firmware? I'm looking for related data, but I'm having a hard time because I can't find a case where the actual flight took place.

Accepted Answer

Arun Mathamkode
Arun Mathamkode on 28 Dec 2022
Edited: Arun Mathamkode on 28 Dec 2022
As per my understanding there are no specific steps other than what you did to deploy code for an actual flight. I can provide some direction for you investigate and understand what might be going wrong here.
  • Make sure your autopilot not in HITL mode. Ensure that you uncheck the 'Enable HITL Mode' in the Model Configuration paramters so that the Autopilot not in HITL mode. Verify the same in QGC as well.
  • When you say you arm the drone, did you just arm it in the Simulink model or did you use the safety switch to arm the drone. For PX4 Autopilots the software arming as well as hardware arming using safety switch is required for successful arming.
  • Enable the PWM error staus output from the PWM block and observe for any error status.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!