Hello everyone,
being new in Acados, I have a two questions concerning the code generation:
I implemented a Tube MPC, where a parameter M for the shape of the Tube at every stage along the prediction horizon is used. Since the AcadosOcpSolver class has a set method, I am updating this parameter with numerical values and then regenerate the code with the updated shape of the tube. Code looks like this:
# create instance of the AcadosOcpSolver, generates automatically
acados_ocp_solver = AcadosOcpSolver(ocp, json_file = f"{ocp.code_export_directory}/acados_ocp_{ocp.model.name}.json")
for i in range(1,N+1):
param_i = M_vec_i # flattened, numerical parameter M at stage i
acados_ocp_solver.set(i, "p", param_i)
# generate and compile code again
acados_ocp_solver.generate(ocp, json_file = f"{ocp.code_export_directory}/acados_ocp_{ocp.model.name}.json")
acados_ocp_solver.build(ocp.code_export_directory)
I am searching for the values of the parameter in the generated code to verify if they have been implemented correctly, but I am not able to track where the parameter has been placed, especially for each stage individually. Any hint how to find it in the generated code (if my approach is actually ok)?
Also, any new code generation removes the last generated code (if placed at the same location), so that previous changes to the c-code get lost. How would the workflow look like to minimize this during development?
Thanks for any help
Daniel