Armandpl / furuta

Building and Training a Rotary Inverted Pendulum robot
21 stars 4 forks source link

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

Open pierfabre opened 9 months ago

pierfabre commented 9 months ago

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

pierfabre commented 7 months ago

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 vidéo du 22-04-2024 19:54:10.webm

pierfabre commented 4 months ago

20240716 - Update on NMPC swing up with the new URDF

nmpc_swing_up.webm

image