Go to the source code of this file.
|
| float | Ts = 0.05 |
| |
| int | N_hor = 18 |
| |
| int | N_sim = 80 |
| |
| bool | multipleshooting = False |
| |
| int | R_obstacle = 2 |
| |
| | f |
| |
| | nlp |
| |
| | bounds |
| |
| | n_states |
| |
| | n_inputs |
| |
| | first_input_idx |
| |
| string | name = "mpcproblem" |
| |
| | f_prob = cs.Function("f", [nlp["x"], nlp["p"]], [nlp["f"]]) |
| |
| | g_prob = cs.Function("g", [nlp["x"], nlp["p"]], [nlp["g"]]) |
| |
| | prob = pa.generate_and_compile_casadi_problem(f_prob, g_prob, name=name) |
| |
| | lowerbound |
| |
| | upperbound |
| |
| int | lbfgsmem = N_hor |
| |
| int | tol = 1e-5 |
| |
| bool | verbose = False |
| |
| dictionary | panocparams |
| |
| | innersolver |
| |
| | almparams |
| |
| | solver = pa.ALMSolver(almparams, innersolver) |
| |
| | state = np.array([-5, 0, 0, 0]) |
| |
| | dest = np.array([5, 0.1, 0, 0]) |
| |
| | x_sol = np.concatenate((np.tile(state, N_hor), np.zeros((n_inputs * N_hor,)))) |
| |
| | y_sol = np.zeros((prob.m,)) |
| |
| | xs = np.zeros((N_sim, n_states)) |
| |
| | times = np.zeros((N_sim,)) |
| |
| | t |
| |
| | stats |
| |
| | input = x_sol[first_input_idx : first_input_idx + n_inputs] |
| |
| | fig_trajectory |
| |
| | ax |
| |
| | c = plt.Circle((0, 0), R_obstacle) |
| |
| | fig_time |
| |