The output value of discrete PID controller is NaN
Mostra commenti meno recenti
I'm trying to control motors with pwm signals.
when I clicked monitor & tune button, I found some outputs of discrete PID controller block is NaN. It is stated below.

Other input from same bus, yawspeed, generate normal value, however, pitch and roll angles have nan value.
I first thought that the problem is from the difference of data type.. so I checked data types of all inputs and outputs and there are no problems with data types.
Is there anyone who know why the nan value is generated?
2 Commenti
Ameer Hamza
il 19 Mag 2020
Try to monitor the input of PID blocks. Are the input values finite?
lim daehee
il 19 Mag 2020
Risposte (3)
Ankur Bose
il 28 Set 2021
2 voti
Answered the same question here
https://www.mathworks.com/matlabcentral/answers/527384-i-gain-of-pid-controller-has-nan-value-simulink
2 Commenti
勇刚 张
il 19 Mag 2022
This method can solve the problem
- Ensure that initial inputs are not NaN. in PX4 thing might happen when you are trying to read from vehicle attitude connected to rotation block. Initially the estimator might not have started which caues attitude not to be published and hence uORB block retutns [0 0 0 0] as quat which are invalid and hence rotation block computes NaN and passes to PID. Eventually this might be fixed but PID will still store NaN.
- Reset the PID block using and external signal when values are stored
Zheng Zhang
il 8 Set 2023
您好,能详细说一下您是怎么解决的吗?
Jonas
il 19 Mag 2020
1 voto
Check the block 'Rotation Order: ZYX'. Does it work properly?
1 Commento
lim daehee
il 19 Mag 2020
Modificato: lim daehee
il 19 Mag 2020
Kunal Lad
il 31 Lug 2020
0 voti
Hey Lim Daehee,
Did you find the solution to this problem as I am facing it too. Share up if possible.
Thanks.
Categorie
Scopri di più su Continuous in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!