deng-haoyang / ParNMPC

A Parallel Optimization Toolkit for Nonlinear Model Predictive Control (NMPC)
https://deng-haoyang.github.io/ParNMPC/
BSD 2-Clause "Simplified" License
297 stars 78 forks source link

Error NMPC Problem Formulation #8

Closed Betancourt20 closed 5 years ago

Betancourt20 commented 5 years ago

Hello, First, thank you for share with us your work. I was trying to run the first example but I got the following error

NMPC_Problem_Formulation Error using sym/vertcat (line 17) Error using maplemex Error, (in ArrayTools:-Concatenate) number of columns must match

Error in DynamicSystem/setf (line 5) obj.f = symfun(f,[obj.u;obj.x;obj.p]);

Error in OptimalControlProblem/setf (line 2) setf@DynamicSystem(OCP,f);

Error in NMPC_Problem_Formulation (line 33) OCP.setf(f);

I hope you can help with this. Best regards, Julio

deng-haoyang commented 5 years ago

Hi Julio,

Thanks for the feedback.

It seems you have installed Maple and the Maple sym function is called instead of the MATLAB one. Can you try "u = sym('u',[4,1])" in MATLAB and see if u is a 4x1 vector?

Look forward to your response. Deng

Betancourt20 commented 5 years ago

Hi, Thank you for your response. Here is the Matlab console give after the command you told me before :

u = sym('u',[4,1])

u =

                           [u1, u2, u3, u4]

Thank you in advance, Julio Beancourt

deng-haoyang commented 5 years ago

Hi Julio,

Thanks for the response.

It seems that the sym function didn't return the right result (4x1 vector) because of the bug caused by the Maple sym function.

I have updated the source code to guard this and the problem might have been solved . Alternatively, you can call the Matlab sym function rather than the maple one by removing the maple path from MATLAB search path.

I hope this could solve the problem. Thank you. Deng

Betancourt20 commented 5 years ago

Hi Deng, In fact as you said before, the problem was the symbolic Maple toolbox. So, I uninstalled the toolbox and that's it. Right now is working. Thank you so much for your help

Best regards, Julio