Upload custom flight controller on Pixhawk 4, and flight tests

23 views (last 30 days)
Hello.
I developed my flight controller in simulink, and i tested it In SIL, HITL following the matlab examples https://it.mathworks.com/help/supportpkg/px4/setup-and-configuration_mw_3095a711-0234-45ed-9b75-77488e8e577d.html https://it.mathworks.com/help/supportpkg/px4/setup-and-configuration_mw_06fa168c-661f-4e54-b3b0-197c970f0ac9.htm . Now i want try to perform the flight test with my fligth controller. Now, there isn't any examples about perform real fligth tests. So, I uploaded the firmware following the HIL procedure:
Build the firmware and upload
  • Default startup script
  • Design flight controller in simulink
  • Boardo Pixhawk 4, whit px4_fmu-v5_default
Then after these passages i Build Start and deploy my fligth controller into Pixhawk 4.
Now if i try to connect my drone with Qground cotnrol station, all the sensors, frame, GPS, ecc... are ok. So I armed the drone and command the take off, but the motors didn't start to spinn. I also tried with the example in matlab "px4demo_HardwareInLoopWithSimulinkPlantStart", but even this dind't work. A strange thing is that when i armed and command the take off, i saw (in Qg mavlink inspector) that the actuator_commands change his values to 2000 us, but the engines doesn't move ( i use the PWM channel block). I alredy cheked that all the wires are connected, and also i tesed the engines via Qg and they works. So I guess that i miss something in the configuration for perform real fligth.
I also tried to uplod custom startup script, but i didn't undestand very well the procedure. But in any case the default script should work, because it already disable the mc_postion_controller, and mc_attitude_controller.
I anyone have some guides to follow, or some adevices. Thanks in advance.

Accepted Answer

Ankur Bose
Ankur Bose on 14 Sep 2023
Check if the board is in HITL mode. In HITL mode, the actuator pins are disabled. If you want to run the engines, then you have to bring the board out of HITL mode.
  1 Comment
Edorado Baldacci
Edorado Baldacci on 14 Sep 2023
Thanks for your reply.
The HITL is disabled in simulink hardware settings, and is disable also in QG. But still doesn''t work. There is anther option to verify that the board isn't in HITL?
durign these days i also try to upload the px4demo_PWM and it works, ( basiccally two engine spinn and other two doesn't move).
But now, if instead to use a constat value 1 (bool) to arm the PWM block, i use the uORB message actuator armed, it doesn't work. Basically
  • I have all the stuffs in Qground control that are ok
  • I arm the drone, then the engine start to spinn for 1 second
  • After this second they stop, but the drone is still armed
the first thing that i thought is that i miss someting in the mixer of PWM, how i can check this point?

Sign in to comment.

More Answers (1)

Edorado Baldacci
Edorado Baldacci on 16 Sep 2023
I tried to get accelerometer data after the building of the firmware. In a first moments i'm able to read accellerometers data, but after 3/4 attempts i read zero:
  1 Comment
Luca Montecchio
Luca Montecchio on 28 Apr 2024
Hello Edoardo,
I am currently trying to do the same so to deploy a custom controller in a real flight test. Could you tell the passages you followed after the HITL to deploy it on the physical drone?
Did you eventually succeeded?
Thanks.

Sign in to comment.

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!