Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[swing-up] Closed loop real-time NMPC using crocoddyl #76

Open
pierfabre opened this issue Mar 2, 2024 · 2 comments · May be fixed by #86
Open

[swing-up] Closed loop real-time NMPC using crocoddyl #76

pierfabre opened this issue Mar 2, 2024 · 2 comments · May be fixed by #86
Assignees

Comments

@pierfabre
Copy link
Collaborator

For now we are able to generate a swing-up trajectory using crocoddyl offline.

  • Can we go under 5Hz of control freq
    • Code generation
    • Multi-threading
    • implement calcDiff
    • try with urdf
    • ask for help
  • Is the model accurate
    • sim2real xp
    • better visualization of sim
@pierfabre
Copy link
Collaborator Author

pierfabre commented Apr 22, 2024

20240422 - First closed loop swing up with NMPC at 100Hz

For the simulation we use pinocchio with an urdf from the robot. We add to that viscous and dry friction so that the simulation differs from the model given to the controller. To solve the ode we use Euler with time step 1e-5.
T = 1.0s
control_freq = 100Hz
We first solve the swing up offline and use this as a warm start for the first loop.
At each iteration we use the previous solution as a warm start
To solve we use BoxDDP with 3 max iter and feasible=False.
state_cost=0.1
terminal_state_cost=1000
control_cost=1e5/dt

Here is the result

MPC has to replan at each timestep because of integration error and model error :

state command
image image

The solver takes less than 10ms to give the command so it would fit in 100Hz !

image

The trajectory found is pretty smooth

image

Capture.video.du.22-04-2024.19.54.10.webm

@pierfabre pierfabre linked a pull request May 30, 2024 that will close this issue
3 tasks
@pierfabre pierfabre self-assigned this May 30, 2024
@pierfabre
Copy link
Collaborator Author

pierfabre commented Jul 16, 2024

20240716 - Update on NMPC swing up with the new URDF

  • Following the improvements made on system id (see system identification #68) I wanted to see if my optimal control solver crocoddyl was still able to find a way to swing up the pendulum
  • Previously I used BoxDDP (which allows to constrain the control input) but this time I wanted to use the SQP recently introduced in mim_solvers that "solves nonlinear constrained OCPs efficiently by leveraging sparsity".
  • In the future it would also be interesting to compare performance with ProxDDP
nmpc_swing_up.webm

image

  • Next step : Swing up of the real robot! 🚀

@pierfabre pierfabre pinned this issue Jul 16, 2024
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 a pull request may close this issue.

1 participant