Closed alexbuyval closed 3 years ago
Did you change in the config.h file that you now have 4 polytopic constraints (NPC 4) and that the number of soft constraints is also 4 (NS 4). https://github.com/alexliniger/MPCC/blob/302e12a0546221963dc2430477e54a279532c52d/C%2B%2B/config.h#L35 Best, Alex
Also since vs is not a physical state you could just limit the bound without worrying about soft constraints. This can also be done for each element in the horizon.
Best, Alex
Thank you for fast reply!
Did you change in the config.h file that you now have 4 polytopic constraints (NPC 4) and that the number of soft constraints is also 4 (NS 4).
Yes, I have changed.
Also since vs is not a physical state you could just limit the bound without worrying about soft constraints. This can also be done for each element in the horizon. Thank you, I will try.
Best Regards, Alex
Hi Alex,
Finally, I have added the following line in MPC::setStage:
stages_[time_step].u_bounds_x(si_index.vs) = normalization_param_.T_x_inv(si_index.vs,si_index.vs)* (track_.getVelocity(xk.s) - xk.vs);
and it works now properly. Thank you for your advice!
Best Regards, Alex
Hi @alexliniger
Thank you for your excellent work and code!
I would like to use an up limit of velocity calculated by global planner in your MPCC formulation. So now I am trying to add new soft constraints for vs state variable.
I have added new method in constraints class:
track.getVelocity(x.s) is new method which calculates max velocity according the global plan Also I have called the new method similar to others in Constraints::getConstraints
Finally, I have added additional cost parameters for new slack variable
However, it does not work.On image bellow you can see that v_s state overcome reference velocity (red line). Meanwhile all residual are small:
ipm residuals max: res_g = 5.263475e-09, res_b = 1.421085e-14, res_d = 2.264855e-13, res_m = 1.013018e-09
Could you give me any advice how to make it works properly?
Best Regards, Alex