i gain of PID controller has nan value.(simulink)

25 views (last 30 days)
I'm controlling a segway with PID controller and I have a problem about PID controller block.
From the pic above, input of PID controller block(PI controller is in the picture, however, all controllers which contains integral gain have the same problem) is non nan value, however, the output of PID controller is nan.
I checked all data types and there are no problems.
Two inputs of Pitch controller is from the attitude of my hardware and they are also normal integer.
I don't know why the output of PID controller is nan value.
Also, when I change the input of pitch_angle into constant block(e.g. 0.1318), PID has normal value.
How can I solve my problem?
  1 Comment
Arkadiy Turevskiy
Arkadiy Turevskiy on 7 Oct 2020
Strange. Hard to troubleshoot without your model. Can you please contact tech support?

Sign in to comment.

Answers (1)

Ankur Bose
Ankur Bose on 28 Sep 2021
This can be happening if for an initial brief period of time, any one of the inputs to PID was NaN. Even though the input values might have been fixed to some proper values, the PID block stores the states and hence you still see NaN.
Couple of ways to fix this
  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

Products

Community Treasure Hunt

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

Start Hunting!