EmbersArc / SCpp

Implementation of SCvx, linear MPC and LQR for trajectory generation and tracking
MIT License
145 stars 37 forks source link

ecos solver setup null #12

Closed abdxyz closed 5 years ago

abdxyz commented 5 years ago

hi,I had already installed ksp and krpc. but when I run the code,I met another problem.I cannot run the scpp program. I debug the program ,find that ecos_setup receive a NULL return value. Do you know what happed? I'm interested to this project.If there are something I can do,I'd glad to help.

abdxyz commented 5 years ago

Screenshot from 2019-04-10 21-22-33

EmbersArc commented 5 years ago

Yes that's a problem with the latest version of ECOS. Try version 2.0.6, that one works for me. It has to do with the fact that they internally switched from long int to int to store indices, but I don't have enough knowledge of C to figure out why that crashes the solver. I mentioned it here: https://github.com/embotech/ecos/issues/167 and @echu is on it I think.

Contributions are always welcome. For now the necessary functionality is all there. Depending on your experience with C++ and your interests there are a couple of things that can be done or improved. For example the problem setup part is a bit tedious right now. It would be great if it was possible to just formulate the cost and constraints with Eigen matrices instead of having to loop over each value in the matrix (basically overload the <, = and > operators to take Eigen types). You can also implement your own models and problems, I'd be glad to help if you have an idea of what else to apply the algorithm to. And lastly of course it still doesn't quite work with KSP. It's pretty close and maybe you can figure out what's wrong with it.

abdxyz commented 5 years ago

thanks a lot.I'm interested in run simulation in ksp,although I'm not familiar with ksp. :) we can make ksp simulation more well,so that can show the work better. then we can improve the setup part.

abdxyz commented 5 years ago

i now can run scpp successfully.when i run scppksp,there are something wrong with the cppad. this is my screenshot. I load a craft.and launch it and they run the scppksp.

abdxyz commented 5 years ago

Screenshot from 2019-04-11 19-49-33

EmbersArc commented 5 years ago

This can happen for various reasons. The issue is that krpc can't stream the value for one or more vessel members. In your case that might be because you have multiple engines. Only use one engine that is active and can be throttled. Build your rocket as simply as possible. Probe Core, Tanks and one Engine. Also make sure to start the solver only when you're already approaching the landing pad and the velocity vector roughly points in its direction.

EmbersArc commented 5 years ago

original issue now fixed