Hello!
I constructed a MPC model using python and then utilized acados_template to generate theC-generation code. The model operateds flawlessly on linux platform. Subsequently i attempted to run the identical code on the QNX platform, here are modifications made to the Cmakelists in acados:
set(HPIPM_TARGET "GENERIC" CACHE STRING "HPIPM Target architecture")
set(BLASFEO_TARGET "GENERIC" CACHE STRING "Manually set BLASFEO target")
The cmake command executes successfully and generates libraries in ARM aarch64 format. Then i replace the previous x64 libraries with these newly generated ones and the cross-compiled runs successfully.
-- Target: BLASFEO is GENERIC, HPIPM is GENERIC
-- Linear algebra: HIGH_PERFORMANCE
-- Octave MEX (OFF)
-- System name:version QNX:
-- Build type is Debug
-- OpenMP parallelization is OFF
However, when i attempt to execute the identical code within the qnx system, output of the solver is exceptional:
- The value of nlp_dims->N turns out to be a large number such as 546296 or -3103240, seems like a potential memory leak issue. The code snippet involved is as follows:
ocp_nlp_dims* nlp_dims = lmop_mpc_model_acados_get_nlp_dims(lmop_ocp_capsule_);
std::cout << "nlp_dims->N " << nlp_dims->N << std::endl;
- The solver status returns 0, indicating a seemingly successful execution. But when i use the ocp_nlp_out_get function to read the solver output, the values obtained are not consistent with the results generated when running the same code on the Linux platform. The relevant code is shown below:
double xtraj[NX * 1000];
for (int ii = 0; ii < nlp_dims->N; ii++) {
ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, ii, "x", &xtraj[ii * NX]);
}
First I referred to the following resource and was able to obtain the correct value of nlp_dims->N:
However, after rectifying the nlp_dims->N, the solver gets stuck during the following process:
solver_info_.status = lmop_mpc_model_acados_solve(lmop_ocp_capsule_);
Within the acados library, the relevant function in ocp_nlp_interface.c is as follows:
int ocp_nlp_solve(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out)
{
return solver->config->evaluate(solver->config, solver->dims, nlp_in, nlp_out,
solver->opts, solver->mem, solver->work);
}
My question is, did I miss some parameters or set them incorrectly when generating the aarch64 libraries? Or is there an issue with memory alignment in acados when it runs on different platforms?
Thanks for your advice.
Gavin