The output value of discrete PID controller is NaN

22 ビュー (過去 30 日間)
lim daehee
lim daehee 2020 年 5 月 19 日
コメント済み: Zheng Zhang 2023 年 9 月 8 日
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 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 5 月 19 日
Try to monitor the input of PID blocks. Are the input values finite?
lim daehee
lim daehee 2020 年 5 月 19 日
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.

サインインしてコメントする。

回答 (3 件)

Ankur Bose
Ankur Bose 2021 年 9 月 28 日
Answered the same question here
https://www.mathworks.com/matlabcentral/answers/527384-i-gain-of-pid-controller-has-nan-value-simulink
  2 件のコメント
勇刚 张
勇刚 张 2022 年 5 月 19 日
This method can solve the problem
  1. 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.
  2. Reset the PID block using and external signal when values are stored
Zheng Zhang
Zheng Zhang 2023 年 9 月 8 日
您好,能详细说一下您是怎么解决的吗?

サインインしてコメントする。


Jonas
Jonas 2020 年 5 月 19 日
Check the block 'Rotation Order: ZYX'. Does it work properly?
  1 件のコメント
lim daehee
lim daehee 2020 年 5 月 19 日
編集済み: lim daehee 2020 年 5 月 19 日
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.

サインインしてコメントする。


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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by