diff --git a/remote_control/casadi_opt.py b/remote_control/casadi_opt.py index bdf5f50..cd335cb 100644 --- a/remote_control/casadi_opt.py +++ b/remote_control/casadi_opt.py @@ -139,6 +139,7 @@ class OpenLoopSolver: def solve(self, x0, target, obstacles): + tstart = time.time() # alternative solution using multiple shooting (way faster!) self.opti = Opti() # Optimization problem @@ -163,10 +164,6 @@ class OpenLoopSolver: #self.opti.set_initial(speed, 1) #self.opti.set_initial(T, 1) - - - - tstart = time.time() x = SX.sym('x') y = SX.sym('y') theta = SX.sym('theta') @@ -259,6 +256,7 @@ class OpenLoopSolver: tend = time.time() print("solving the problem took {} seconds".format(tend - tstart)) + tstart = time.time() self.opti_x0 = sol.value(self.opti.x) self.opti_lam_g0 = sol.value(self.opti.lam_g) @@ -266,6 +264,8 @@ class OpenLoopSolver: #u_opt_2 = map(lambda x: float(x), [u_opt[i * 2 + 1] for i in range(0, 60)]) u_opt_1 = sol.value(self.U[0,:]) u_opt_2 = sol.value(self.U[1,:]) + tend = time.time() + print("postprocessing took {} seconds".format(tend - tstart)) return (u_opt_1, u_opt_2, sol.value(posx), sol.value(posy))