From 48d933970bb870dd80e33f40ec47bed0a1a8b848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Fri, 25 Aug 2023 16:51:57 -0700 Subject: [PATCH] mpc_lib: fix dependencies (#29621) * Remove common dependency of lateral mpc * Replace cereal dir dependency with cereal lib in long mpc * Add missing files to generated sources * Typo fix * messaging_python dep old-commit-hash: 517499294afdc16e0178526c5c65f4b29e1226c9 --- SConstruct | 3 ++- selfdrive/controls/lib/lateral_mpc_lib/SConscript | 8 +++++--- selfdrive/controls/lib/longitudinal_mpc_lib/SConscript | 9 ++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/SConstruct b/SConstruct index 8d98eeae39..b5c3f38a7b 100644 --- a/SConstruct +++ b/SConstruct @@ -364,8 +364,9 @@ else: cereal = [File('#cereal/libcereal.a')] messaging = [File('#cereal/libmessaging.a')] visionipc = [File('#cereal/libvisionipc.a')] +messaging_python = [File('#cereal/messaging/messaging_pyx.so')] -Export('cereal', 'messaging', 'visionipc') +Export('cereal', 'messaging', 'messaging_python', 'visionipc') # Build rednose library and ekf models diff --git a/selfdrive/controls/lib/lateral_mpc_lib/SConscript b/selfdrive/controls/lib/lateral_mpc_lib/SConscript index a923baca62..49666abe69 100644 --- a/selfdrive/controls/lib/lateral_mpc_lib/SConscript +++ b/selfdrive/controls/lib/lateral_mpc_lib/SConscript @@ -1,4 +1,4 @@ -Import('env', 'envCython', 'arch', 'common') +Import('env', 'envCython', 'arch') gen = "c_generated_code" @@ -32,7 +32,10 @@ generated_files = [ f'{gen}/Makefile', f'{gen}/main_lat.c', + f'{gen}/main_sim_lat.c', f'{gen}/acados_solver_lat.h', + f'{gen}/acados_sim_solver_lat.h', + f'{gen}/acados_sim_solver_lat.c', f'{gen}/acados_solver.pxd', f'{gen}/lat_model/lat_expl_vde_adj.c', @@ -46,7 +49,7 @@ acados_dir = '#third_party/acados' acados_templates_dir = '#third_party/acados/acados_template/c_templates_tera' source_list = ['lat_mpc.py', - '#/selfdrive/modeld/constants.py', + '#selfdrive/modeld/constants.py', f'{acados_dir}/include/acados_c/ocp_nlp_interface.h', f'{acados_templates_dir}/acados_solver.in.c', ] @@ -57,7 +60,6 @@ lenv.Clean(generated_files, Dir(gen)) generated_lat = lenv.Command(generated_files, source_list, f"cd {Dir('.').abspath} && python3 lat_mpc.py") -lenv.Depends(generated_lat, "#common") lenv["CFLAGS"].append("-DACADOS_WITH_QPOASES") lenv["CXXFLAGS"].append("-DACADOS_WITH_QPOASES") diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript b/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript index c78be70fe3..5ce47eab1c 100644 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript +++ b/selfdrive/controls/lib/longitudinal_mpc_lib/SConscript @@ -1,4 +1,4 @@ -Import('env', 'envCython', 'arch', 'common') +Import('env', 'envCython', 'arch', 'messaging_python') gen = "c_generated_code" @@ -38,7 +38,10 @@ generated_files = [ f'{gen}/Makefile', f'{gen}/main_long.c', + f'{gen}/main_sim_long.c', f'{gen}/acados_solver_long.h', + f'{gen}/acados_sim_solver_long.h', + f'{gen}/acados_sim_solver_long.c', f'{gen}/acados_solver.pxd', f'{gen}/long_model/long_expl_vde_adj.c', @@ -52,7 +55,7 @@ acados_dir = '#third_party/acados' acados_templates_dir = '#third_party/acados/acados_template/c_templates_tera' source_list = ['long_mpc.py', - '#/selfdrive/modeld/constants.py', + '#selfdrive/modeld/constants.py', f'{acados_dir}/include/acados_c/ocp_nlp_interface.h', f'{acados_templates_dir}/acados_solver.in.c', ] @@ -63,7 +66,7 @@ lenv.Clean(generated_files, Dir(gen)) generated_long = lenv.Command(generated_files, source_list, f"cd {Dir('.').abspath} && python3 long_mpc.py") -lenv.Depends(generated_long, "#cereal") +lenv.Depends(generated_long, messaging_python) lenv["CFLAGS"].append("-DACADOS_WITH_QPOASES") lenv["CXXFLAGS"].append("-DACADOS_WITH_QPOASES")