PX4 - Simulink quaternion outputs are NAN after applying integration

1 view (last 30 days)
Hello every one
We are trying to upload a controller on the Pixhawk 4 or cube using PX4 and simulink (Matlab 2021a) and test it on the testbed. The problem is when applying PID on the quaternion outputs (because of using integration) will have NAN on the outputs. In fact, to control the Euler angles we need to have some thing like a PID controller on the Euler angles. Have anyone encountered suh a problem or have any suggestion about how to apply the PID controller to control the Euler angles since we were not able to use the gyro sensor also for deriving the Euler angles with using the Quarternions.
Best wishes

Accepted Answer

Davood Asadi
Davood Asadi on 1 Sep 2021
Thanks for your kind response.
As we noticed at the beginning of the simulation the output of the quaternion block does not give any output, it means it is not a real zero. Therfore, when it passes through the integration the response it NAN unless it is not solved by introduceing a real zero at the begining of the simulation.
Regards

More Answers (1)

Kshitij Chhabra
Kshitij Chhabra on 1 Sep 2021
From my understanding, you are not able to get the desired results because of NaN outputs from PID controller as a result of passing Quaternion inputs. As an alternative, you can read the postion and attitude of the vehicle seperately and develop the controller accordingly. An example for the same can be found here.
Or, you could directly look at the simulink model using the following command to get an overview:
open_system('px4demo_PositionController_quadrotor')

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!