diff --git a/CHANGELOGS.md b/CHANGELOGS.md index bf1d2ca2d..dce4b54fa 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -6,6 +6,8 @@ dragonpilot [latest] - EON/C2 Release * TWEAK: Used fused location service on gpxd. * NEW: Added back auto boot on C2. * NEW: TOYOTA - Door auto lock/unlock. (Thanks to @AlexandreSato and @cydia2020) +* NEW: Added Camera based Driver Monitor back. (This may overheat your device). +* NEW: Added a toggle to turn on/off Camera based Driver Monitor. dragonpilot 2022.08.29 - EON/C2 Release ======================== diff --git a/cereal/libcereal_shared.so b/cereal/libcereal_shared.so index de02b7f8e..2bd027208 100755 Binary files a/cereal/libcereal_shared.so and b/cereal/libcereal_shared.so differ diff --git a/cereal/log.capnp b/cereal/log.capnp index d0dd3f94e..f3f11afce 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -1710,7 +1710,7 @@ struct DriverStateV2 { } } -struct DriverStateDEPRECATED @0xb83c6cc593ed0a00 { +struct DriverState @0xb83c6cc593ed0a00 { frameId @0 :UInt32; modelExecutionTime @14 :Float32; dspExecutionTime @16 :Float32; @@ -2050,6 +2050,6 @@ struct Event { kalmanOdometryDEPRECATED @65 :Legacy.KalmanOdometry; uiLayoutStateDEPRECATED @57 :Legacy.UiLayoutState; pandaStateDEPRECATED @12 :PandaState; - driverStateDEPRECATED @59 :DriverStateDEPRECATED; + driverState @59 :DriverState; } } diff --git a/cereal/messaging/bridge b/cereal/messaging/bridge index c0dfb59bd..484c75cff 100755 Binary files a/cereal/messaging/bridge and b/cereal/messaging/bridge differ diff --git a/cereal/messaging/messaging_pyx.so b/cereal/messaging/messaging_pyx.so index b272d52a4..1f778aff0 100755 Binary files a/cereal/messaging/messaging_pyx.so and b/cereal/messaging/messaging_pyx.so differ diff --git a/cereal/services.h b/cereal/services.h index be495a751..79b959644 100644 --- a/cereal/services.h +++ b/cereal/services.h @@ -37,27 +37,28 @@ static struct service services[] = { { "carEvents", 8033, true, 1, 1 }, { "carParams", 8034, true, 0, 1 }, { "roadCameraState", 8035, true, 20, 20 }, - { "driverCameraState", 8036, true, 20, 20 }, - { "driverEncodeIdx", 8037, false, 20, 1 }, + { "driverCameraState", 8036, true, 10, 10 }, + { "driverEncodeIdx", 8037, false, 10, 1 }, { "driverStateV2", 8038, true, 20, 10 }, - { "driverMonitoringState", 8039, true, 20, 10 }, - { "wideRoadEncodeIdx", 8040, false, 20, 1 }, - { "wideRoadCameraState", 8041, true, 20, 20 }, - { "modelV2", 8042, true, 20, 40 }, - { "managerState", 8043, true, 2, 1 }, - { "uploaderState", 8044, true, 0, 1 }, - { "navInstruction", 8045, true, 1, 10 }, - { "navRoute", 8046, true, 0, -1 }, - { "navThumbnail", 8047, true, 0, -1 }, - { "qRoadEncodeIdx", 8048, false, 20, -1 }, - { "userFlag", 8049, true, 0, 1 }, - { "testJoystick", 8050, true, 0, -1 }, - { "roadEncodeData", 8051, false, 20, -1 }, - { "driverEncodeData", 8052, false, 20, -1 }, - { "wideRoadEncodeData", 8053, false, 20, -1 }, - { "qRoadEncodeData", 8054, false, 20, -1 }, - { "dragonConf", 8055, false, 1, -1 }, - { "liveMapData", 8056, true, 0, -1 }, + { "driverState", 8039, true, 10, 5 }, + { "driverMonitoringState", 8040, true, 10, 5 }, + { "wideRoadEncodeIdx", 8041, false, 20, 1 }, + { "wideRoadCameraState", 8042, true, 20, 20 }, + { "modelV2", 8043, true, 20, 40 }, + { "managerState", 8044, true, 2, 1 }, + { "uploaderState", 8045, true, 0, 1 }, + { "navInstruction", 8046, true, 1, 10 }, + { "navRoute", 8047, true, 0, -1 }, + { "navThumbnail", 8048, true, 0, -1 }, + { "qRoadEncodeIdx", 8049, false, 20, -1 }, + { "userFlag", 8050, true, 0, 1 }, + { "testJoystick", 8051, true, 0, -1 }, + { "roadEncodeData", 8052, false, 20, -1 }, + { "driverEncodeData", 8053, false, 20, -1 }, + { "wideRoadEncodeData", 8054, false, 20, -1 }, + { "qRoadEncodeData", 8055, false, 20, -1 }, + { "dragonConf", 8056, false, 1, -1 }, + { "liveMapData", 8057, true, 0, -1 }, }; #endif diff --git a/cereal/services.py b/cereal/services.py index c1ae59831..4ce412a99 100755 --- a/cereal/services.py +++ b/cereal/services.py @@ -55,10 +55,11 @@ services = { "carEvents": (True, 1., 1), "carParams": (True, 0.02, 1), "roadCameraState": (True, 20., 20), - "driverCameraState": (True, 20., 20), - "driverEncodeIdx": (False, 20., 1), + "driverCameraState": (True, 10., 10), + "driverEncodeIdx": (False, 10., 1), "driverStateV2": (True, 20., 10), - "driverMonitoringState": (True, 20., 10), + "driverState": (True, 10, 5), + "driverMonitoringState": (True, 10., 5), "wideRoadEncodeIdx": (False, 20., 1), "wideRoadCameraState": (True, 20., 20), "modelV2": (True, 20., 40), diff --git a/cereal/visionipc/visionipc_pyx.so b/cereal/visionipc/visionipc_pyx.so index ee9ab9e5e..72551534e 100755 Binary files a/cereal/visionipc/visionipc_pyx.so and b/cereal/visionipc/visionipc_pyx.so differ diff --git a/common/dp_conf.py b/common/dp_conf.py index e1cec5a50..d66cd69e0 100644 --- a/common/dp_conf.py +++ b/common/dp_conf.py @@ -165,6 +165,7 @@ confs = [ # # {'name': 'dp_no_offroad_fix', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, # {'name': 'dp_ftpd', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, + {'name': 'dp_dm', 'default': False, 'type': 'Bool', 'conf_type': ['param']}, ] def get_definition(name): diff --git a/common/params_pyx.so b/common/params_pyx.so index 75db41ea2..f9a2cf33f 100755 Binary files a/common/params_pyx.so and b/common/params_pyx.so differ diff --git a/common/realtime.py b/common/realtime.py index 416d8170d..3a3149201 100644 --- a/common/realtime.py +++ b/common/realtime.py @@ -15,7 +15,7 @@ from system.hardware import PC, TICI DT_CTRL = 0.01 # controlsd DT_MDL = 0.05 # model DT_TRML = 0.5 # thermald and manager -DT_DMON = 0.05 # driver monitoring +DT_DMON = 0.1 # driver monitoring class Priority: diff --git a/common/version.h b/common/version.h index b3f4ee499..2043fca3b 100644 --- a/common/version.h +++ b/common/version.h @@ -1 +1 @@ -#define COMMA_VERSION "2022.09.01" +#define COMMA_VERSION "2022.09.06" diff --git a/opendbc/can/libdbc.so b/opendbc/can/libdbc.so index ca1edfe1d..18b2b0306 100755 Binary files a/opendbc/can/libdbc.so and b/opendbc/can/libdbc.so differ diff --git a/panda/board/obj/bootstub.panda.bin b/panda/board/obj/bootstub.panda.bin index 349cbc105..5147ab867 100755 Binary files a/panda/board/obj/bootstub.panda.bin and b/panda/board/obj/bootstub.panda.bin differ diff --git a/panda/board/obj/panda.bin.signed b/panda/board/obj/panda.bin.signed index ebf6fc93f..bf694ac8c 100644 Binary files a/panda/board/obj/panda.bin.signed and b/panda/board/obj/panda.bin.signed differ diff --git a/panda/board/obj/panda.bin.sspoof.signed b/panda/board/obj/panda.bin.sspoof.signed index 063e6bd28..bf694ac8c 100644 Binary files a/panda/board/obj/panda.bin.sspoof.signed and b/panda/board/obj/panda.bin.sspoof.signed differ diff --git a/panda/board/obj/panda.bin.testing.signed b/panda/board/obj/panda.bin.testing.signed index ef6a5486a..bf694ac8c 100644 Binary files a/panda/board/obj/panda.bin.testing.signed and b/panda/board/obj/panda.bin.testing.signed differ diff --git a/panda/board/obj/panda.bin.testing.sspoof.signed b/panda/board/obj/panda.bin.testing.sspoof.signed index b5adde36e..bf694ac8c 100644 Binary files a/panda/board/obj/panda.bin.testing.sspoof.signed and b/panda/board/obj/panda.bin.testing.sspoof.signed differ diff --git a/rednose/helpers/ekf_sym_pyx.so b/rednose/helpers/ekf_sym_pyx.so index 7ca84ac7b..c4564c3cf 100755 Binary files a/rednose/helpers/ekf_sym_pyx.so and b/rednose/helpers/ekf_sym_pyx.so differ diff --git a/selfdrive/boardd/boardd b/selfdrive/boardd/boardd index 0fa9a7f91..9962181d8 100755 Binary files a/selfdrive/boardd/boardd and b/selfdrive/boardd/boardd differ diff --git a/selfdrive/boardd/boardd_api_impl.so b/selfdrive/boardd/boardd_api_impl.so index 360d4f197..0ba20ca3b 100755 Binary files a/selfdrive/boardd/boardd_api_impl.so and b/selfdrive/boardd/boardd_api_impl.so differ diff --git a/selfdrive/controls/lib/lateral_mpc_lib/acados_ocp_lat.json b/selfdrive/controls/lib/lateral_mpc_lib/acados_ocp_lat.json deleted file mode 100644 index e8d17507c..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/acados_ocp_lat.json +++ /dev/null @@ -1,450 +0,0 @@ -{ - "acados_include_path": "/data/openpilot/third_party/acados/include/acados/include", - "acados_lib_path": "/data/openpilot/third_party/acados/include/acados/lib", - "code_export_directory": "/data/openpilot/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code", - "constraints": { - "C": [], - "C_e": [], - "D": [], - "constr_type": "BGH", - "constr_type_e": "BGH", - "idxbu": [], - "idxbx": [ - 2, - 3 - ], - "idxbx_0": [ - 0, - 1, - 2, - 3 - ], - "idxbx_e": [], - "idxbxe_0": [ - 0, - 1, - 2, - 3 - ], - "idxsbu": [], - "idxsbx": [], - "idxsbx_e": [], - "idxsg": [], - "idxsg_e": [], - "idxsh": [], - "idxsh_e": [], - "idxsphi": [], - "idxsphi_e": [], - "lbu": [], - "lbx": [ - -1.5707963267948966, - -0.8726646259971648 - ], - "lbx_0": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "lbx_e": [], - "lg": [], - "lg_e": [], - "lh": [], - "lh_e": [], - "lphi": [], - "lphi_e": [], - "lsbu": [], - "lsbx": [], - "lsbx_e": [], - "lsg": [], - "lsg_e": [], - "lsh": [], - "lsh_e": [], - "lsphi": [], - "lsphi_e": [], - "ubu": [], - "ubx": [ - 1.5707963267948966, - 0.8726646259971648 - ], - "ubx_0": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "ubx_e": [], - "ug": [], - "ug_e": [], - "uh": [], - "uh_e": [], - "uphi": [], - "uphi_e": [], - "usbu": [], - "usbx": [], - "usbx_e": [], - "usg": [], - "usg_e": [], - "ush": [], - "ush_e": [], - "usphi": [], - "usphi_e": [] - }, - "cost": { - "Vu": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vu_0": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vx": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_0": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_e": [ - [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Vz": [], - "Vz_0": [], - "W": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "W_0": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "W_e": [ - [ - 0.0, - 0.0 - ], - [ - 0.0, - 0.0 - ] - ], - "Zl": [], - "Zl_e": [], - "Zu": [], - "Zu_e": [], - "cost_ext_fun_type": "casadi", - "cost_ext_fun_type_0": "casadi", - "cost_ext_fun_type_e": "casadi", - "cost_type": "NONLINEAR_LS", - "cost_type_0": "NONLINEAR_LS", - "cost_type_e": "NONLINEAR_LS", - "yref": [ - 0.0, - 0.0, - 0.0 - ], - "yref_0": [ - 0.0, - 0.0, - 0.0 - ], - "yref_e": [ - 0.0, - 0.0 - ], - "zl": [], - "zl_e": [], - "zu": [], - "zu_e": [] - }, - "cython_include_dirs": "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/include", - "dims": { - "N": 16, - "nbu": 0, - "nbx": 2, - "nbx_0": 4, - "nbx_e": 0, - "nbxe_0": 4, - "ng": 0, - "ng_e": 0, - "nh": 0, - "nh_e": 0, - "np": 2, - "nphi": 0, - "nphi_e": 0, - "nr": 0, - "nr_e": 0, - "ns": 0, - "ns_e": 0, - "nsbu": 0, - "nsbx": 0, - "nsbx_e": 0, - "nsg": 0, - "nsg_e": 0, - "nsh": 0, - "nsh_e": 0, - "nsphi": 0, - "nsphi_e": 0, - "nu": 1, - "nx": 4, - "ny": 3, - "ny_0": 3, - "ny_e": 2, - "nz": 0 - }, - "model": { - "dyn_disc_fun": null, - "dyn_disc_fun_jac": null, - "dyn_disc_fun_jac_hess": null, - "dyn_ext_fun_type": "casadi", - "dyn_source_discrete": null, - "gnsf": { - "nontrivial_f_LO": 1, - "purely_linear": 0 - }, - "name": "lat" - }, - "parameter_values": [ - 0.0, - 0.0 - ], - "problem_class": "OCP", - "simulink_opts": { - "inputs": { - "cost_W": 0, - "cost_W_0": 0, - "cost_W_e": 0, - "lbu": 1, - "lbx": 1, - "lbx_0": 1, - "lbx_e": 1, - "lg": 1, - "lh": 1, - "parameter_traj": 1, - "reset_solver": 0, - "u_init": 0, - "ubu": 1, - "ubx": 1, - "ubx_0": 1, - "ubx_e": 1, - "ug": 1, - "uh": 1, - "x_init": 0, - "y_ref": 1, - "y_ref_0": 1, - "y_ref_e": 1 - }, - "outputs": { - "CPU_time": 1, - "CPU_time_lin": 0, - "CPU_time_qp": 0, - "CPU_time_sim": 0, - "KKT_residual": 1, - "solver_status": 1, - "sqp_iter": 1, - "u0": 1, - "utraj": 0, - "x1": 1, - "xtraj": 0 - }, - "samplingtime": "t0" - }, - "solver_options": { - "Tsim": 0.009765625, - "alpha_min": 0.05, - "alpha_reduction": 0.7, - "collocation_type": "GAUSS_LEGENDRE", - "eps_sufficient_descent": 0.0001, - "exact_hess_constr": 1, - "exact_hess_cost": 1, - "exact_hess_dyn": 1, - "ext_cost_num_hess": 0, - "full_step_dual": 0, - "globalization": "FIXED_STEP", - "globalization_use_SOC": 0, - "hessian_approx": "GAUSS_NEWTON", - "hpipm_mode": "BALANCE", - "initialize_t_slacks": 0, - "integrator_type": "ERK", - "levenberg_marquardt": 0.0, - "line_search_use_sufficient_descent": 0, - "model_external_shared_lib_dir": null, - "model_external_shared_lib_name": null, - "nlp_solver_max_iter": 100, - "nlp_solver_step_length": 1.0, - "nlp_solver_tol_comp": 1e-06, - "nlp_solver_tol_eq": 1e-06, - "nlp_solver_tol_ineq": 1e-06, - "nlp_solver_tol_stat": 1e-06, - "nlp_solver_type": "SQP_RTI", - "print_level": 0, - "qp_solver": "PARTIAL_CONDENSING_HPIPM", - "qp_solver_cond_N": 1, - "qp_solver_iter_max": 1, - "qp_solver_tol_comp": null, - "qp_solver_tol_eq": null, - "qp_solver_tol_ineq": null, - "qp_solver_tol_stat": null, - "qp_solver_warm_start": 0, - "regularize_method": null, - "sim_method_jac_reuse": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "sim_method_newton_iter": 3, - "sim_method_num_stages": [ - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4 - ], - "sim_method_num_steps": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], - "tf": 2.5, - "time_steps": [ - 0.009765625, - 0.029296875, - 0.048828125, - 0.068359375, - 0.087890625, - 0.107421875, - 0.126953125, - 0.146484375, - 0.166015625, - 0.185546875, - 0.205078125, - 0.224609375, - 0.244140625, - 0.263671875, - 0.283203125, - 0.302734375 - ] - } -} \ No newline at end of file diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c deleted file mode 100644 index d0c541d3b..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ -// standard -#include -#include - -// acados -#include "acados_c/external_function_interface.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#include "acados/sim/sim_common.h" -#include "acados/utils/external_function_generic.h" -#include "acados/utils/print.h" - - -// example specific -#include "lat_model/lat_model.h" -#include "acados_sim_solver_lat.h" - - -// ** solver data ** - -sim_solver_capsule * lat_acados_sim_solver_create_capsule() -{ - void* capsule_mem = malloc(sizeof(sim_solver_capsule)); - sim_solver_capsule *capsule = (sim_solver_capsule *) capsule_mem; - - return capsule; -} - - -int lat_acados_sim_solver_free_capsule(sim_solver_capsule * capsule) -{ - free(capsule); - return 0; -} - - -int lat_acados_sim_create(sim_solver_capsule * capsule) -{ - // initialize - const int nx = LAT_NX; - const int nu = LAT_NU; - const int nz = LAT_NZ; - const int np = LAT_NP; - bool tmp_bool; - - - double Tsim = 0.009765625; - - - // explicit ode - capsule->sim_forw_vde_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - capsule->sim_expl_ode_fun_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - - capsule->sim_forw_vde_casadi->casadi_fun = &lat_expl_vde_forw; - capsule->sim_forw_vde_casadi->casadi_n_in = &lat_expl_vde_forw_n_in; - capsule->sim_forw_vde_casadi->casadi_n_out = &lat_expl_vde_forw_n_out; - capsule->sim_forw_vde_casadi->casadi_sparsity_in = &lat_expl_vde_forw_sparsity_in; - capsule->sim_forw_vde_casadi->casadi_sparsity_out = &lat_expl_vde_forw_sparsity_out; - capsule->sim_forw_vde_casadi->casadi_work = &lat_expl_vde_forw_work; - external_function_param_casadi_create(capsule->sim_forw_vde_casadi, np); - - capsule->sim_expl_ode_fun_casadi->casadi_fun = &lat_expl_ode_fun; - capsule->sim_expl_ode_fun_casadi->casadi_n_in = &lat_expl_ode_fun_n_in; - capsule->sim_expl_ode_fun_casadi->casadi_n_out = &lat_expl_ode_fun_n_out; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_in = &lat_expl_ode_fun_sparsity_in; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_out = &lat_expl_ode_fun_sparsity_out; - capsule->sim_expl_ode_fun_casadi->casadi_work = &lat_expl_ode_fun_work; - external_function_param_casadi_create(capsule->sim_expl_ode_fun_casadi, np); - - - - // sim plan & config - sim_solver_plan_t plan; - plan.sim_solver = ERK; - - // create correct config based on plan - sim_config * lat_sim_config = sim_config_create(plan); - capsule->acados_sim_config = lat_sim_config; - - // sim dims - void *lat_sim_dims = sim_dims_create(lat_sim_config); - capsule->acados_sim_dims = lat_sim_dims; - sim_dims_set(lat_sim_config, lat_sim_dims, "nx", &nx); - sim_dims_set(lat_sim_config, lat_sim_dims, "nu", &nu); - sim_dims_set(lat_sim_config, lat_sim_dims, "nz", &nz); - - - // sim opts - sim_opts *lat_sim_opts = sim_opts_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_opts = lat_sim_opts; - int tmp_int = 3; - sim_opts_set(lat_sim_config, lat_sim_opts, "newton_iter", &tmp_int); - sim_collocation_type collocation_type = GAUSS_LEGENDRE; - sim_opts_set(lat_sim_config, lat_sim_opts, "collocation_type", &collocation_type); - - - tmp_int = 4; - sim_opts_set(lat_sim_config, lat_sim_opts, "num_stages", &tmp_int); - tmp_int = 1; - sim_opts_set(lat_sim_config, lat_sim_opts, "num_steps", &tmp_int); - tmp_bool = 0; - sim_opts_set(lat_sim_config, lat_sim_opts, "jac_reuse", &tmp_bool); - - - // sim in / out - sim_in *lat_sim_in = sim_in_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_in = lat_sim_in; - sim_out *lat_sim_out = sim_out_create(lat_sim_config, lat_sim_dims); - capsule->acados_sim_out = lat_sim_out; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "T", &Tsim); - - // model functions - lat_sim_config->model_set(lat_sim_in->model, - "expl_vde_for", capsule->sim_forw_vde_casadi); - lat_sim_config->model_set(lat_sim_in->model, - "expl_ode_fun", capsule->sim_expl_ode_fun_casadi); - - // sim solver - sim_solver *lat_sim_solver = sim_solver_create(lat_sim_config, - lat_sim_dims, lat_sim_opts); - capsule->acados_sim_solver = lat_sim_solver; - - - /* initialize parameter values */ - double* p = calloc(np, sizeof(double)); - - - lat_acados_sim_update_params(capsule, p, np); - free(p); - - - /* initialize input */ - // x - double x0[4]; - for (int ii = 0; ii < 4; ii++) - x0[ii] = 0.0; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "x", x0); - - - // u - double u0[1]; - for (int ii = 0; ii < 1; ii++) - u0[ii] = 0.0; - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "u", u0); - - // S_forw - double S_forw[20]; - for (int ii = 0; ii < 20; ii++) - S_forw[ii] = 0.0; - for (int ii = 0; ii < 4; ii++) - S_forw[ii + ii * 4 ] = 1.0; - - - sim_in_set(lat_sim_config, lat_sim_dims, - lat_sim_in, "S_forw", S_forw); - - int status = sim_precompute(lat_sim_solver, lat_sim_in, lat_sim_out); - - return status; -} - - -int lat_acados_sim_solve(sim_solver_capsule *capsule) -{ - // integrate dynamics using acados sim_solver - int status = sim_solve(capsule->acados_sim_solver, - capsule->acados_sim_in, capsule->acados_sim_out); - if (status != 0) - printf("error in lat_acados_sim_solve()! Exiting.\n"); - - return status; -} - - -int lat_acados_sim_free(sim_solver_capsule *capsule) -{ - // free memory - sim_solver_destroy(capsule->acados_sim_solver); - sim_in_destroy(capsule->acados_sim_in); - sim_out_destroy(capsule->acados_sim_out); - sim_opts_destroy(capsule->acados_sim_opts); - sim_dims_destroy(capsule->acados_sim_dims); - sim_config_destroy(capsule->acados_sim_config); - - // free external function - external_function_param_casadi_free(capsule->sim_forw_vde_casadi); - external_function_param_casadi_free(capsule->sim_expl_ode_fun_casadi); - - return 0; -} - - -int lat_acados_sim_update_params(sim_solver_capsule *capsule, double *p, int np) -{ - int status = 0; - int casadi_np = LAT_NP; - - if (casadi_np != np) { - printf("lat_acados_sim_update_params: trying to set %i parameters for external functions." - " External function has %i parameters. Exiting.\n", np, casadi_np); - exit(1); - } - capsule->sim_forw_vde_casadi[0].set_param(capsule->sim_forw_vde_casadi, p); - capsule->sim_expl_ode_fun_casadi[0].set_param(capsule->sim_expl_ode_fun_casadi, p); - - return status; -} - -/* getters pointers to C objects*/ -sim_config * lat_acados_get_sim_config(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_config; -}; - -sim_in * lat_acados_get_sim_in(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_in; -}; - -sim_out * lat_acados_get_sim_out(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_out; -}; - -void * lat_acados_get_sim_dims(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_dims; -}; - -sim_opts * lat_acados_get_sim_opts(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_opts; -}; - -sim_solver * lat_acados_get_sim_solver(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_solver; -}; - diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h deleted file mode 100644 index 86b9c84c9..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_sim_solver_lat.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#ifndef ACADOS_SIM_lat_H_ -#define ACADOS_SIM_lat_H_ - -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#define LAT_NX 4 -#define LAT_NZ 0 -#define LAT_NU 1 -#define LAT_NP 2 - -#ifdef __cplusplus -extern "C" { -#endif - - -// ** capsule for solver data ** -typedef struct sim_solver_capsule -{ - // acados objects - sim_in *acados_sim_in; - sim_out *acados_sim_out; - sim_solver *acados_sim_solver; - sim_opts *acados_sim_opts; - sim_config *acados_sim_config; - void *acados_sim_dims; - - /* external functions */ - // ERK - external_function_param_casadi * sim_forw_vde_casadi; - external_function_param_casadi * sim_expl_ode_fun_casadi; - external_function_param_casadi * sim_expl_ode_hess; - - // IRK - external_function_param_casadi * sim_impl_dae_fun; - external_function_param_casadi * sim_impl_dae_fun_jac_x_xdot_z; - external_function_param_casadi * sim_impl_dae_jac_x_xdot_u_z; - external_function_param_casadi * sim_impl_dae_hess; - - // GNSF - external_function_param_casadi * sim_gnsf_phi_fun; - external_function_param_casadi * sim_gnsf_phi_fun_jac_y; - external_function_param_casadi * sim_gnsf_phi_jac_y_uhat; - external_function_param_casadi * sim_gnsf_f_lo_jac_x1_x1dot_u_z; - external_function_param_casadi * sim_gnsf_get_matrices_fun; - -} sim_solver_capsule; - - -ACADOS_SYMBOL_EXPORT int lat_acados_sim_create(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_solve(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_free(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_update_params(sim_solver_capsule *capsule, double *value, int np); - -ACADOS_SYMBOL_EXPORT sim_config * lat_acados_get_sim_config(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_in * lat_acados_get_sim_in(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_out * lat_acados_get_sim_out(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT void * lat_acados_get_sim_dims(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_opts * lat_acados_get_sim_opts(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_solver * lat_acados_get_sim_solver(sim_solver_capsule *capsule); - - -ACADOS_SYMBOL_EXPORT sim_solver_capsule * lat_acados_sim_solver_create_capsule(void); -ACADOS_SYMBOL_EXPORT int lat_acados_sim_solver_free_capsule(sim_solver_capsule *capsule); - -#ifdef __cplusplus -} -#endif - -#endif // ACADOS_SIM_lat_H_ diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c deleted file mode 100644 index 827b6c7f0..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/acados_solver_sfunction_lat.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#define S_FUNCTION_NAME acados_solver_sfunction_lat -#define S_FUNCTION_LEVEL 2 - -#define MDL_START - -// acados -// #include "acados/utils/print.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -// example specific -#include "lat_model/lat_model.h" -#include "acados_solver_lat.h" - -#include "simstruc.h" - -#define SAMPLINGTIME 0.009765625 - -static void mdlInitializeSizes (SimStruct *S) -{ - // specify the number of continuous and discrete states - ssSetNumContStates(S, 0); - ssSetNumDiscStates(S, 0);// specify the number of input ports - if ( !ssSetNumInputPorts(S, 8) ) - return; - - // specify the number of output ports - if ( !ssSetNumOutputPorts(S, 6) ) - return; - - // specify dimension information for the input ports - // lbx_0 - ssSetInputPortVectorDimension(S, 0, 4); - // ubx_0 - ssSetInputPortVectorDimension(S, 1, 4); - // parameters - ssSetInputPortVectorDimension(S, 2, (16+1) * 2); - // y_ref_0 - ssSetInputPortVectorDimension(S, 3, 3); - // y_ref - ssSetInputPortVectorDimension(S, 4, 45); - // y_ref_e - ssSetInputPortVectorDimension(S, 5, 2); - // lbx - ssSetInputPortVectorDimension(S, 6, 30); - // ubx - ssSetInputPortVectorDimension(S, 7, 30);/* specify dimension information for the OUTPUT ports */ - ssSetOutputPortVectorDimension(S, 0, 1 ); - ssSetOutputPortVectorDimension(S, 1, 1 ); - ssSetOutputPortVectorDimension(S, 2, 1 ); - ssSetOutputPortVectorDimension(S, 3, 4 ); // state at shooting node 1 - ssSetOutputPortVectorDimension(S, 4, 1); - ssSetOutputPortVectorDimension(S, 5, 1 ); - - // specify the direct feedthrough status - // should be set to 1 for all inputs used in mdlOutputs - ssSetInputPortDirectFeedThrough(S, 0, 1); - ssSetInputPortDirectFeedThrough(S, 1, 1); - ssSetInputPortDirectFeedThrough(S, 2, 1); - ssSetInputPortDirectFeedThrough(S, 3, 1); - ssSetInputPortDirectFeedThrough(S, 4, 1); - ssSetInputPortDirectFeedThrough(S, 5, 1); - ssSetInputPortDirectFeedThrough(S, 6, 1); - ssSetInputPortDirectFeedThrough(S, 7, 1); - - // one sample time - ssSetNumSampleTimes(S, 1); -} - - -#if defined(MATLAB_MEX_FILE) - -#define MDL_SET_INPUT_PORT_DIMENSION_INFO -#define MDL_SET_OUTPUT_PORT_DIMENSION_INFO - -static void mdlSetInputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetInputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -static void mdlSetOutputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetOutputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -#endif /* MATLAB_MEX_FILE */ - - -static void mdlInitializeSampleTimes(SimStruct *S) -{ - ssSetSampleTime(S, 0, SAMPLINGTIME); - ssSetOffsetTime(S, 0, 0.0); -} - - -static void mdlStart(SimStruct *S) -{ - lat_solver_capsule *capsule = lat_acados_create_capsule(); - lat_acados_create(capsule); - - ssSetUserData(S, (void*)capsule); -} - - -static void mdlOutputs(SimStruct *S, int_T tid) -{ - lat_solver_capsule *capsule = ssGetUserData(S); - ocp_nlp_config *nlp_config = lat_acados_get_nlp_config(capsule); - ocp_nlp_dims *nlp_dims = lat_acados_get_nlp_dims(capsule); - ocp_nlp_in *nlp_in = lat_acados_get_nlp_in(capsule); - ocp_nlp_out *nlp_out = lat_acados_get_nlp_out(capsule); - - InputRealPtrsType in_sign; - - // local buffer - real_t buffer[4]; - - /* go through inputs */ - // lbx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 0); - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "lbx", buffer); - // ubx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 1); - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "ubx", buffer); - // parameters - stage-variant !!! - in_sign = ssGetInputPortRealSignalPtrs(S, 2); - - // update value of parameters - for (int ii = 0; ii <= 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[ii*2+jj]); - lat_acados_update_params(capsule, ii, buffer, 2); - } - - - // y_ref_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 3); - - for (int i = 0; i < 3; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 0, "yref", (void *) buffer); - - - // y_ref - for stages 1 to N-1 - in_sign = ssGetInputPortRealSignalPtrs(S, 4); - - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 3; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*3+jj]); - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, ii, "yref", (void *) buffer); - } - - - // y_ref_e - in_sign = ssGetInputPortRealSignalPtrs(S, 5); - - for (int i = 0; i < 2; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 16, "yref", (void *) buffer); - // lbx - in_sign = ssGetInputPortRealSignalPtrs(S, 6); - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*2+jj]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "lbx", (void *) buffer); - } - // ubx - in_sign = ssGetInputPortRealSignalPtrs(S, 7); - for (int ii = 1; ii < 16; ii++) - { - for (int jj = 0; jj < 2; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*2+jj]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "ubx", (void *) buffer); - } - - /* call solver */ - int rti_phase = 0; - ocp_nlp_solver_opts_set(nlp_config, capsule->nlp_opts, "rti_phase", &rti_phase); - int acados_status = lat_acados_solve(capsule); - - - /* set outputs */ - // assign pointers to output signals - real_t *out_u0, *out_utraj, *out_xtraj, *out_status, *out_sqp_iter, *out_KKT_res, *out_x1, *out_cpu_time, *out_cpu_time_sim, *out_cpu_time_qp, *out_cpu_time_lin; - int tmp_int; - out_u0 = ssGetOutputPortRealSignal(S, 0); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 0, "u", (void *) out_u0); - - - out_status = ssGetOutputPortRealSignal(S, 1); - *out_status = (real_t) acados_status; - out_KKT_res = ssGetOutputPortRealSignal(S, 2); - *out_KKT_res = (real_t) nlp_out->inf_norm_res; - out_x1 = ssGetOutputPortRealSignal(S, 3); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 1, "x", (void *) out_x1); - out_cpu_time = ssGetOutputPortRealSignal(S, 4); - // get solution time - ocp_nlp_get(nlp_config, capsule->nlp_solver, "time_tot", (void *) out_cpu_time); - out_sqp_iter = ssGetOutputPortRealSignal(S, 5); - // get sqp iter - ocp_nlp_get(nlp_config, capsule->nlp_solver, "sqp_iter", (void *) &tmp_int); - *out_sqp_iter = (real_t) tmp_int; - -} - -static void mdlTerminate(SimStruct *S) -{ - lat_solver_capsule *capsule = ssGetUserData(S); - - lat_acados_free(capsule); - lat_acados_free_capsule(capsule); -} - - -#ifdef MATLAB_MEX_FILE -#include "simulink.c" -#else -#include "cg_sfun.h" -#endif diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c deleted file mode 100644 index c536654fd..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/main_sim_lat.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - - -// standard -#include -#include -// acados -#include "acados/utils/print.h" -#include "acados/utils/math.h" -#include "acados_c/sim_interface.h" -#include "acados_sim_solver_lat.h" - -#define NX LAT_NX -#define NZ LAT_NZ -#define NU LAT_NU -#define NP LAT_NP - - -int main() -{ - int status = 0; - sim_solver_capsule *capsule = lat_acados_sim_solver_create_capsule(); - status = lat_acados_sim_create(capsule); - - if (status) - { - printf("acados_create() returned status %d. Exiting.\n", status); - exit(1); - } - - sim_config *acados_sim_config = lat_acados_get_sim_config(capsule); - sim_in *acados_sim_in = lat_acados_get_sim_in(capsule); - sim_out *acados_sim_out = lat_acados_get_sim_out(capsule); - void *acados_sim_dims = lat_acados_get_sim_dims(capsule); - - // initial condition - double x_current[NX]; - x_current[0] = 0.0; - x_current[1] = 0.0; - x_current[2] = 0.0; - x_current[3] = 0.0; - - - x_current[0] = 0; - x_current[1] = 0; - x_current[2] = 0; - x_current[3] = 0; - - - - - // initial value for control input - double u0[NU]; - u0[0] = 0.0; - // set parameters - double p[NP]; - p[0] = 0; - p[1] = 0; - - lat_acados_sim_update_params(capsule, p, NP); - - - int n_sim_steps = 3; - // solve ocp in loop - for (int ii = 0; ii < n_sim_steps; ii++) - { - sim_in_set(acados_sim_config, acados_sim_dims, - acados_sim_in, "x", x_current); - status = lat_acados_sim_solve(capsule); - - if (status != ACADOS_SUCCESS) - { - printf("acados_solve() failed with status %d.\n", status); - } - - sim_out_get(acados_sim_config, acados_sim_dims, - acados_sim_out, "x", x_current); - - printf("\nx_current, %d\n", ii); - for (int jj = 0; jj < NX; jj++) - { - printf("%e\n", x_current[jj]); - } - } - - printf("\nPerformed %d simulation steps with acados integrator successfully.\n\n", n_sim_steps); - - // free solver - status = lat_acados_sim_free(capsule); - if (status) { - printf("lat_acados_sim_free() returned status %d. \n", status); - } - - lat_acados_sim_solver_free_capsule(capsule); - - return status; -} diff --git a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m b/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m deleted file mode 100644 index 2c6679ecb..000000000 --- a/selfdrive/controls/lib/lateral_mpc_lib/c_generated_code/make_sfun_lat.m +++ /dev/null @@ -1,125 +0,0 @@ -% -% Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, -% Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, -% Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, -% Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl -% -% This file is part of acados. -% -% The 2-Clause BSD License -% -% Redistribution and use in source and binary forms, with or without -% modification, are permitted provided that the following conditions are met: -% -% 1. Redistributions of source code must retain the above copyright notice, -% this list of conditions and the following disclaimer. -% -% 2. Redistributions in binary form must reproduce the above copyright notice, -% this list of conditions and the following disclaimer in the documentation -% and/or other materials provided with the distribution. -% -% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -% POSSIBILITY OF SUCH DAMAGE.; -% - -SOURCES = { ... - 'lat_model/lat_expl_ode_fun.c', ... - 'lat_model/lat_expl_vde_forw.c',... - 'lat_cost/lat_cost_y_0_fun.c',... - 'lat_cost/lat_cost_y_0_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_0_hess.c',... - 'lat_cost/lat_cost_y_fun.c',... - 'lat_cost/lat_cost_y_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_hess.c',... - 'lat_cost/lat_cost_y_e_fun.c',... - 'lat_cost/lat_cost_y_e_fun_jac_ut_xt.c',... - 'lat_cost/lat_cost_y_e_hess.c',... - 'acados_solver_sfunction_lat.c', ... - 'acados_solver_lat.c' - }; - -INC_PATH = '/data/openpilot/third_party/acados/include/acados/include'; - -INCS = {['-I', fullfile(INC_PATH, 'blasfeo', 'include')], ... - ['-I', fullfile(INC_PATH, 'hpipm', 'include')], ... - ['-I', fullfile(INC_PATH, 'acados')], ... - ['-I', fullfile(INC_PATH)]}; - - - -CFLAGS = 'CFLAGS=$CFLAGS'; -LDFLAGS = 'LDFLAGS=$LDFLAGS'; -COMPFLAGS = 'COMPFLAGS=$COMPFLAGS'; -COMPDEFINES = 'COMPDEFINES=$COMPDEFINES'; - - - -LIB_PATH = ['-L', fullfile('/data/openpilot/third_party/acados/include/acados/lib')]; - -LIBS = {'-lacados', '-lhpipm', '-lblasfeo'}; - -% acados linking libraries and flags - - -mex('-v', '-O', CFLAGS, LDFLAGS, COMPFLAGS, COMPDEFINES, INCS{:}, ... - LIB_PATH, LIBS{:}, SOURCES{:}, ... - '-output', 'acados_solver_sfunction_lat' ); - -fprintf( [ '\n\nSuccessfully created sfunction:\nacados_solver_sfunction_lat', '.', ... - eval('mexext')] ); - - -%% print note on usage of s-function -fprintf('\n\nNote: Usage of Sfunction is as follows:\n') -input_note = 'Inputs are:\n'; -i_in = 1; -input_note = strcat(input_note, num2str(i_in), ') lbx_0 - lower bound on x for stage 0,',... - ' size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx_0 - upper bound on x for stage 0,',... - ' size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') parameters - concatenated for all shooting nodes 0 to N+1,',... - ' size [34]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_0, size [3]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref - concatenated for shooting nodes 1 to N-1,',... - ' size [45]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_e, size [2]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') lbx for shooting nodes 1 to N-1, size [30]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx for shooting nodes 1 to N-1, size [30]\n '); -i_in = i_in + 1; - -fprintf(input_note) - -disp(' ') - -output_note = 'Outputs are:\n'; -i_out = 0; -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') u0, control input at node 0, size [1]\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') acados solver status (0 = SUCCESS)\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') KKT residual\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') x1, state at node 1\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') CPU time\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') SQP iterations\n '); - -fprintf(output_note) diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/acados_ocp_long.json b/selfdrive/controls/lib/longitudinal_mpc_lib/acados_ocp_long.json deleted file mode 100644 index 6bfb9b2a2..000000000 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/acados_ocp_long.json +++ /dev/null @@ -1,626 +0,0 @@ -{ - "acados_include_path": "/data/openpilot/third_party/acados/include/acados/include", - "acados_lib_path": "/data/openpilot/third_party/acados/include/acados/lib", - "code_export_directory": "/data/openpilot/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code", - "constraints": { - "C": [], - "C_e": [], - "D": [], - "constr_type": "BGH", - "constr_type_e": "BGH", - "idxbu": [], - "idxbx": [], - "idxbx_0": [ - 0, - 1, - 2 - ], - "idxbx_e": [], - "idxbxe_0": [ - 0, - 1, - 2 - ], - "idxsbu": [], - "idxsbx": [], - "idxsbx_e": [], - "idxsg": [], - "idxsg_e": [], - "idxsh": [ - 0, - 1, - 2, - 3 - ], - "idxsh_e": [], - "idxsphi": [], - "idxsphi_e": [], - "lbu": [], - "lbx": [], - "lbx_0": [ - 0.0, - 0.0, - 0.0 - ], - "lbx_e": [], - "lg": [], - "lg_e": [], - "lh": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "lh_e": [], - "lphi": [], - "lphi_e": [], - "lsbu": [], - "lsbx": [], - "lsbx_e": [], - "lsg": [], - "lsg_e": [], - "lsh": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "lsh_e": [], - "lsphi": [], - "lsphi_e": [], - "ubu": [], - "ubx": [], - "ubx_0": [ - 0.0, - 0.0, - 0.0 - ], - "ubx_e": [], - "ug": [], - "ug_e": [], - "uh": [ - 10000.0, - 10000.0, - 10000.0, - 10000.0 - ], - "uh_e": [], - "uphi": [], - "uphi_e": [], - "usbu": [], - "usbx": [], - "usbx_e": [], - "usg": [], - "usg_e": [], - "ush": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "ush_e": [], - "usphi": [], - "usphi_e": [] - }, - "cost": { - "Vu": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vu_0": [ - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ], - [ - 0.0 - ] - ], - "Vx": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_0": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "Vx_e": [ - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0 - ] - ], - "Vz": [], - "Vz_0": [], - "W": [ - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "W_0": [ - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "W_e": [ - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ] - ], - "Zl": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "Zl_e": [], - "Zu": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "Zu_e": [], - "cost_ext_fun_type": "casadi", - "cost_ext_fun_type_0": "casadi", - "cost_ext_fun_type_e": "casadi", - "cost_type": "NONLINEAR_LS", - "cost_type_0": "NONLINEAR_LS", - "cost_type_e": "NONLINEAR_LS", - "yref": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "yref_0": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "yref_e": [ - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "zl": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "zl_e": [], - "zu": [ - 0.0, - 0.0, - 0.0, - 0.0 - ], - "zu_e": [] - }, - "cython_include_dirs": "/data/data/com.termux/files/usr/lib/python3.8/site-packages/numpy/core/include", - "dims": { - "N": 12, - "nbu": 0, - "nbx": 0, - "nbx_0": 3, - "nbx_e": 0, - "nbxe_0": 3, - "ng": 0, - "ng_e": 0, - "nh": 4, - "nh_e": 0, - "np": 5, - "nphi": 0, - "nphi_e": 0, - "nr": 0, - "nr_e": 0, - "ns": 4, - "ns_e": 0, - "nsbu": 0, - "nsbx": 0, - "nsbx_e": 0, - "nsg": 0, - "nsg_e": 0, - "nsh": 4, - "nsh_e": 0, - "nsphi": 0, - "nsphi_e": 0, - "nu": 1, - "nx": 3, - "ny": 6, - "ny_0": 6, - "ny_e": 5, - "nz": 0 - }, - "model": { - "dyn_disc_fun": null, - "dyn_disc_fun_jac": null, - "dyn_disc_fun_jac_hess": null, - "dyn_ext_fun_type": "casadi", - "dyn_source_discrete": null, - "gnsf": { - "nontrivial_f_LO": 1, - "purely_linear": 0 - }, - "name": "long" - }, - "parameter_values": [ - -1.2, - 1.2, - 0.0, - 0.0, - 1.45 - ], - "problem_class": "OCP", - "simulink_opts": { - "inputs": { - "cost_W": 0, - "cost_W_0": 0, - "cost_W_e": 0, - "lbu": 1, - "lbx": 1, - "lbx_0": 1, - "lbx_e": 1, - "lg": 1, - "lh": 1, - "parameter_traj": 1, - "reset_solver": 0, - "u_init": 0, - "ubu": 1, - "ubx": 1, - "ubx_0": 1, - "ubx_e": 1, - "ug": 1, - "uh": 1, - "x_init": 0, - "y_ref": 1, - "y_ref_0": 1, - "y_ref_e": 1 - }, - "outputs": { - "CPU_time": 1, - "CPU_time_lin": 0, - "CPU_time_qp": 0, - "CPU_time_sim": 0, - "KKT_residual": 1, - "solver_status": 1, - "sqp_iter": 1, - "u0": 1, - "utraj": 0, - "x1": 1, - "xtraj": 0 - }, - "samplingtime": "t0" - }, - "solver_options": { - "Tsim": 0.06944444444444445, - "alpha_min": 0.05, - "alpha_reduction": 0.7, - "collocation_type": "GAUSS_LEGENDRE", - "eps_sufficient_descent": 0.0001, - "exact_hess_constr": 1, - "exact_hess_cost": 1, - "exact_hess_dyn": 1, - "ext_cost_num_hess": 0, - "full_step_dual": 0, - "globalization": "FIXED_STEP", - "globalization_use_SOC": 0, - "hessian_approx": "GAUSS_NEWTON", - "hpipm_mode": "BALANCE", - "initialize_t_slacks": 0, - "integrator_type": "ERK", - "levenberg_marquardt": 0.0, - "line_search_use_sufficient_descent": 0, - "model_external_shared_lib_dir": null, - "model_external_shared_lib_name": null, - "nlp_solver_max_iter": 100, - "nlp_solver_step_length": 1.0, - "nlp_solver_tol_comp": 1e-06, - "nlp_solver_tol_eq": 1e-06, - "nlp_solver_tol_ineq": 1e-06, - "nlp_solver_tol_stat": 1e-06, - "nlp_solver_type": "SQP_RTI", - "print_level": 0, - "qp_solver": "PARTIAL_CONDENSING_HPIPM", - "qp_solver_cond_N": 1, - "qp_solver_iter_max": 10, - "qp_solver_tol_comp": 0.001, - "qp_solver_tol_eq": 0.001, - "qp_solver_tol_ineq": 0.001, - "qp_solver_tol_stat": 0.001, - "qp_solver_warm_start": 0, - "regularize_method": null, - "sim_method_jac_reuse": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "sim_method_newton_iter": 3, - "sim_method_num_stages": [ - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4 - ], - "sim_method_num_steps": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], - "tf": 10.0, - "time_steps": [ - 0.06944444444444445, - 0.20833333333333334, - 0.3472222222222222, - 0.48611111111111116, - 0.6250000000000002, - 0.7638888888888886, - 0.9027777777777786, - 1.041666666666666, - 1.1805555555555554, - 1.3194444444444455, - 1.4583333333333313, - 1.5972222222222232 - ] - } -} \ No newline at end of file diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_sim_solver_long.c b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_sim_solver_long.c deleted file mode 100644 index f38e2639e..000000000 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_sim_solver_long.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ -// standard -#include -#include - -// acados -#include "acados_c/external_function_interface.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#include "acados/sim/sim_common.h" -#include "acados/utils/external_function_generic.h" -#include "acados/utils/print.h" - - -// example specific -#include "long_model/long_model.h" -#include "acados_sim_solver_long.h" - - -// ** solver data ** - -sim_solver_capsule * long_acados_sim_solver_create_capsule() -{ - void* capsule_mem = malloc(sizeof(sim_solver_capsule)); - sim_solver_capsule *capsule = (sim_solver_capsule *) capsule_mem; - - return capsule; -} - - -int long_acados_sim_solver_free_capsule(sim_solver_capsule * capsule) -{ - free(capsule); - return 0; -} - - -int long_acados_sim_create(sim_solver_capsule * capsule) -{ - // initialize - const int nx = LONG_NX; - const int nu = LONG_NU; - const int nz = LONG_NZ; - const int np = LONG_NP; - bool tmp_bool; - - - double Tsim = 0.06944444444444445; - - - // explicit ode - capsule->sim_forw_vde_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - capsule->sim_expl_ode_fun_casadi = (external_function_param_casadi *) malloc(sizeof(external_function_param_casadi)); - - capsule->sim_forw_vde_casadi->casadi_fun = &long_expl_vde_forw; - capsule->sim_forw_vde_casadi->casadi_n_in = &long_expl_vde_forw_n_in; - capsule->sim_forw_vde_casadi->casadi_n_out = &long_expl_vde_forw_n_out; - capsule->sim_forw_vde_casadi->casadi_sparsity_in = &long_expl_vde_forw_sparsity_in; - capsule->sim_forw_vde_casadi->casadi_sparsity_out = &long_expl_vde_forw_sparsity_out; - capsule->sim_forw_vde_casadi->casadi_work = &long_expl_vde_forw_work; - external_function_param_casadi_create(capsule->sim_forw_vde_casadi, np); - - capsule->sim_expl_ode_fun_casadi->casadi_fun = &long_expl_ode_fun; - capsule->sim_expl_ode_fun_casadi->casadi_n_in = &long_expl_ode_fun_n_in; - capsule->sim_expl_ode_fun_casadi->casadi_n_out = &long_expl_ode_fun_n_out; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_in = &long_expl_ode_fun_sparsity_in; - capsule->sim_expl_ode_fun_casadi->casadi_sparsity_out = &long_expl_ode_fun_sparsity_out; - capsule->sim_expl_ode_fun_casadi->casadi_work = &long_expl_ode_fun_work; - external_function_param_casadi_create(capsule->sim_expl_ode_fun_casadi, np); - - - - // sim plan & config - sim_solver_plan_t plan; - plan.sim_solver = ERK; - - // create correct config based on plan - sim_config * long_sim_config = sim_config_create(plan); - capsule->acados_sim_config = long_sim_config; - - // sim dims - void *long_sim_dims = sim_dims_create(long_sim_config); - capsule->acados_sim_dims = long_sim_dims; - sim_dims_set(long_sim_config, long_sim_dims, "nx", &nx); - sim_dims_set(long_sim_config, long_sim_dims, "nu", &nu); - sim_dims_set(long_sim_config, long_sim_dims, "nz", &nz); - - - // sim opts - sim_opts *long_sim_opts = sim_opts_create(long_sim_config, long_sim_dims); - capsule->acados_sim_opts = long_sim_opts; - int tmp_int = 3; - sim_opts_set(long_sim_config, long_sim_opts, "newton_iter", &tmp_int); - sim_collocation_type collocation_type = GAUSS_LEGENDRE; - sim_opts_set(long_sim_config, long_sim_opts, "collocation_type", &collocation_type); - - - tmp_int = 4; - sim_opts_set(long_sim_config, long_sim_opts, "num_stages", &tmp_int); - tmp_int = 1; - sim_opts_set(long_sim_config, long_sim_opts, "num_steps", &tmp_int); - tmp_bool = 0; - sim_opts_set(long_sim_config, long_sim_opts, "jac_reuse", &tmp_bool); - - - // sim in / out - sim_in *long_sim_in = sim_in_create(long_sim_config, long_sim_dims); - capsule->acados_sim_in = long_sim_in; - sim_out *long_sim_out = sim_out_create(long_sim_config, long_sim_dims); - capsule->acados_sim_out = long_sim_out; - - sim_in_set(long_sim_config, long_sim_dims, - long_sim_in, "T", &Tsim); - - // model functions - long_sim_config->model_set(long_sim_in->model, - "expl_vde_for", capsule->sim_forw_vde_casadi); - long_sim_config->model_set(long_sim_in->model, - "expl_ode_fun", capsule->sim_expl_ode_fun_casadi); - - // sim solver - sim_solver *long_sim_solver = sim_solver_create(long_sim_config, - long_sim_dims, long_sim_opts); - capsule->acados_sim_solver = long_sim_solver; - - - /* initialize parameter values */ - double* p = calloc(np, sizeof(double)); - - p[0] = -1.2; - p[1] = 1.2; - p[4] = 1.45; - - long_acados_sim_update_params(capsule, p, np); - free(p); - - - /* initialize input */ - // x - double x0[3]; - for (int ii = 0; ii < 3; ii++) - x0[ii] = 0.0; - - sim_in_set(long_sim_config, long_sim_dims, - long_sim_in, "x", x0); - - - // u - double u0[1]; - for (int ii = 0; ii < 1; ii++) - u0[ii] = 0.0; - - sim_in_set(long_sim_config, long_sim_dims, - long_sim_in, "u", u0); - - // S_forw - double S_forw[12]; - for (int ii = 0; ii < 12; ii++) - S_forw[ii] = 0.0; - for (int ii = 0; ii < 3; ii++) - S_forw[ii + ii * 3 ] = 1.0; - - - sim_in_set(long_sim_config, long_sim_dims, - long_sim_in, "S_forw", S_forw); - - int status = sim_precompute(long_sim_solver, long_sim_in, long_sim_out); - - return status; -} - - -int long_acados_sim_solve(sim_solver_capsule *capsule) -{ - // integrate dynamics using acados sim_solver - int status = sim_solve(capsule->acados_sim_solver, - capsule->acados_sim_in, capsule->acados_sim_out); - if (status != 0) - printf("error in long_acados_sim_solve()! Exiting.\n"); - - return status; -} - - -int long_acados_sim_free(sim_solver_capsule *capsule) -{ - // free memory - sim_solver_destroy(capsule->acados_sim_solver); - sim_in_destroy(capsule->acados_sim_in); - sim_out_destroy(capsule->acados_sim_out); - sim_opts_destroy(capsule->acados_sim_opts); - sim_dims_destroy(capsule->acados_sim_dims); - sim_config_destroy(capsule->acados_sim_config); - - // free external function - external_function_param_casadi_free(capsule->sim_forw_vde_casadi); - external_function_param_casadi_free(capsule->sim_expl_ode_fun_casadi); - - return 0; -} - - -int long_acados_sim_update_params(sim_solver_capsule *capsule, double *p, int np) -{ - int status = 0; - int casadi_np = LONG_NP; - - if (casadi_np != np) { - printf("long_acados_sim_update_params: trying to set %i parameters for external functions." - " External function has %i parameters. Exiting.\n", np, casadi_np); - exit(1); - } - capsule->sim_forw_vde_casadi[0].set_param(capsule->sim_forw_vde_casadi, p); - capsule->sim_expl_ode_fun_casadi[0].set_param(capsule->sim_expl_ode_fun_casadi, p); - - return status; -} - -/* getters pointers to C objects*/ -sim_config * long_acados_get_sim_config(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_config; -}; - -sim_in * long_acados_get_sim_in(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_in; -}; - -sim_out * long_acados_get_sim_out(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_out; -}; - -void * long_acados_get_sim_dims(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_dims; -}; - -sim_opts * long_acados_get_sim_opts(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_opts; -}; - -sim_solver * long_acados_get_sim_solver(sim_solver_capsule *capsule) -{ - return capsule->acados_sim_solver; -}; - diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_sim_solver_long.h b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_sim_solver_long.h deleted file mode 100644 index 4a6a4c1fb..000000000 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_sim_solver_long.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#ifndef ACADOS_SIM_long_H_ -#define ACADOS_SIM_long_H_ - -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -#define LONG_NX 3 -#define LONG_NZ 0 -#define LONG_NU 1 -#define LONG_NP 5 - -#ifdef __cplusplus -extern "C" { -#endif - - -// ** capsule for solver data ** -typedef struct sim_solver_capsule -{ - // acados objects - sim_in *acados_sim_in; - sim_out *acados_sim_out; - sim_solver *acados_sim_solver; - sim_opts *acados_sim_opts; - sim_config *acados_sim_config; - void *acados_sim_dims; - - /* external functions */ - // ERK - external_function_param_casadi * sim_forw_vde_casadi; - external_function_param_casadi * sim_expl_ode_fun_casadi; - external_function_param_casadi * sim_expl_ode_hess; - - // IRK - external_function_param_casadi * sim_impl_dae_fun; - external_function_param_casadi * sim_impl_dae_fun_jac_x_xdot_z; - external_function_param_casadi * sim_impl_dae_jac_x_xdot_u_z; - external_function_param_casadi * sim_impl_dae_hess; - - // GNSF - external_function_param_casadi * sim_gnsf_phi_fun; - external_function_param_casadi * sim_gnsf_phi_fun_jac_y; - external_function_param_casadi * sim_gnsf_phi_jac_y_uhat; - external_function_param_casadi * sim_gnsf_f_lo_jac_x1_x1dot_u_z; - external_function_param_casadi * sim_gnsf_get_matrices_fun; - -} sim_solver_capsule; - - -ACADOS_SYMBOL_EXPORT int long_acados_sim_create(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int long_acados_sim_solve(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int long_acados_sim_free(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT int long_acados_sim_update_params(sim_solver_capsule *capsule, double *value, int np); - -ACADOS_SYMBOL_EXPORT sim_config * long_acados_get_sim_config(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_in * long_acados_get_sim_in(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_out * long_acados_get_sim_out(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT void * long_acados_get_sim_dims(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_opts * long_acados_get_sim_opts(sim_solver_capsule *capsule); -ACADOS_SYMBOL_EXPORT sim_solver * long_acados_get_sim_solver(sim_solver_capsule *capsule); - - -ACADOS_SYMBOL_EXPORT sim_solver_capsule * long_acados_sim_solver_create_capsule(void); -ACADOS_SYMBOL_EXPORT int long_acados_sim_solver_free_capsule(sim_solver_capsule *capsule); - -#ifdef __cplusplus -} -#endif - -#endif // ACADOS_SIM_long_H_ diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_solver_sfunction_long.c b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_solver_sfunction_long.c deleted file mode 100644 index 1260bfc8f..000000000 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/acados_solver_sfunction_long.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - -#define S_FUNCTION_NAME acados_solver_sfunction_long -#define S_FUNCTION_LEVEL 2 - -#define MDL_START - -// acados -// #include "acados/utils/print.h" -#include "acados_c/sim_interface.h" -#include "acados_c/external_function_interface.h" - -// example specific -#include "long_model/long_model.h" -#include "acados_solver_long.h" - -#include "simstruc.h" - -#define SAMPLINGTIME 0.06944444444444445 - -static void mdlInitializeSizes (SimStruct *S) -{ - // specify the number of continuous and discrete states - ssSetNumContStates(S, 0); - ssSetNumDiscStates(S, 0);// specify the number of input ports - if ( !ssSetNumInputPorts(S, 8) ) - return; - - // specify the number of output ports - if ( !ssSetNumOutputPorts(S, 6) ) - return; - - // specify dimension information for the input ports - // lbx_0 - ssSetInputPortVectorDimension(S, 0, 3); - // ubx_0 - ssSetInputPortVectorDimension(S, 1, 3); - // parameters - ssSetInputPortVectorDimension(S, 2, (12+1) * 5); - // y_ref_0 - ssSetInputPortVectorDimension(S, 3, 6); - // y_ref - ssSetInputPortVectorDimension(S, 4, 66); - // y_ref_e - ssSetInputPortVectorDimension(S, 5, 5); - // lh - ssSetInputPortVectorDimension(S, 6, 4); - // uh - ssSetInputPortVectorDimension(S, 7, 4);/* specify dimension information for the OUTPUT ports */ - ssSetOutputPortVectorDimension(S, 0, 1 ); - ssSetOutputPortVectorDimension(S, 1, 1 ); - ssSetOutputPortVectorDimension(S, 2, 1 ); - ssSetOutputPortVectorDimension(S, 3, 3 ); // state at shooting node 1 - ssSetOutputPortVectorDimension(S, 4, 1); - ssSetOutputPortVectorDimension(S, 5, 1 ); - - // specify the direct feedthrough status - // should be set to 1 for all inputs used in mdlOutputs - ssSetInputPortDirectFeedThrough(S, 0, 1); - ssSetInputPortDirectFeedThrough(S, 1, 1); - ssSetInputPortDirectFeedThrough(S, 2, 1); - ssSetInputPortDirectFeedThrough(S, 3, 1); - ssSetInputPortDirectFeedThrough(S, 4, 1); - ssSetInputPortDirectFeedThrough(S, 5, 1); - ssSetInputPortDirectFeedThrough(S, 6, 1); - ssSetInputPortDirectFeedThrough(S, 7, 1); - - // one sample time - ssSetNumSampleTimes(S, 1); -} - - -#if defined(MATLAB_MEX_FILE) - -#define MDL_SET_INPUT_PORT_DIMENSION_INFO -#define MDL_SET_OUTPUT_PORT_DIMENSION_INFO - -static void mdlSetInputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetInputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -static void mdlSetOutputPortDimensionInfo(SimStruct *S, int_T port, const DimsInfo_T *dimsInfo) -{ - if ( !ssSetOutputPortDimensionInfo(S, port, dimsInfo) ) - return; -} - -#endif /* MATLAB_MEX_FILE */ - - -static void mdlInitializeSampleTimes(SimStruct *S) -{ - ssSetSampleTime(S, 0, SAMPLINGTIME); - ssSetOffsetTime(S, 0, 0.0); -} - - -static void mdlStart(SimStruct *S) -{ - long_solver_capsule *capsule = long_acados_create_capsule(); - long_acados_create(capsule); - - ssSetUserData(S, (void*)capsule); -} - - -static void mdlOutputs(SimStruct *S, int_T tid) -{ - long_solver_capsule *capsule = ssGetUserData(S); - ocp_nlp_config *nlp_config = long_acados_get_nlp_config(capsule); - ocp_nlp_dims *nlp_dims = long_acados_get_nlp_dims(capsule); - ocp_nlp_in *nlp_in = long_acados_get_nlp_in(capsule); - ocp_nlp_out *nlp_out = long_acados_get_nlp_out(capsule); - - InputRealPtrsType in_sign; - - // local buffer - real_t buffer[6]; - - /* go through inputs */ - // lbx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 0); - for (int i = 0; i < 3; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "lbx", buffer); - // ubx_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 1); - for (int i = 0; i < 3; i++) - buffer[i] = (double)(*in_sign[i]); - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, 0, "ubx", buffer); - // parameters - stage-variant !!! - in_sign = ssGetInputPortRealSignalPtrs(S, 2); - - // update value of parameters - for (int ii = 0; ii <= 12; ii++) - { - for (int jj = 0; jj < 5; jj++) - buffer[jj] = (double)(*in_sign[ii*5+jj]); - long_acados_update_params(capsule, ii, buffer, 5); - } - - - // y_ref_0 - in_sign = ssGetInputPortRealSignalPtrs(S, 3); - - for (int i = 0; i < 6; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 0, "yref", (void *) buffer); - - - // y_ref - for stages 1 to N-1 - in_sign = ssGetInputPortRealSignalPtrs(S, 4); - - for (int ii = 1; ii < 12; ii++) - { - for (int jj = 0; jj < 6; jj++) - buffer[jj] = (double)(*in_sign[(ii-1)*6+jj]); - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, ii, "yref", (void *) buffer); - } - - - // y_ref_e - in_sign = ssGetInputPortRealSignalPtrs(S, 5); - - for (int i = 0; i < 5; i++) - buffer[i] = (double)(*in_sign[i]); - - ocp_nlp_cost_model_set(nlp_config, nlp_dims, nlp_in, 12, "yref", (void *) buffer); - // lh - in_sign = ssGetInputPortRealSignalPtrs(S, 6); - - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - - for (int ii = 0; ii < 12; ii++) - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "lh", buffer); - // uh - in_sign = ssGetInputPortRealSignalPtrs(S, 7); - - for (int i = 0; i < 4; i++) - buffer[i] = (double)(*in_sign[i]); - - for (int ii = 0; ii < 12; ii++) - ocp_nlp_constraints_model_set(nlp_config, nlp_dims, nlp_in, ii, "uh", buffer); - - /* call solver */ - int rti_phase = 0; - ocp_nlp_solver_opts_set(nlp_config, capsule->nlp_opts, "rti_phase", &rti_phase); - int acados_status = long_acados_solve(capsule); - - - /* set outputs */ - // assign pointers to output signals - real_t *out_u0, *out_utraj, *out_xtraj, *out_status, *out_sqp_iter, *out_KKT_res, *out_x1, *out_cpu_time, *out_cpu_time_sim, *out_cpu_time_qp, *out_cpu_time_lin; - int tmp_int; - out_u0 = ssGetOutputPortRealSignal(S, 0); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 0, "u", (void *) out_u0); - - - out_status = ssGetOutputPortRealSignal(S, 1); - *out_status = (real_t) acados_status; - out_KKT_res = ssGetOutputPortRealSignal(S, 2); - *out_KKT_res = (real_t) nlp_out->inf_norm_res; - out_x1 = ssGetOutputPortRealSignal(S, 3); - ocp_nlp_out_get(nlp_config, nlp_dims, nlp_out, 1, "x", (void *) out_x1); - out_cpu_time = ssGetOutputPortRealSignal(S, 4); - // get solution time - ocp_nlp_get(nlp_config, capsule->nlp_solver, "time_tot", (void *) out_cpu_time); - out_sqp_iter = ssGetOutputPortRealSignal(S, 5); - // get sqp iter - ocp_nlp_get(nlp_config, capsule->nlp_solver, "sqp_iter", (void *) &tmp_int); - *out_sqp_iter = (real_t) tmp_int; - -} - -static void mdlTerminate(SimStruct *S) -{ - long_solver_capsule *capsule = ssGetUserData(S); - - long_acados_free(capsule); - long_acados_free_capsule(capsule); -} - - -#ifdef MATLAB_MEX_FILE -#include "simulink.c" -#else -#include "cg_sfun.h" -#endif diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/main_sim_long.c b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/main_sim_long.c deleted file mode 100644 index 571dce390..000000000 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/main_sim_long.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, - * Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, - * Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, - * Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl - * - * This file is part of acados. - * - * The 2-Clause BSD License - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE.; - */ - - -// standard -#include -#include -// acados -#include "acados/utils/print.h" -#include "acados/utils/math.h" -#include "acados_c/sim_interface.h" -#include "acados_sim_solver_long.h" - -#define NX LONG_NX -#define NZ LONG_NZ -#define NU LONG_NU -#define NP LONG_NP - - -int main() -{ - int status = 0; - sim_solver_capsule *capsule = long_acados_sim_solver_create_capsule(); - status = long_acados_sim_create(capsule); - - if (status) - { - printf("acados_create() returned status %d. Exiting.\n", status); - exit(1); - } - - sim_config *acados_sim_config = long_acados_get_sim_config(capsule); - sim_in *acados_sim_in = long_acados_get_sim_in(capsule); - sim_out *acados_sim_out = long_acados_get_sim_out(capsule); - void *acados_sim_dims = long_acados_get_sim_dims(capsule); - - // initial condition - double x_current[NX]; - x_current[0] = 0.0; - x_current[1] = 0.0; - x_current[2] = 0.0; - - - x_current[0] = 0; - x_current[1] = 0; - x_current[2] = 0; - - - - - // initial value for control input - double u0[NU]; - u0[0] = 0.0; - // set parameters - double p[NP]; - p[0] = -1.2; - p[1] = 1.2; - p[2] = 0; - p[3] = 0; - p[4] = 1.45; - - long_acados_sim_update_params(capsule, p, NP); - - - int n_sim_steps = 3; - // solve ocp in loop - for (int ii = 0; ii < n_sim_steps; ii++) - { - sim_in_set(acados_sim_config, acados_sim_dims, - acados_sim_in, "x", x_current); - status = long_acados_sim_solve(capsule); - - if (status != ACADOS_SUCCESS) - { - printf("acados_solve() failed with status %d.\n", status); - } - - sim_out_get(acados_sim_config, acados_sim_dims, - acados_sim_out, "x", x_current); - - printf("\nx_current, %d\n", ii); - for (int jj = 0; jj < NX; jj++) - { - printf("%e\n", x_current[jj]); - } - } - - printf("\nPerformed %d simulation steps with acados integrator successfully.\n\n", n_sim_steps); - - // free solver - status = long_acados_sim_free(capsule); - if (status) { - printf("long_acados_sim_free() returned status %d. \n", status); - } - - long_acados_sim_solver_free_capsule(capsule); - - return status; -} diff --git a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/make_sfun_long.m b/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/make_sfun_long.m deleted file mode 100644 index 0f657cdc5..000000000 --- a/selfdrive/controls/lib/longitudinal_mpc_lib/c_generated_code/make_sfun_long.m +++ /dev/null @@ -1,128 +0,0 @@ -% -% Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, -% Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, -% Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, -% Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl -% -% This file is part of acados. -% -% The 2-Clause BSD License -% -% Redistribution and use in source and binary forms, with or without -% modification, are permitted provided that the following conditions are met: -% -% 1. Redistributions of source code must retain the above copyright notice, -% this list of conditions and the following disclaimer. -% -% 2. Redistributions in binary form must reproduce the above copyright notice, -% this list of conditions and the following disclaimer in the documentation -% and/or other materials provided with the distribution. -% -% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -% POSSIBILITY OF SUCH DAMAGE.; -% - -SOURCES = { ... - 'long_model/long_expl_ode_fun.c', ... - 'long_model/long_expl_vde_forw.c',... - 'long_cost/long_cost_y_0_fun.c',... - 'long_cost/long_cost_y_0_fun_jac_ut_xt.c',... - 'long_cost/long_cost_y_0_hess.c',... - 'long_cost/long_cost_y_fun.c',... - 'long_cost/long_cost_y_fun_jac_ut_xt.c',... - 'long_cost/long_cost_y_hess.c',... - 'long_cost/long_cost_y_e_fun.c',... - 'long_cost/long_cost_y_e_fun_jac_ut_xt.c',... - 'long_cost/long_cost_y_e_hess.c',... - 'long_constraints/long_constr_h_fun.c', ... - 'long_constraints/long_constr_h_fun_jac_uxt_zt_hess.c', ... - 'long_constraints/long_constr_h_fun_jac_uxt_zt.c', ... - 'acados_solver_sfunction_long.c', ... - 'acados_solver_long.c' - }; - -INC_PATH = '/data/openpilot/third_party/acados/include/acados/include'; - -INCS = {['-I', fullfile(INC_PATH, 'blasfeo', 'include')], ... - ['-I', fullfile(INC_PATH, 'hpipm', 'include')], ... - ['-I', fullfile(INC_PATH, 'acados')], ... - ['-I', fullfile(INC_PATH)]}; - - - -CFLAGS = 'CFLAGS=$CFLAGS'; -LDFLAGS = 'LDFLAGS=$LDFLAGS'; -COMPFLAGS = 'COMPFLAGS=$COMPFLAGS'; -COMPDEFINES = 'COMPDEFINES=$COMPDEFINES'; - - - -LIB_PATH = ['-L', fullfile('/data/openpilot/third_party/acados/include/acados/lib')]; - -LIBS = {'-lacados', '-lhpipm', '-lblasfeo'}; - -% acados linking libraries and flags - - -mex('-v', '-O', CFLAGS, LDFLAGS, COMPFLAGS, COMPDEFINES, INCS{:}, ... - LIB_PATH, LIBS{:}, SOURCES{:}, ... - '-output', 'acados_solver_sfunction_long' ); - -fprintf( [ '\n\nSuccessfully created sfunction:\nacados_solver_sfunction_long', '.', ... - eval('mexext')] ); - - -%% print note on usage of s-function -fprintf('\n\nNote: Usage of Sfunction is as follows:\n') -input_note = 'Inputs are:\n'; -i_in = 1; -input_note = strcat(input_note, num2str(i_in), ') lbx_0 - lower bound on x for stage 0,',... - ' size [3]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') ubx_0 - upper bound on x for stage 0,',... - ' size [3]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') parameters - concatenated for all shooting nodes 0 to N+1,',... - ' size [65]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_0, size [6]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref - concatenated for shooting nodes 1 to N-1,',... - ' size [66]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') y_ref_e, size [5]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') lh, size [4]\n '); -i_in = i_in + 1; -input_note = strcat(input_note, num2str(i_in), ') uh, size [4]\n '); -i_in = i_in + 1; - -fprintf(input_note) - -disp(' ') - -output_note = 'Outputs are:\n'; -i_out = 0; -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') u0, control input at node 0, size [1]\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') acados solver status (0 = SUCCESS)\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') KKT residual\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') x1, state at node 1\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') CPU time\n '); -i_out = i_out + 1; -output_note = strcat(output_note, num2str(i_out), ') SQP iterations\n '); - -fprintf(output_note) diff --git a/selfdrive/dragonpilot/dmonitoringd.py b/selfdrive/dragonpilot/dpmonitoringd.py similarity index 95% rename from selfdrive/dragonpilot/dmonitoringd.py rename to selfdrive/dragonpilot/dpmonitoringd.py index cb0016b34..f4d1e831b 100755 --- a/selfdrive/dragonpilot/dmonitoringd.py +++ b/selfdrive/dragonpilot/dpmonitoringd.py @@ -14,8 +14,8 @@ MAX_TERMINAL_ALERTS = 3 # not allowed to engage after 3 terminal alerts MAX_TERMINAL_DURATION = int(30 / DT_DMON) # not allowed to engage after 30s of terminal alerts from common.realtime import Ratekeeper -def dmonitoringd_thread(sm=None, pm=None): - rk = Ratekeeper(20, print_delay_threshold=None) # Keeps rate at 20 hz +def dpmonitoringd_thread(sm=None, pm=None): + rk = Ratekeeper(10, print_delay_threshold=None) # Keeps rate at 10 hz gc.disable() set_realtime_priority(2) @@ -81,7 +81,7 @@ def dmonitoringd_thread(sm=None, pm=None): def main(sm=None, pm=None): - dmonitoringd_thread(sm, pm) + dpmonitoringd_thread(sm, pm) if __name__ == '__main__': diff --git a/selfdrive/locationd/locationd b/selfdrive/locationd/locationd index 44a75a440..862753484 100755 Binary files a/selfdrive/locationd/locationd and b/selfdrive/locationd/locationd differ diff --git a/selfdrive/locationd/ubloxd b/selfdrive/locationd/ubloxd index c338a93b8..f26bc2167 100755 Binary files a/selfdrive/locationd/ubloxd and b/selfdrive/locationd/ubloxd differ diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index 6f33cec2b..6912e852b 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -135,7 +135,7 @@ def manager_thread() -> None: # dp dp_otisserv = params.get_bool('dp_otisserv') - ignore += ['dmonitoringmodeld', 'dmonitoringd'] if params.get_bool('dp_jetson') else [] + ignore += ['dmonitoringmodeld', 'dmonitoringd', 'dpmonitoringd'] if params.get_bool('dp_jetson') else [] ignore += ['otisserv'] if not dp_otisserv else [] dp_mapd = params.get_bool('dp_mapd') ignore += ['mapd'] if not dp_mapd else [] diff --git a/selfdrive/manager/process_config.py b/selfdrive/manager/process_config.py index 7b652e4af..ad63ac6c7 100644 --- a/selfdrive/manager/process_config.py +++ b/selfdrive/manager/process_config.py @@ -7,8 +7,10 @@ from selfdrive.manager.process import PythonProcess, NativeProcess, DaemonProces WEBCAM = os.getenv("USE_WEBCAM") is not None +dp_dm = Params().get_bool('dp_dm') + def driverview(started: bool, params: Params, CP: car.CarParams) -> bool: - return params.get_bool("IsDriverViewEnabled") # type: ignore + return dp_dm and params.get_bool("IsDriverViewEnabled") # type: ignore def notcar(started: bool, params: Params, CP: car.CarParams) -> bool: return CP.notCar # type: ignore @@ -19,7 +21,7 @@ def logging(started, params, CP: car.CarParams) -> bool: procs = [ # due to qualcomm kernel bugs SIGKILLing camerad sometimes causes page table corruption - NativeProcess("camerad", "system/camerad", ["./camerad"], unkillable=True), #, callback=driverview), + NativeProcess("camerad", "system/camerad", ["./camerad"], unkillable=True, callback=driverview), NativeProcess("clocksd", "system/clocksd", ["./clocksd"]), # NativeProcess("logcatd", "system/logcatd", ["./logcatd"]), # NativeProcess("proclogd", "system/proclogd", ["./proclogd"]), @@ -27,7 +29,7 @@ procs = [ # PythonProcess("timezoned", "system.timezoned", enabled=not PC, offroad=True), DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"), - # NativeProcess("dmonitoringmodeld", "selfdrive/modeld", ["./dmonitoringmodeld"], enabled=(not PC or WEBCAM), callback=driverview), + NativeProcess("dmonitoringmodeld", "selfdrive/modeld", ["./dmonitoringmodeld"], enabled=dp_dm, callback=driverview), # NativeProcess("encoderd", "selfdrive/loggerd", ["./encoderd"]), # NativeProcess("loggerd", "selfdrive/loggerd", ["./loggerd"], onroad=False, callback=logging), NativeProcess("modeld", "selfdrive/modeld", ["./modeld"]), @@ -40,7 +42,7 @@ procs = [ PythonProcess("calibrationd", "selfdrive.locationd.calibrationd"), PythonProcess("controlsd", "selfdrive.controls.controlsd"), # PythonProcess("deleter", "selfdrive.loggerd.deleter", offroad=True), - # PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", enabled=(not PC or WEBCAM), callback=driverview), + PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", enabled=dp_dm, callback=driverview), # PythonProcess("laikad", "selfdrive.locationd.laikad"), # PythonProcess("navd", "selfdrive.navd.navd"), PythonProcess("pandad", "selfdrive.boardd.pandad", offroad=True), @@ -66,7 +68,7 @@ procs = [ PythonProcess("rawgpsd", "selfdrive.sensord.rawgps.rawgpsd", enabled=(TICI and os.path.isfile("/persist/comma/use-quectel-rawgps"))), # dp - PythonProcess("dmonitoringd", "selfdrive.dragonpilot.dmonitoringd", enabled=EON), + PythonProcess("dpmonitoringd", "selfdrive.dragonpilot.dpmonitoringd", enabled=not dp_dm), PythonProcess("mapd", "selfdrive.mapd.mapd"), PythonProcess("systemd", "selfdrive.dragonpilot.systemd", offroad=True), PythonProcess("gpxd", "selfdrive.dragonpilot.gpxd"), diff --git a/selfdrive/modeld/_dmonitoringmodeld b/selfdrive/modeld/_dmonitoringmodeld new file mode 100755 index 000000000..28b786cc5 Binary files /dev/null and b/selfdrive/modeld/_dmonitoringmodeld differ diff --git a/selfdrive/modeld/_modeld b/selfdrive/modeld/_modeld index d8f728e6d..4e3a97b2d 100755 Binary files a/selfdrive/modeld/_modeld and b/selfdrive/modeld/_modeld differ diff --git a/selfdrive/modeld/dmonitoringmodeld b/selfdrive/modeld/dmonitoringmodeld index f292fe4c0..0173f907e 100755 --- a/selfdrive/modeld/dmonitoringmodeld +++ b/selfdrive/modeld/dmonitoringmodeld @@ -3,10 +3,16 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" cd $DIR -if [ -f /TICI ]; then - export LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu:/data/pythonpath/third_party/snpe/larch64:$LD_LIBRARY_PATH" - export ADSP_LIBRARY_PATH="/data/pythonpath/third_party/snpe/dsp/" +if [ -d /system ]; then + if [ -f /TICI ]; then # QCOM2 + export LD_LIBRARY_PATH="/usr/lib/aarch64-linux-gnu:/data/pythonpath/third_party/snpe/larch64:$LD_LIBRARY_PATH" + export ADSP_LIBRARY_PATH="/data/pythonpath/third_party/snpe/dsp/" + else # QCOM + export LD_LIBRARY_PATH="../../third_party/snpe/aarch64/:$LD_LIBRARY_PATH" + export ADSP_LIBRARY_PATH="../../third_party/snpe/dsp/" + fi else + # PC export LD_LIBRARY_PATH="$DIR/../../third_party/snpe/x86_64-linux-clang:$DIR/../../openpilot/third_party/snpe/x86_64:$LD_LIBRARY_PATH" fi exec ./_dmonitoringmodeld diff --git a/selfdrive/modeld/models/dmonitoring.h b/selfdrive/modeld/models/dmonitoring.h new file mode 100644 index 000000000..db4e2ef72 --- /dev/null +++ b/selfdrive/modeld/models/dmonitoring.h @@ -0,0 +1,52 @@ +#pragma once + +#include + +#include "cereal/messaging/messaging.h" +#include "common/util.h" +#include "selfdrive/modeld/models/commonmodel.h" +#include "selfdrive/modeld/runners/run.h" + +#define CALIB_LEN 3 + +#define OUTPUT_SIZE 45 +#define REG_SCALE 0.25f + +typedef struct DMonitoringResult { + float face_orientation[3]; + float face_orientation_meta[3]; + float face_position[2]; + float face_position_meta[2]; + float face_prob; + float left_eye_prob; + float right_eye_prob; + float left_blink_prob; + float right_blink_prob; + float sg_prob; + float poor_vision; + float partial_face; + float distracted_pose; + float distracted_eyes; + float occluded_prob; + float ready_prob[4]; + float not_ready_prob[2]; + float dsp_execution_time; +} DMonitoringResult; + +typedef struct DMonitoringModelState { + RunModel *m; + bool is_rhd; + float output[OUTPUT_SIZE]; + std::vector resized_buf; + std::vector cropped_buf; + std::vector premirror_cropped_buf; + std::vector net_input_buf; + float calib[CALIB_LEN]; + float tensor[UINT8_MAX + 1]; +} DMonitoringModelState; + +void dmonitoring_init(DMonitoringModelState* s); +DMonitoringResult dmonitoring_eval_frame(DMonitoringModelState* s, void* stream_buf, int width, int height, float *calib); +void dmonitoring_publish(PubMaster &pm, uint32_t frame_id, const DMonitoringResult &res, float execution_time, kj::ArrayPtr raw_pred); +void dmonitoring_free(DMonitoringModelState* s); + diff --git a/selfdrive/modeld/models/dmonitoring_model_q.dlc b/selfdrive/modeld/models/dmonitoring_model_q.dlc new file mode 100644 index 000000000..03f82c577 Binary files /dev/null and b/selfdrive/modeld/models/dmonitoring_model_q.dlc differ diff --git a/selfdrive/monitoring/dmonitoringd.py b/selfdrive/monitoring/dmonitoringd.py index ff0da8f92..0f05563b6 100755 --- a/selfdrive/monitoring/dmonitoringd.py +++ b/selfdrive/monitoring/dmonitoringd.py @@ -3,7 +3,7 @@ import gc import cereal.messaging as messaging from cereal import car -from common.params import Params, put_bool_nonblocking +from common.params import Params from common.realtime import set_realtime_priority from selfdrive.controls.lib.events import Events from selfdrive.locationd.calibrationd import Calibration @@ -18,9 +18,10 @@ def dmonitoringd_thread(sm=None, pm=None): pm = messaging.PubMaster(['driverMonitoringState']) if sm is None: - sm = messaging.SubMaster(['driverStateV2', 'liveCalibration', 'carState', 'controlsState', 'modelV2'], poll=['driverStateV2']) + sm = messaging.SubMaster(['driverState', 'liveCalibration', 'carState', 'controlsState', 'modelV2'], poll=['driverState']) - driver_status = DriverStatus(rhd_saved=Params().get_bool("IsRhdDetected")) + rhd = Params().get_bool("IsRhdDetected") + driver_status = DriverStatus(rhd=rhd) sm['liveCalibration'].calStatus = Calibration.INVALID sm['liveCalibration'].rpyCalib = [0, 0, 0] @@ -34,7 +35,7 @@ def dmonitoringd_thread(sm=None, pm=None): while True: sm.update() - if not sm.updated['driverStateV2']: + if not sm.updated['driverState']: continue # Get interaction @@ -52,7 +53,7 @@ def dmonitoringd_thread(sm=None, pm=None): # Get data from dmonitoringmodeld events = Events() - driver_status.update_states(sm['driverStateV2'], sm['liveCalibration'].rpyCalib, sm['carState'].vEgo, sm['controlsState'].enabled) + driver_status.update_states(sm['driverState'], sm['liveCalibration'].rpyCalib, sm['carState'].vEgo, sm['controlsState'].enabled) # Block engaging after max number of distrations if driver_status.terminal_alert_cnt >= driver_status.settings._MAX_TERMINAL_ALERTS or \ @@ -80,15 +81,15 @@ def dmonitoringd_thread(sm=None, pm=None): "isLowStd": driver_status.pose.low_std, "hiStdCount": driver_status.hi_stds, "isActiveMode": driver_status.active_monitoring_mode, - "isRHD": driver_status.wheel_on_right, + "isRHD": rhd, } pm.send('driverMonitoringState', dat) - # save rhd virtual toggle every 5 mins - if (sm['driverStateV2'].frameId % 6000 == 0 and - driver_status.wheelpos_learner.filtered_stat.n > driver_status.settings._WHEELPOS_FILTER_MIN_COUNT and - driver_status.wheel_on_right == (driver_status.wheelpos_learner.filtered_stat.M > driver_status.settings._WHEELPOS_THRESHOLD)): - put_bool_nonblocking("IsRhdDetected", driver_status.wheel_on_right) + # # save rhd virtual toggle every 5 mins + # if (sm['driverStateV2'].frameId % 6000 == 0 and + # driver_status.wheelpos_learner.filtered_stat.n > driver_status.settings._WHEELPOS_FILTER_MIN_COUNT and + # driver_status.wheel_on_right == (driver_status.wheelpos_learner.filtered_stat.M > driver_status.settings._WHEELPOS_THRESHOLD)): + # put_bool_nonblocking("IsRhdDetected", driver_status.wheel_on_right) def main(sm=None, pm=None): dmonitoringd_thread(sm, pm) diff --git a/selfdrive/monitoring/driver_monitor.py b/selfdrive/monitoring/driver_monitor.py index 9ff3125c1..4fd703ec1 100644 --- a/selfdrive/monitoring/driver_monitor.py +++ b/selfdrive/monitoring/driver_monitor.py @@ -5,7 +5,6 @@ from common.numpy_fast import interp from common.realtime import DT_DMON from common.filter_simple import FirstOrderFilter from common.stat_live import RunningStatFilter -from common.transformations.camera import tici_d_frame_size EventName = car.CarEvent.EventName @@ -16,7 +15,7 @@ EventName = car.CarEvent.EventName # ****************************************************************************************** class DRIVER_MONITOR_SETTINGS(): - def __init__(self): + def __init__(self, DT_DMON=DT_DMON): self._DT_DMON = DT_DMON # ref (page15-16): https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:42018X1947&rid=2 self._AWARENESS_TIME = 30. # passive wheeltouch total timeout @@ -26,30 +25,33 @@ class DRIVER_MONITOR_SETTINGS(): self._DISTRACTED_PRE_TIME_TILL_TERMINAL = 8. self._DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 6. - self._FACE_THRESHOLD = 0.7 - self._EYE_THRESHOLD = 0.65 - self._SG_THRESHOLD = 0.9 - self._BLINK_THRESHOLD = 0.87 + self._FACE_THRESHOLD = 0.5 + self._PARTIAL_FACE_THRESHOLD = 0.45 + self._EYE_THRESHOLD = 0.6 + self._SG_THRESHOLD = 0.91 + self._BLINK_THRESHOLD = 0.55 + self._BLINK_THRESHOLD_SLACK = 0.7 + self._BLINK_THRESHOLD_STRICT = self._BLINK_THRESHOLD - self._EE_THRESH11 = 0.75 - self._EE_THRESH12 = 3.25 + self._EE_THRESH11 = 0.4 + self._EE_THRESH12 = 2.45 self._EE_THRESH21 = 0.01 self._EE_THRESH22 = 0.35 - self._POSE_PITCH_THRESHOLD = 0.3133 - self._POSE_PITCH_THRESHOLD_SLACK = 0.3237 + self._POSE_PITCH_THRESHOLD = 0.3237 + self._POSE_PITCH_THRESHOLD_SLACK = 0.3657 self._POSE_PITCH_THRESHOLD_STRICT = self._POSE_PITCH_THRESHOLD - self._POSE_YAW_THRESHOLD = 0.4020 - self._POSE_YAW_THRESHOLD_SLACK = 0.5042 + self._POSE_YAW_THRESHOLD = 0.3109 + self._POSE_YAW_THRESHOLD_SLACK = 0.4294 self._POSE_YAW_THRESHOLD_STRICT = self._POSE_YAW_THRESHOLD - self._PITCH_NATURAL_OFFSET = 0.029 # initial value before offset is learned - self._YAW_NATURAL_OFFSET = 0.097 # initial value before offset is learned + self._PITCH_NATURAL_OFFSET = 0.057 # initial value before offset is learned + self._YAW_NATURAL_OFFSET = 0.11 # initial value before offset is learned self._PITCH_MAX_OFFSET = 0.124 self._PITCH_MIN_OFFSET = -0.0881 self._YAW_MAX_OFFSET = 0.289 self._YAW_MIN_OFFSET = -0.0246 - self._POSESTD_THRESHOLD = 0.3 + self._POSESTD_THRESHOLD = 0.315 self._HI_STD_FALLBACK_TIME = int(10 / self._DT_DMON) # fall back to wheel touch if model is uncertain for 10s self._DISTRACTED_FILTER_TS = 0.25 # 0.6Hz @@ -57,10 +59,6 @@ class DRIVER_MONITOR_SETTINGS(): self._POSE_OFFSET_MIN_COUNT = int(60 / self._DT_DMON) # valid data counts before calibration completes, 1min cumulative self._POSE_OFFSET_MAX_COUNT = int(360 / self._DT_DMON) # stop deweighting new data after 6 min, aka "short term memory" - self._WHEELPOS_CALIB_MIN_SPEED = 11 - self._WHEELPOS_THRESHOLD = 0.5 - self._WHEELPOS_FILTER_MIN_COUNT = int(15 / self._DT_DMON) # allow 15 seconds to converge wheel side - self._RECOVERY_FACTOR_MAX = 5. # relative to minus step change self._RECOVERY_FACTOR_MIN = 1.25 # relative to minus step change @@ -68,9 +66,9 @@ class DRIVER_MONITOR_SETTINGS(): self._MAX_TERMINAL_DURATION = int(30 / self._DT_DMON) # not allowed to engage after 30s of terminal alerts -# model output refers to center of undistorted+leveled image -EFL = 598.0 # focal length in K -W, H = tici_d_frame_size # corrected image has same size as raw +# model output refers to center of cropped image, so need to apply the x displacement offset +RESIZED_FOCAL = 320.0 +H, W, FULL_W = 320, 160, 426 class DistractedType: NOT_DISTRACTED = 0 @@ -78,22 +76,22 @@ class DistractedType: DISTRACTED_BLINK = 2 DISTRACTED_E2E = 4 -def face_orientation_from_net(angles_desc, pos_desc, rpy_calib): +def face_orientation_from_net(angles_desc, pos_desc, rpy_calib, is_rhd): # the output of these angles are in device frame # so from driver's perspective, pitch is up and yaw is right pitch_net, yaw_net, roll_net = angles_desc - face_pixel_position = ((pos_desc[0]+0.5)*W, (pos_desc[1]+0.5)*H) - yaw_focal_angle = atan2(face_pixel_position[0] - W//2, EFL) - pitch_focal_angle = atan2(face_pixel_position[1] - H//2, EFL) + face_pixel_position = ((pos_desc[0] + .5)*W - W + FULL_W, (pos_desc[1]+.5)*H) + yaw_focal_angle = atan2(face_pixel_position[0] - FULL_W//2, RESIZED_FOCAL) + pitch_focal_angle = atan2(face_pixel_position[1] - H//2, RESIZED_FOCAL) pitch = pitch_net + pitch_focal_angle yaw = -yaw_net + yaw_focal_angle # no calib for roll pitch -= rpy_calib[1] - yaw -= rpy_calib[2] + yaw -= rpy_calib[2] * (1 - 2 * int(is_rhd)) # lhd -> -=, rhd -> += return roll_net, pitch, yaw class DriverPose(): @@ -114,14 +112,15 @@ class DriverBlink(): def __init__(self): self.left_blink = 0. self.right_blink = 0. + self.cfactor = 1. class DriverStatus(): - def __init__(self, rhd_saved=False, settings=DRIVER_MONITOR_SETTINGS()): + def __init__(self, rhd=False, settings=DRIVER_MONITOR_SETTINGS()): # init policy settings self.settings = settings # init driver status - self.wheelpos_learner = RunningStatFilter() + self.is_rhd_region = rhd self.pose = DriverPose(self.settings._POSE_OFFSET_MAX_COUNT) self.pose_calibrated = False self.blink = DriverBlink() @@ -138,10 +137,8 @@ class DriverStatus(): self.distracted_types = [] self.driver_distracted = False self.driver_distraction_filter = FirstOrderFilter(0., self.settings._DISTRACTED_FILTER_TS, self.settings._DT_DMON) - self.wheel_on_right = False - self.wheel_on_right_last = None - self.wheel_on_right_default = rhd_saved self.face_detected = False + self.face_partial = False self.terminal_alert_cnt = 0 self.terminal_time = 0 self.step_change = 0. @@ -200,7 +197,7 @@ class DriverStatus(): yaw_error > self.settings._POSE_YAW_THRESHOLD*self.pose.cfactor_yaw: distracted_types.append(DistractedType.DISTRACTED_POSE) - if (self.blink.left_blink + self.blink.right_blink)*0.5 > self.settings._BLINK_THRESHOLD: + if (self.blink.left_blink + self.blink.right_blink)*0.5 > self.settings._BLINK_THRESHOLD*self.blink.cfactor: distracted_types.append(DistractedType.DISTRACTED_BLINK) if self.ee1_calibrated: @@ -217,7 +214,13 @@ class DriverStatus(): return distracted_types def set_policy(self, model_data, car_speed): + ep = min(model_data.meta.engagedProb, 0.8) / 0.8 # engaged prob bp = model_data.meta.disengagePredictions.brakeDisengageProbs[0] # brake disengage prob in next 2s + # TODO: retune adaptive blink + self.blink.cfactor = interp(ep, [0, 0.5, 1], + [self.settings._BLINK_THRESHOLD_STRICT, + self.settings._BLINK_THRESHOLD, + self.settings._BLINK_THRESHOLD_SLACK]) / self.settings._BLINK_THRESHOLD k1 = max(-0.00156*((car_speed-16)**2)+0.6, 0.2) bp_normal = max(min(bp / k1, 0.5),0) self.pose.cfactor_pitch = interp(bp_normal, [0, 0.5], @@ -228,42 +231,28 @@ class DriverStatus(): self.settings._POSE_YAW_THRESHOLD_STRICT]) / self.settings._POSE_YAW_THRESHOLD def update_states(self, driver_state, cal_rpy, car_speed, op_engaged): - rhd_pred = driver_state.wheelOnRightProb - # calibrates only when there's movement and either face detected - if car_speed > self.settings._WHEELPOS_CALIB_MIN_SPEED and (driver_state.leftDriverData.faceProb > self.settings._FACE_THRESHOLD or - driver_state.rightDriverData.faceProb > self.settings._FACE_THRESHOLD): - self.wheelpos_learner.push_and_update(rhd_pred) - if self.wheelpos_learner.filtered_stat.n > self.settings._WHEELPOS_FILTER_MIN_COUNT: - self.wheel_on_right = self.wheelpos_learner.filtered_stat.M > self.settings._WHEELPOS_THRESHOLD - else: - self.wheel_on_right = self.wheel_on_right_default # use default/saved if calibration is unfinished - # make sure no switching when engaged - if op_engaged and self.wheel_on_right_last is not None and self.wheel_on_right_last != self.wheel_on_right: - self.wheel_on_right = self.wheel_on_right_last - driver_data = driver_state.rightDriverData if self.wheel_on_right else driver_state.leftDriverData - if not all(len(x) > 0 for x in (driver_data.faceOrientation, driver_data.facePosition, - driver_data.faceOrientationStd, driver_data.facePositionStd, - driver_data.readyProb, driver_data.notReadyProb)): + if not all(len(x) > 0 for x in (driver_state.faceOrientation, driver_state.facePosition, + driver_state.faceOrientationStd, driver_state.facePositionStd, + driver_state.readyProb, driver_state.notReadyProb)): return - self.face_detected = driver_data.faceProb > self.settings._FACE_THRESHOLD - self.pose.roll, self.pose.pitch, self.pose.yaw = face_orientation_from_net(driver_data.faceOrientation, driver_data.facePosition, cal_rpy) - if self.wheel_on_right: - self.pose.yaw *= -1 - self.wheel_on_right_last = self.wheel_on_right - self.pose.pitch_std = driver_data.faceOrientationStd[0] - self.pose.yaw_std = driver_data.faceOrientationStd[1] + self.face_partial = driver_state.partialFace > self.settings._PARTIAL_FACE_THRESHOLD + self.face_detected = driver_state.faceProb > self.settings._FACE_THRESHOLD or self.face_partial + self.pose.roll, self.pose.pitch, self.pose.yaw = face_orientation_from_net(driver_state.faceOrientation, driver_state.facePosition, cal_rpy, self.is_rhd_region) + self.pose.pitch_std = driver_state.faceOrientationStd[0] + self.pose.yaw_std = driver_state.faceOrientationStd[1] + # self.pose.roll_std = driver_state.faceOrientationStd[2] model_std_max = max(self.pose.pitch_std, self.pose.yaw_std) - self.pose.low_std = model_std_max < self.settings._POSESTD_THRESHOLD - self.blink.left_blink = driver_data.leftBlinkProb * (driver_data.leftEyeProb > self.settings._EYE_THRESHOLD) * (driver_data.sunglassesProb < self.settings._SG_THRESHOLD) - self.blink.right_blink = driver_data.rightBlinkProb * (driver_data.rightEyeProb > self.settings._EYE_THRESHOLD) * (driver_data.sunglassesProb < self.settings._SG_THRESHOLD) - self.eev1 = driver_data.notReadyProb[1] - self.eev2 = driver_data.readyProb[0] + self.pose.low_std = model_std_max < self.settings._POSESTD_THRESHOLD and not self.face_partial + self.blink.left_blink = driver_state.leftBlinkProb * (driver_state.leftEyeProb > self.settings._EYE_THRESHOLD) * (driver_state.sunglassesProb < self.settings._SG_THRESHOLD) + self.blink.right_blink = driver_state.rightBlinkProb * (driver_state.rightEyeProb > self.settings._EYE_THRESHOLD) * (driver_state.sunglassesProb < self.settings._SG_THRESHOLD) + self.eev1 = driver_state.notReadyProb[1] + self.eev2 = driver_state.readyProb[0] self.distracted_types = self._get_distracted_types() self.driver_distracted = (DistractedType.DISTRACTED_POSE in self.distracted_types or - DistractedType.DISTRACTED_BLINK in self.distracted_types) and \ - driver_data.faceProb > self.settings._FACE_THRESHOLD and self.pose.low_std + DistractedType.DISTRACTED_BLINK in self.distracted_types) and \ + driver_state.faceProb > self.settings._FACE_THRESHOLD and self.pose.low_std self.driver_distraction_filter.update(self.driver_distracted) # update offseter diff --git a/selfdrive/sensord/_sensord b/selfdrive/sensord/_sensord index c17f9cc82..ae7a89055 100755 Binary files a/selfdrive/sensord/_sensord and b/selfdrive/sensord/_sensord differ diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index a42c2a4a7..b245461e4 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -287,7 +287,7 @@ def thermald_thread(end_event, hw_queue): startup_conditions["free_space"] = msg.deviceState.freeSpacePercent > 2 # startup_conditions["completed_training"] = params.get("CompletedTrainingVersion") == training_version or \ # params.get_bool("Passive") - # startup_conditions["not_driver_view"] = not params.get_bool("IsDriverViewEnabled") + startup_conditions["not_driver_view"] = not params.get_bool("IsDriverViewEnabled") # startup_conditions["not_taking_snapshot"] = not params.get_bool("IsTakingSnapshot") # if any CPU gets above 107 or the battery gets above 63, kill all processes # controls will warn with CPU above 95 or battery above 60 diff --git a/selfdrive/ui/_ui b/selfdrive/ui/_ui index 00f08ab5f..2a279b281 100755 Binary files a/selfdrive/ui/_ui and b/selfdrive/ui/_ui differ diff --git a/selfdrive/ui/qt/spinner b/selfdrive/ui/qt/spinner index ca3784c98..53b1ad78c 100755 Binary files a/selfdrive/ui/qt/spinner and b/selfdrive/ui/qt/spinner differ diff --git a/selfdrive/ui/qt/text b/selfdrive/ui/qt/text index a5f874cfe..c5224d808 100755 Binary files a/selfdrive/ui/qt/text and b/selfdrive/ui/qt/text differ diff --git a/selfdrive/ui/soundd/_soundd b/selfdrive/ui/soundd/_soundd index 84476a869..bb30216b3 100755 Binary files a/selfdrive/ui/soundd/_soundd and b/selfdrive/ui/soundd/_soundd differ diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index 6ca5efaab..c5e6a2359 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -114,109 +114,109 @@ DPCarPanel - + Override Speed When Below - + Override feature will be enabled when set cruise speed is lower than this value. 1 km/h = 0.62 mph. - + km/h - + Turn On Cruise Speed Override - + This feature will let you set your cruise speed below vehicle standard. (usually at 26~40 km/h) - + Toyota / Lexus - + Enable SnG Mod - + Enable this to fix stop and go (SnG) issue on some models. Reboot required. - + Enable AM Physical Button Ctrl - + Enable this to link Accel Mode (AM) control to the physical button (TSS2). ONLY WORK ON SOME OF TSS1 VEHICLES. Reboot required. - + Enable Door Auto Lock - + Enable this to lock doors when drive above 25 km/h. ONLY WORK ON SOME VEHICLES. - + Enable Door Auto Unlock - + Enable this to unlock doors when shift to gear P. ONLY WORK ON SOME VEHICLES. - + Honda - + Enable EPS Mod Mode - + Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. Reboot required. - + Mazda - + Display Below Steer Speed Alert - + Enable this will show below steer speed alert. Thanks to @TheCrowd @@ -225,118 +225,118 @@ Thanks to @TheCrowd DPControlPanel - + ALCA Delay - + Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before peforming lane change automatically. - + secs - + ALCA Min Speed - + ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. - - + + mph - + LCA Min Speed - + LCA minimum engage speed in mph. 1 mph = 1.61 km/h. - + Lateral Ctrl Mode - + 1 = Lane Change Assist (LCA) 2 = Auto Lane Change Assist (ALCA) - + Longitudinal - + Manually Control Accel Mode - + Enable this if you wish to adjust openpilot's acceleration control. - + Enable vision based turn control - + Use vision path predictions to estimate the appropriate speed to drive through turns ahead. - + Lateral - + Use Lane Lines - + Enable this if you wish to use lane lines mode. - + Use LQR Controller - + Enable this if you wish to use LQR instead of PID or INDI controller. WORKS WELL ONLY ON SOME VEHICLES. More linear steering experience. - + Always On Lateral - + Use at your own risk! 1 = Stock Long 2 = OP Long @@ -345,12 +345,12 @@ Reboot required. - + Camera Offset - + Adjust your camera position if your device is not mounted as per guidance. @@ -444,100 +444,115 @@ Reboot required. - Enable Jetson Support + Enable Driver Monitor (Front Cam) + Enable this option if you wish to use front camera for driver monitoring. +On = Front Cam Monitor + Steering Monitor +Off = Steering Monitor only. +Enable this will increase device temp a lot, use at your own risk. +Reboot Required. + + + + + Enable Jetson Support + + + + Enable this option if you intend to run dp on Nvidia Jetson. Reboot required. + Reboot recommended. Reboot? - + Flashing Panda Firmware - + FLASH - + Tap the button to update your panda firmware. The device should reboot once if it finish updating. - + Are you sure you want to flash the panda? - + Are you sure delete all media? - + Pandas Firmware Recovery - + RECOVER - + Tap the button ONLY if your panda ran into issue. - + Are you sure you want to run recover panda script? - + Reset dragonpilot conf - + RESET リセット - + Tap the button to reset all your dragonpilot congiration to default value. Reboot required. - + Are you sure you want to reset dp params? - + Delete All Driving Log - + DELETE - + Tap the button to delete ALL your driving logs (including dashcam / gpx / driving logs). @@ -545,34 +560,34 @@ Reboot required. DPMapsPanel - + Show Full Screen Nav. - + This will show navigation in full screen. Please tap green boarder if you wish to switch back drive view. - + Search Destination using Google Map - + This will allow you to search destination in google map api. You will need to apply your own google map api key.Enter your key detail in web interface once it's enabled. - + Enable Nav. - + This will let use the build in Navigation. Use web interface to control it: *http://<device_ip>:8082*. You will need to apply your own mapbox token at https://www.mapbox.com/. @@ -581,52 +596,52 @@ Reboot required. - + Enable Speed Limit Control - + Use speed limit signs information from map data and car interface to automatically adapt cruise speed to road limits. - + Enable Speed Limit Offset - + Set speed limit slightly higher than actual speed limit for a more natural drive. - + Enable Map Data Turn Control - + Use curvature info from map data to define speed limits to take turns ahead - + Show debug UI elements - + Show UI elements that aid debugging. - + Enable MapD - + Use OSM to assist lateral/longitudinal control. Please note: 1. This feature will works only when your car support OP longitudinal. @@ -639,95 +654,95 @@ Please note: DPUIPanel - + Display Mode - + 0 = Default 1 = Screen Off While Driving - + Screen Brightness - + Adjust your screen brightness. - - + + AUTO - + Alert Volume - + Adjust your alert volume. - + Quiet Drive - + Display alert and play important warning sound. Thanks @sunnyhaibin. - + Display Speed - + Enable this to display your current speed. - + Display Event / Steer Icon - - + + Enable this to display the icon. - + Display Driver Monitor Indicator - + Display Side Info - + Enable this to display steering angle / lead car distance / engine RPM. - + Display Top Info - + Enable this to display time / system temp / battery level. @@ -1145,60 +1160,60 @@ location set mph - - + + MAX 最高速度 - - + + SPEED 速度 - - + + LIMIT 制限速度 - + REAL STEER - + RAM PER - + OFF - + ENG RPM - + NOR - + SPT - + ECO - + ACCEL @@ -1206,17 +1221,17 @@ location set OffroadHome - + UPDATE 更新 - + ALERTS 警告 - + ALERT 警告 @@ -1410,53 +1425,53 @@ location set - + Device デバイス - - + + Network ネットワーク - + Toggles 切り替え - + Software ソフトウェア - + Navigation ナビゲーション - + DP - General - + DP - Controls - + DP - UI - + DP - Cars - + DP - Maps diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 2235b7f36..05d9eb854 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -114,109 +114,109 @@ DPCarPanel - + Override Speed When Below - + Override feature will be enabled when set cruise speed is lower than this value. 1 km/h = 0.62 mph. - + km/h - + Turn On Cruise Speed Override - + This feature will let you set your cruise speed below vehicle standard. (usually at 26~40 km/h) - + Toyota / Lexus - + Enable SnG Mod - + Enable this to fix stop and go (SnG) issue on some models. Reboot required. - + Enable AM Physical Button Ctrl - + Enable this to link Accel Mode (AM) control to the physical button (TSS2). ONLY WORK ON SOME OF TSS1 VEHICLES. Reboot required. - + Enable Door Auto Lock - + Enable this to lock doors when drive above 25 km/h. ONLY WORK ON SOME VEHICLES. - + Enable Door Auto Unlock - + Enable this to unlock doors when shift to gear P. ONLY WORK ON SOME VEHICLES. - + Honda - + Enable EPS Mod Mode - + Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. Reboot required. - + Mazda - + Display Below Steer Speed Alert - + Enable this will show below steer speed alert. Thanks to @TheCrowd @@ -225,118 +225,118 @@ Thanks to @TheCrowd DPControlPanel - + ALCA Delay - + Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before peforming lane change automatically. - + secs - + ALCA Min Speed - + ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. - - + + mph - + LCA Min Speed - + LCA minimum engage speed in mph. 1 mph = 1.61 km/h. - + Lateral Ctrl Mode - + 1 = Lane Change Assist (LCA) 2 = Auto Lane Change Assist (ALCA) - + Longitudinal - + Manually Control Accel Mode - + Enable this if you wish to adjust openpilot's acceleration control. - + Enable vision based turn control - + Use vision path predictions to estimate the appropriate speed to drive through turns ahead. - + Lateral - + Use Lane Lines - + Enable this if you wish to use lane lines mode. - + Use LQR Controller - + Enable this if you wish to use LQR instead of PID or INDI controller. WORKS WELL ONLY ON SOME VEHICLES. More linear steering experience. - + Always On Lateral - + Use at your own risk! 1 = Stock Long 2 = OP Long @@ -345,12 +345,12 @@ Reboot required. - + Camera Offset - + Adjust your camera position if your device is not mounted as per guidance. @@ -444,100 +444,115 @@ Reboot required. - Enable Jetson Support + Enable Driver Monitor (Front Cam) + Enable this option if you wish to use front camera for driver monitoring. +On = Front Cam Monitor + Steering Monitor +Off = Steering Monitor only. +Enable this will increase device temp a lot, use at your own risk. +Reboot Required. + + + + + Enable Jetson Support + + + + Enable this option if you intend to run dp on Nvidia Jetson. Reboot required. + Reboot recommended. Reboot? - + Flashing Panda Firmware - + FLASH - + Tap the button to update your panda firmware. The device should reboot once if it finish updating. - + Are you sure you want to flash the panda? - + Are you sure delete all media? - + Pandas Firmware Recovery - + RECOVER - + Tap the button ONLY if your panda ran into issue. - + Are you sure you want to run recover panda script? - + Reset dragonpilot conf - + RESET 재설정 - + Tap the button to reset all your dragonpilot congiration to default value. Reboot required. - + Are you sure you want to reset dp params? - + Delete All Driving Log - + DELETE - + Tap the button to delete ALL your driving logs (including dashcam / gpx / driving logs). @@ -545,34 +560,34 @@ Reboot required. DPMapsPanel - + Show Full Screen Nav. - + This will show navigation in full screen. Please tap green boarder if you wish to switch back drive view. - + Search Destination using Google Map - + This will allow you to search destination in google map api. You will need to apply your own google map api key.Enter your key detail in web interface once it's enabled. - + Enable Nav. - + This will let use the build in Navigation. Use web interface to control it: *http://<device_ip>:8082*. You will need to apply your own mapbox token at https://www.mapbox.com/. @@ -581,52 +596,52 @@ Reboot required. - + Enable Speed Limit Control - + Use speed limit signs information from map data and car interface to automatically adapt cruise speed to road limits. - + Enable Speed Limit Offset - + Set speed limit slightly higher than actual speed limit for a more natural drive. - + Enable Map Data Turn Control - + Use curvature info from map data to define speed limits to take turns ahead - + Show debug UI elements - + Show UI elements that aid debugging. - + Enable MapD - + Use OSM to assist lateral/longitudinal control. Please note: 1. This feature will works only when your car support OP longitudinal. @@ -639,95 +654,95 @@ Please note: DPUIPanel - + Display Mode - + 0 = Default 1 = Screen Off While Driving - + Screen Brightness - + Adjust your screen brightness. - - + + AUTO - + Alert Volume - + Adjust your alert volume. - + Quiet Drive - + Display alert and play important warning sound. Thanks @sunnyhaibin. - + Display Speed - + Enable this to display your current speed. - + Display Event / Steer Icon - - + + Enable this to display the icon. - + Display Driver Monitor Indicator - + Display Side Info - + Enable this to display steering angle / lead car distance / engine RPM. - + Display Top Info - + Enable this to display time / system temp / battery level. @@ -1145,60 +1160,60 @@ location set mph - - + + MAX MAX - - + + SPEED SPEED - - + + LIMIT LIMIT - + REAL STEER - + RAM PER - + OFF - + ENG RPM - + NOR - + SPT - + ECO - + ACCEL @@ -1206,17 +1221,17 @@ location set OffroadHome - + UPDATE 업데이트 - + ALERTS 알림 - + ALERT 알림 @@ -1410,53 +1425,53 @@ location set - + Device 장치 - - + + Network 네트워크 - + Toggles 토글 - + Software 소프트웨어 - + Navigation 네비게이션 - + DP - General - + DP - Controls - + DP - UI - + DP - Cars - + DP - Maps diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index c31be1239..d8741a4c7 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -114,109 +114,109 @@ DPCarPanel - + Override Speed When Below - + Override feature will be enabled when set cruise speed is lower than this value. 1 km/h = 0.62 mph. - + km/h - + Turn On Cruise Speed Override - + This feature will let you set your cruise speed below vehicle standard. (usually at 26~40 km/h) - + Toyota / Lexus - + Enable SnG Mod - + Enable this to fix stop and go (SnG) issue on some models. Reboot required. - + Enable AM Physical Button Ctrl - + Enable this to link Accel Mode (AM) control to the physical button (TSS2). ONLY WORK ON SOME OF TSS1 VEHICLES. Reboot required. - + Enable Door Auto Lock - + Enable this to lock doors when drive above 25 km/h. ONLY WORK ON SOME VEHICLES. - + Enable Door Auto Unlock - + Enable this to unlock doors when shift to gear P. ONLY WORK ON SOME VEHICLES. - + Honda - + Enable EPS Mod Mode - + Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. Reboot required. - + Mazda - + Display Below Steer Speed Alert - + Enable this will show below steer speed alert. Thanks to @TheCrowd @@ -225,118 +225,118 @@ Thanks to @TheCrowd DPControlPanel - + ALCA Delay - + Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before peforming lane change automatically. - + secs - + ALCA Min Speed - + ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. - - + + mph - + LCA Min Speed - + LCA minimum engage speed in mph. 1 mph = 1.61 km/h. - + Lateral Ctrl Mode - + 1 = Lane Change Assist (LCA) 2 = Auto Lane Change Assist (ALCA) - + Longitudinal - + Manually Control Accel Mode - + Enable this if you wish to adjust openpilot's acceleration control. - + Enable vision based turn control - + Use vision path predictions to estimate the appropriate speed to drive through turns ahead. - + Lateral - + Use Lane Lines - + Enable this if you wish to use lane lines mode. - + Use LQR Controller - + Enable this if you wish to use LQR instead of PID or INDI controller. WORKS WELL ONLY ON SOME VEHICLES. More linear steering experience. - + Always On Lateral - + Use at your own risk! 1 = Stock Long 2 = OP Long @@ -345,12 +345,12 @@ Reboot required. - + Camera Offset - + Adjust your camera position if your device is not mounted as per guidance. @@ -444,100 +444,115 @@ Reboot required. - Enable Jetson Support + Enable Driver Monitor (Front Cam) + Enable this option if you wish to use front camera for driver monitoring. +On = Front Cam Monitor + Steering Monitor +Off = Steering Monitor only. +Enable this will increase device temp a lot, use at your own risk. +Reboot Required. + + + + + Enable Jetson Support + + + + Enable this option if you intend to run dp on Nvidia Jetson. Reboot required. + Reboot recommended. Reboot? - + Flashing Panda Firmware - + FLASH - + Tap the button to update your panda firmware. The device should reboot once if it finish updating. - + Are you sure you want to flash the panda? - + Are you sure delete all media? - + Pandas Firmware Recovery - + RECOVER - + Tap the button ONLY if your panda ran into issue. - + Are you sure you want to run recover panda script? - + Reset dragonpilot conf - + RESET RESET - + Tap the button to reset all your dragonpilot congiration to default value. Reboot required. - + Are you sure you want to reset dp params? - + Delete All Driving Log - + DELETE - + Tap the button to delete ALL your driving logs (including dashcam / gpx / driving logs). @@ -545,34 +560,34 @@ Reboot required. DPMapsPanel - + Show Full Screen Nav. - + This will show navigation in full screen. Please tap green boarder if you wish to switch back drive view. - + Search Destination using Google Map - + This will allow you to search destination in google map api. You will need to apply your own google map api key.Enter your key detail in web interface once it's enabled. - + Enable Nav. - + This will let use the build in Navigation. Use web interface to control it: *http://<device_ip>:8082*. You will need to apply your own mapbox token at https://www.mapbox.com/. @@ -581,52 +596,52 @@ Reboot required. - + Enable Speed Limit Control - + Use speed limit signs information from map data and car interface to automatically adapt cruise speed to road limits. - + Enable Speed Limit Offset - + Set speed limit slightly higher than actual speed limit for a more natural drive. - + Enable Map Data Turn Control - + Use curvature info from map data to define speed limits to take turns ahead - + Show debug UI elements - + Show UI elements that aid debugging. - + Enable MapD - + Use OSM to assist lateral/longitudinal control. Please note: 1. This feature will works only when your car support OP longitudinal. @@ -639,95 +654,95 @@ Please note: DPUIPanel - + Display Mode - + 0 = Default 1 = Screen Off While Driving - + Screen Brightness - + Adjust your screen brightness. - - + + AUTO - + Alert Volume - + Adjust your alert volume. - + Quiet Drive - + Display alert and play important warning sound. Thanks @sunnyhaibin. - + Display Speed - + Enable this to display your current speed. - + Display Event / Steer Icon - - + + Enable this to display the icon. - + Display Driver Monitor Indicator - + Display Side Info - + Enable this to display steering angle / lead car distance / engine RPM. - + Display Top Info - + Enable this to display time / system temp / battery level. @@ -1146,60 +1161,60 @@ trabalho definido mph - - + + MAX LIMITE - - + + SPEED MAX - - + + LIMIT VELO - + REAL STEER - + RAM PER - + OFF - + ENG RPM - + NOR - + SPT - + ECO - + ACCEL @@ -1207,17 +1222,17 @@ trabalho definido OffroadHome - + UPDATE ATUALIZAÇÃO - + ALERTS ALERTAS - + ALERT ALERTA @@ -1414,53 +1429,53 @@ trabalho definido - + Device Dispositivo - - + + Network Rede - + Toggles Ajustes - + Software Software - + Navigation Navegação - + DP - General - + DP - Controls - + DP - UI - + DP - Cars - + DP - Maps diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index 88e561074..6fb39ee15 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -114,109 +114,109 @@ DPCarPanel - + Override Speed When Below - + Override feature will be enabled when set cruise speed is lower than this value. 1 km/h = 0.62 mph. - + km/h - + Turn On Cruise Speed Override - + This feature will let you set your cruise speed below vehicle standard. (usually at 26~40 km/h) - + Toyota / Lexus - + Enable SnG Mod - + Enable this to fix stop and go (SnG) issue on some models. Reboot required. - + Enable AM Physical Button Ctrl - + Enable this to link Accel Mode (AM) control to the physical button (TSS2). ONLY WORK ON SOME OF TSS1 VEHICLES. Reboot required. - + Enable Door Auto Lock - + Enable this to lock doors when drive above 25 km/h. ONLY WORK ON SOME VEHICLES. - + Enable Door Auto Unlock - + Enable this to unlock doors when shift to gear P. ONLY WORK ON SOME VEHICLES. - + Honda - + Enable EPS Mod Mode - + Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. Reboot required. - + Mazda - + Display Below Steer Speed Alert - + Enable this will show below steer speed alert. Thanks to @TheCrowd @@ -225,118 +225,118 @@ Thanks to @TheCrowd DPControlPanel - + ALCA Delay - + Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before peforming lane change automatically. - + secs - + ALCA Min Speed - + ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. - - + + mph - + LCA Min Speed - + LCA minimum engage speed in mph. 1 mph = 1.61 km/h. - + Lateral Ctrl Mode - + 1 = Lane Change Assist (LCA) 2 = Auto Lane Change Assist (ALCA) - + Longitudinal - + Manually Control Accel Mode - + Enable this if you wish to adjust openpilot's acceleration control. - + Enable vision based turn control - + Use vision path predictions to estimate the appropriate speed to drive through turns ahead. - + Lateral - + Use Lane Lines - + Enable this if you wish to use lane lines mode. - + Use LQR Controller - + Enable this if you wish to use LQR instead of PID or INDI controller. WORKS WELL ONLY ON SOME VEHICLES. More linear steering experience. - + Always On Lateral - + Use at your own risk! 1 = Stock Long 2 = OP Long @@ -345,12 +345,12 @@ Reboot required. - + Camera Offset - + Adjust your camera position if your device is not mounted as per guidance. @@ -444,100 +444,115 @@ Reboot required. - Enable Jetson Support + Enable Driver Monitor (Front Cam) + Enable this option if you wish to use front camera for driver monitoring. +On = Front Cam Monitor + Steering Monitor +Off = Steering Monitor only. +Enable this will increase device temp a lot, use at your own risk. +Reboot Required. + + + + + Enable Jetson Support + + + + Enable this option if you intend to run dp on Nvidia Jetson. Reboot required. + Reboot recommended. Reboot? - + Flashing Panda Firmware - + FLASH - + Tap the button to update your panda firmware. The device should reboot once if it finish updating. - + Are you sure you want to flash the panda? - + Are you sure delete all media? - + Pandas Firmware Recovery - + RECOVER - + Tap the button ONLY if your panda ran into issue. - + Are you sure you want to run recover panda script? - + Reset dragonpilot conf - + RESET 重置 - + Tap the button to reset all your dragonpilot congiration to default value. Reboot required. - + Are you sure you want to reset dp params? - + Delete All Driving Log - + DELETE - + Tap the button to delete ALL your driving logs (including dashcam / gpx / driving logs). @@ -545,34 +560,34 @@ Reboot required. DPMapsPanel - + Show Full Screen Nav. - + This will show navigation in full screen. Please tap green boarder if you wish to switch back drive view. - + Search Destination using Google Map - + This will allow you to search destination in google map api. You will need to apply your own google map api key.Enter your key detail in web interface once it's enabled. - + Enable Nav. - + This will let use the build in Navigation. Use web interface to control it: *http://<device_ip>:8082*. You will need to apply your own mapbox token at https://www.mapbox.com/. @@ -581,52 +596,52 @@ Reboot required. - + Enable Speed Limit Control - + Use speed limit signs information from map data and car interface to automatically adapt cruise speed to road limits. - + Enable Speed Limit Offset - + Set speed limit slightly higher than actual speed limit for a more natural drive. - + Enable Map Data Turn Control - + Use curvature info from map data to define speed limits to take turns ahead - + Show debug UI elements - + Show UI elements that aid debugging. - + Enable MapD - + Use OSM to assist lateral/longitudinal control. Please note: 1. This feature will works only when your car support OP longitudinal. @@ -639,95 +654,95 @@ Please note: DPUIPanel - + Display Mode - + 0 = Default 1 = Screen Off While Driving - + Screen Brightness - + Adjust your screen brightness. - - + + AUTO - + Alert Volume - + Adjust your alert volume. - + Quiet Drive - + Display alert and play important warning sound. Thanks @sunnyhaibin. - + Display Speed - + Enable this to display your current speed. - + Display Event / Steer Icon - - + + Enable this to display the icon. - + Display Driver Monitor Indicator - + Display Side Info - + Enable this to display steering angle / lead car distance / engine RPM. - + Display Top Info - + Enable this to display time / system temp / battery level. @@ -1143,60 +1158,60 @@ location set mph - - + + MAX 最高定速 - - + + SPEED SPEED - - + + LIMIT LIMIT - + REAL STEER - + RAM PER - + OFF - + ENG RPM - + NOR - + SPT - + ECO - + ACCEL @@ -1204,17 +1219,17 @@ location set OffroadHome - + UPDATE 更新 - + ALERTS 警报 - + ALERT 警报 @@ -1408,53 +1423,53 @@ location set - + Device 设备 - - + + Network 网络 - + Toggles 设定 - + Software 软件 - + Navigation 导航 - + DP - General - + DP - Controls - + DP - UI - + DP - Cars - + DP - Maps diff --git a/selfdrive/ui/translations/main_zh-CHT.qm b/selfdrive/ui/translations/main_zh-CHT.qm index 49ab5dc9e..8973dc11b 100644 Binary files a/selfdrive/ui/translations/main_zh-CHT.qm and b/selfdrive/ui/translations/main_zh-CHT.qm differ diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index 5c8276452..33562f090 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -114,56 +114,56 @@ DPCarPanel - + Override Speed When Below 改寫定速當定速值低於: - + Override feature will be enabled when set cruise speed is lower than this value. 1 km/h = 0.62 mph. 系統將會改寫定速值當低於此指定的值。 1 km/h = 0.62 mph。 - + km/h 公里 - + Turn On Cruise Speed Override 啟用巡航速度改寫 - + This feature will let you set your cruise speed below vehicle standard. (usually at 26~40 km/h) 開啟這個選項後,您將可以把定速至最低 5km/hr (一般最低為 26~40km/h) - + Toyota / Lexus - + Enable SnG Mod 啟用 SnG 協助 - + Enable this to fix stop and go (SnG) issue on some models. Reboot required. 開啟這個選項可以解決某些車型無法跟車到停後再啟動(SnG)的問題 需要重新啟動。 - + Enable AM Physical Button Ctrl 啟用加速模式和方向盤實體按鈕關聯 - + Enable this to link Accel Mode (AM) control to the physical button (TSS2). ONLY WORK ON SOME OF TSS1 VEHICLES. Reboot required. @@ -172,58 +172,58 @@ Reboot required. 需重新啟動。 - + Enable Door Auto Lock 啟用車門自動上鎖 - + Enable this to lock doors when drive above 25 km/h. ONLY WORK ON SOME VEHICLES. 開啟這個選項後,車子在行駛超過 25 km/h 時會自動上鎖。 並不適用所有的車型。 - + Enable Door Auto Unlock - 啟用車門自動上鎖 + 啟用車門自動解鎖 - + Enable this to unlock doors when shift to gear P. ONLY WORK ON SOME VEHICLES. 開啟這個選項後,車子在打入 P 檔時會自動解鎖。 並不適用所有的車型。 - + Honda - + Enable EPS Mod Mode 啟用 EPS 破解支持 - + Enable this will increase steering, USE IT ONLY if you have a modded EPS firmware. Reboot required. 啟用這個選項後 openpilot 將可以使用更廣的方向盤控制值。註:您的方向盤需要刷過修改過的 EPS 固件。 需重新啟動。 - + Mazda - + Display Below Steer Speed Alert 顯示低速轉向失效提示 - + Enable this will show below steer speed alert. Thanks to @TheCrowd 啟用這個選項後,將在車速低於可輔助轉向的速度時,顯示提示 @@ -232,109 +232,109 @@ Thanks to @TheCrowd DPControlPanel - + ALCA Delay 設置自動換道延遲時間 - + Once the vehicle meets all ALCA criteria, it will wait for the seconds set here before peforming lane change automatically. 一旦車輛滿足所有自動換道的啟動需求,它將會等待設定的秒數後再執行換道。 - + secs 秒 - + ALCA Min Speed 自動換道最低啟用速度 - + ALCA minimum engage speed in mph. 1 mph = 1.61 km/h. 自動換道啟用速度 (單位為每小時英里)。 1 英里 (mph) 約等於 1.61 公里 (km/h)。 - - + + mph 英里 - + LCA Min Speed 輔助換道最低啟用速度 - + LCA minimum engage speed in mph. 1 mph = 1.61 km/h. 輔助換道啟用速度 (單位為每小時英里)。 1 英里 (mph) 約等於 1.61 公里 (km/h)。 - + Lateral Ctrl Mode 橫向控制模式 - + 1 = Lane Change Assist (LCA) 2 = Auto Lane Change Assist (ALCA) 1 = 輔助換道 (LCA) 2 = 自動換道 (ALCA) - + Longitudinal 縱向控制 (油門/剎車) - + Manually Control Accel Mode 手動控制加速模式 - + Enable this if you wish to adjust openpilot's acceleration control. 啟用這個選項後您可以調整 openpilot 的加速模式 (節能、一般、運動)。 - + Enable vision based turn control 啟用視覺模型路徑控制車速 - + Use vision path predictions to estimate the appropriate speed to drive through turns ahead. 使用視覺模型預測的路徑來判斷前方的過彎速度。 - + Lateral 橫向控制 (方向盤) - + Use Lane Lines 使用車道線 - + Enable this if you wish to use lane lines mode. 啟用這個選項後,模型將會以車道線判斷行駛路線。 - + Use LQR Controller 使用 LQR 控制器 - + Enable this if you wish to use LQR instead of PID or INDI controller. WORKS WELL ONLY ON SOME VEHICLES. More linear steering experience. @@ -343,12 +343,12 @@ More linear steering experience. LQR 提供比 PID、INDI 更線性的控制。 - + Always On Lateral 全時置中 - + Use at your own risk! 1 = Stock Long 2 = OP Long @@ -360,12 +360,12 @@ Reboot required. 需重新啟動,如果遇到不能連線問題請使用恢復恢復 Panda 韌體功能。 - + Camera Offset 相機偏移 - + Adjust your camera position if your device is not mounted as per guidance. 如果您的裝置並非依照安裝說明安裝,您可以用這個設定來微調您裝置的相機與 ADAS 相機的間距。 @@ -463,11 +463,29 @@ Reboot required. + Enable Driver Monitor (Front Cam) + 啟用駕駛監控 (相機) + + + + Enable this option if you wish to use front camera for driver monitoring. +On = Front Cam Monitor + Steering Monitor +Off = Steering Monitor only. +Enable this will increase device temp a lot, use at your own risk. +Reboot Required. + 開啟這個選項後,您將可以使用前方鏡頭做駕駛監控。 +開啟 = 鏡頭監控 + 方向盤監控 +關閉 = 方向盤監控 +使用這個功能設備可能會過熱,請小心使用,後過自負。 +需重新開機。 + + + Enable Jetson Support 啟用 Jetson 支持 - + Enable this option if you intend to run dp on Nvidia Jetson. Reboot required. 如果您打算在 Nvidia Jetson NX 上跑 dp,請開啟這選項。 @@ -475,35 +493,36 @@ Reboot required. + Reboot recommended. Reboot? 我們建議您重新啟動。 要重新啟動嗎? - + Flashing Panda Firmware 刷新 Panda 韌體 - + FLASH 刷寫 - + Tap the button to update your panda firmware. The device should reboot once if it finish updating. 點擊右方按鈕來刷寫更新 Panda 的韌體。 你的裝置將在刷寫完成後自動重新開機。 - + Are you sure you want to flash the panda? 您確定要刷寫 Panda 嗎? - + Are you sure delete all media? 您確定要刪除所有的行車記錄嗎? @@ -512,59 +531,59 @@ The device should reboot once if it finish updating. 您確定嗎? - + Pandas Firmware Recovery 恢復 Panda 韌體 - + RECOVER 恢復 - + Tap the button ONLY if your panda ran into issue. 僅當您的 Panda 遇到問題時才點擊按鈕。 - + Are you sure you want to run recover panda script? 您確定要執行 Panda 恢復的動作嗎? - + Reset dragonpilot conf 重置所有 dragonpilot 的設定值 - + RESET 重置 - + Tap the button to reset all your dragonpilot congiration to default value. Reboot required. 點擊右方按鈕來重置所有的 dragonpilot 相關的設定值。 需重新啟動。 - + Are you sure you want to reset dp params? 您確定要重置嗎? - + Delete All Driving Log 刪除所有的行駛記錄 - + DELETE 刪除 - + Tap the button to delete ALL your driving logs (including dashcam / gpx / driving logs). 點擊按鈕來清空您所有的行駛記錄(包含 dashcam / gpx 等等)。 @@ -572,36 +591,36 @@ Reboot required. DPMapsPanel - + Show Full Screen Nav. 啟用全螢幕道航 - + This will show navigation in full screen. Please tap green boarder if you wish to switch back drive view. 這將會把導航畫面擴展至全螢幕。 如果想切換回行車畫面,請點擊或滑動綠色邊框區域。 - + Search Destination using Google Map 使用 Google Map 搜尋目的地 - + This will allow you to search destination in google map api. You will need to apply your own google map api key.Enter your key detail in web interface once it's enabled. 這將讓您使用 google map API 來搜尋目的地。 您將需要申請自已的 google map api 密鑰,申請完後進入網頁介面輸入即可。 - + Enable Nav. 啟用導航服務 - + This will let use the build in Navigation. Use web interface to control it: *http://<device_ip>:8082*. You will need to apply your own mapbox token at https://www.mapbox.com/. @@ -614,53 +633,53 @@ Reboot required. 需要重新開機。 - + Enable Speed Limit Control 啟用速限控制 - + Use speed limit signs information from map data and car interface to automatically adapt cruise speed to road limits. 依照圖資上的速限控制您的車速。 - + Enable Speed Limit Offset 啟用限速控制偏移 - + Set speed limit slightly higher than actual speed limit for a more natural drive. 將速度限製設置為略高於實際速度限制,實現更自然的駕駛。 - + Enable Map Data Turn Control 啟用圖資路徑控制車速 - + Use curvature info from map data to define speed limits to take turns ahead 使用圖資上的路徑來判斷前方的過彎速度 使用速度顯示為UI中左下方三角形內數值 - + Show debug UI elements 顯示除錯用圖示 - + Show UI elements that aid debugging. 於右上方顯示除錯用訊息 - + Enable MapD 啟用 MapD 服務 - + Use OSM to assist lateral/longitudinal control. Please note: 1. This feature will works only when your car support OP longitudinal. @@ -678,96 +697,96 @@ Please note: DPUIPanel - + Display Mode 顯示模式 - + 0 = Default 1 = Screen Off While Driving 0 = 預設 1 = 行駛時關閉畫面 - + Screen Brightness 螢幕亮度 - + Adjust your screen brightness. 調整螢幕的亮度。 - - + + AUTO 自動 - + Alert Volume 提示音量 - + Adjust your alert volume. 調整設備的提示音量。 - + Quiet Drive 靜音模式 - + Display alert and play important warning sound. Thanks @sunnyhaibin. 開啟這個選項後,設備只會在重要的警示時顯示和發出聲響。謝謝 @sunnyhaibin. - + Display Speed 顯示車速 - + Enable this to display your current speed. 啟用這個選項來顯示目前車速。 - + Display Event / Steer Icon 顯示事件圖示 - - + + Enable this to display the icon. 啟用UI右上角顯示事件/轉向圖標。 - + Display Driver Monitor Indicator 顯示駕駛監控圖示 - + Display Side Info 顯示側邊資訊欄 - + Enable this to display steering angle / lead car distance / engine RPM. 開啟這個選項後,畫面側邊將會顯示額外的訊息。 - + Display Top Info 顯示上方資訊欄 - + Enable this to display time / system temp / battery level. 開啟這個選項後,畫面將會顯示額外的訊息。 @@ -1185,60 +1204,60 @@ location set mph - - + + MAX 最高 - - + + SPEED 速度 - - + + LIMIT 速限 - + REAL STEER 實際轉角 - + RAM PER 記憶體用量 - + OFF 停止 - + ENG RPM 引擎轉速 - + NOR 一般 - + SPT 運動 - + ECO 節能 - + ACCEL 加速 @@ -1246,17 +1265,17 @@ location set OffroadHome - + UPDATE 更新 - + ALERTS 提醒 - + ALERT 提醒 @@ -1450,53 +1469,53 @@ location set 回上頁 - + Device 設備 - - + + Network 網路 - + Toggles 設定 - + Software 軟體 - + Navigation 導航 - + DP - General DP - 一般 - + DP - Controls DP - 控制 - + DP - UI DP - 畫面 - + DP - Cars DP - 車型 - + DP - Maps DP - 地圖 diff --git a/system/camerad/camerad b/system/camerad/camerad index ad5229a21..b3aae847e 100755 Binary files a/system/camerad/camerad and b/system/camerad/camerad differ diff --git a/system/camerad/cameras/camera_qcom.h b/system/camerad/cameras/camera_qcom.h index dfb7d53e7..1bf659fac 100644 --- a/system/camerad/cameras/camera_qcom.h +++ b/system/camerad/cameras/camera_qcom.h @@ -110,7 +110,7 @@ typedef struct MultiCameraState { VisionBuf stats_bufs[FRAME_BUF_COUNT]; CameraState road_cam; -// CameraState driver_cam; + CameraState driver_cam; SubMaster *sm; PubMaster *pm; diff --git a/system/clocksd/clocksd b/system/clocksd/clocksd index b3db78f56..eee71f6e8 100755 Binary files a/system/clocksd/clocksd and b/system/clocksd/clocksd differ