Skip to content

Conversation

@joris997
Copy link
Contributor

@joris997 joris997 commented Mar 7, 2025

Instead of having to use acados, some users (like me :) ) may want to use the more intuitive casadi solver. This is a first PR for that, only containing the rate MPC.

I've decided to add a differentiator, euler and rk4 integration method to the spacecraft_rate_model. The MPC itself is located in spacecraft_casadi_rate_mpc.py. In the launch file (and therefore command line) it is now possible to call either acados or casadi for the rate mpc via the framework flag.
Current solvers: IPOPT and SQPMethod

Tested in SITL with

`ros2 launch px4_mpc mpc_spacecraft_launch.py mode:=rate namespace:=snap setpoint_from_rviz:=False framework:=casadi'

@joris997 joris997 requested a review from Pedro-Roque March 7, 2025 12:42
Copy link
Member

@Pedro-Roque Pedro-Roque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check these and change accordingly @joris997 , I'll approve it after :)

@joris997
Copy link
Contributor Author

joris997 commented Mar 7, 2025

done @Pedro-Roque

@Pedro-Roque
Copy link
Member

Great! If my test checks out, I'll merge.

Copy link
Collaborator

@Jaeyoung-Lim Jaeyoung-Lim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense that this would be a complete separate node, but sharing the models and formulations?

Or do you think this switch is general enough that we can switch back and forth?

I am a bit worried since the reason we went for acados was for simplicity. (You can see how little number of codes are needed to create a MPC node with this implementation.

@Pedro-Roque
Copy link
Member

@Jaeyoung-Lim I think that the mpc_spacecraft should still be the entrypoint, and perhaps the MPC's need to be abstracted away. I'll start reviewing this PR and make some changes for clarity and ease-of-use.

@joris997 the time as finally come!

@Pedro-Roque
Copy link
Member

@joris997 any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants