Skip to content

Commit

Permalink
[Control][MPC] fix compatibility with python2; fix compatibility in f…
Browse files Browse the repository at this point in the history
…unction definition for CasADi 3.6.3
  • Loading branch information
Li-Jinjie committed Nov 9, 2023
1 parent 4ed7650 commit ce9602a
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Date: 2023/4/16 9:50 AM
Description:
"""
from __future__ import print_function # be compatible with python2
import os
import sys
import shutil
Expand Down Expand Up @@ -165,7 +166,7 @@ def __init__(self):
)

# function
f = ca.Function("f", [states, controls], [ds], ["state", "control_input"], ["ds"])
f = ca.Function("f", [states, controls], [ds], ["state", "control_input"], ["ds"], {"allow_free": True})

# NONLINEAR_LS = error^T @ Q @ error; error = y - y_ref
qe_x = qwr * qx - qw * qxr + qyr * qz - qy * qzr
Expand Down Expand Up @@ -238,8 +239,8 @@ def safe_mkdir_recursive(directory, overwrite=False):
# read parameters from launch file
mpc_ctl = NMPCBodyRateController()

print(f"Successfully initialized acados ocp solver: {mpc_ctl.solver}")
print(f"T_samp: {nmpc_params['T_samp']}")
print(f"T_pred: {nmpc_params['T_pred']}")
print(f"T_integ: {nmpc_params['T_integ']}")
print(f"N_node: {nmpc_params['N_node']}")
print("Successfully initialized acados ocp solver: ", mpc_ctl.solver)
print("T_samp: ", nmpc_params["T_samp"])
print("T_pred: ", nmpc_params["T_pred"])
print("T_integ: ", nmpc_params["T_integ"])
print("N_node: ", nmpc_params["N_node"])

0 comments on commit ce9602a

Please sign in to comment.