The output value of discrete PID controller is NaN

25 views (last 30 days)
lim daehee
lim daehee on 19 May 2020
Answered: Ankur Bose on 28 Sep 2021
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 Comments
lim daehee
lim daehee on 19 May 2020
Nope, I monitored all values including input of PID blocks, however, they are all not inf or nan and it ranges from -0.02~0.02
The output saturation is limited from -0.1~0.1.
Additionally, I changed inputs(pitch_angle, roll_angle)into constant block with a constant value and the model works fine.
However, when inputs are from uORB block, the output of PID block has nan valeu.

Sign in to comment.

Answers (3)

Jonas
Jonas on 19 May 2020
Check the block 'Rotation Order: ZYX'. Does it work properly?
  1 Comment
lim daehee
lim daehee on 19 May 2020
I changed pid controller into p controller and it works fine. So I think rotation order worked well. Also, I think d and i controller is the problem, but I don't know why d and i gain caused the problem.

Sign in to comment.


Kunal Lad
Kunal Lad on 31 Jul 2020
Hey Lim Daehee,
Did you find the solution to this problem as I am facing it too. Share up if possible.
Thanks.

Ankur Bose
Ankur Bose on 28 Sep 2021
Answered the same question here
https://www.mathworks.com/matlabcentral/answers/527384-i-gain-of-pid-controller-has-nan-value-simulink

Community Treasure Hunt

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

Start Hunting!

Translated by