MPC linearization error: "NaN's cannot be converted to logicals"
5 views (last 30 days)
Show older comments
I have an XT28 model. I have tried to add a MPC controller (MPC toolbox) to one of the legs.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/464170/image.png)
In the wheel2roadConnection block (green text) there is a sensing block.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/464175/image.png)
During compilation, 1.0e-05 and -1.0e-05 (in pair) are sent from the sensing block to the wx, wy, vx and vy inputs of the forces block. I printed the value of these signals using a matlab function. These signals eventually reach the slipvel subsystem
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/464180/image.png)
The signals does NOT change even if there is a gain or square block. When it comes to the sqrt in the slipvel subsystem, a NaN error occurs due to trying to take the square root of a negative value.
I tried the MPC toolbox with another simple model. I added a sqrt block to the mv port of the MPC and got the same error (during compilation, the pair of -1e-05 and 1e-05 is sent out from the mv port of the MPC and I cant change these values).
Without the MPC toolbox the value of the signals gets changed correctly when it enters for example a square block or gain block.
I use the version: MATLAB R2019b
Do anyone know why I get this problem when I use the MPC toolbox?
0 Comments
Answers (0)
See Also
Categories
Find more on Controller Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!