class LQRTest(ActionModelAbstractTestCase): NX = randint(2, 21) NU = randint(2, NX) MODEL = crocoddyl.ActionModelLQR(NX, NU) MODEL_DER = LQRModelDerived(NX, NU)
import crocoddyl import numpy as np from crocoddyl import a2m from crocoddyl.fddp import SolverFDDP from numpy import dot np.random.seed(0) NX, NU = 2, 1 T = 10 models = [ crocoddyl.ActionModelLQR(NX, NU, driftFree=False) for t in range(T + 1) ] x0 = np.array([1.] * NX) problem = crocoddyl.ShootingProblem(x0, models[:-1], models[-1]) # models[1].Lx[:] = 0 # models[0].Lx[:] = 0 # models[0].Fx[:,:] = 0 # models[0].Fu[:,:] = 0 # x0[:] =0 # models[0].f0[:] = 0 ddp = SolverFDDP(problem) ddp.regMin = 0 kkt = crocoddyl.SolverKKT(problem) [xskkt, uskkt, donekkt] = kkt.solve(maxiter=1) # [xsddp,usddp,doneddp] = ddp.solve(maxiter=1,regInit=0) ddp.x_reg = 0