From 5dbc8816288b3c25424a73f122b4bb9160f58c99 Mon Sep 17 00:00:00 2001 From: Takamasa Horibe Date: Wed, 27 Sep 2023 18:51:57 +0900 Subject: [PATCH] fix(mpc): change the way to calculate target steering rate Signed-off-by: Takamasa Horibe --- control/mpc_lateral_controller/src/mpc.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/control/mpc_lateral_controller/src/mpc.cpp b/control/mpc_lateral_controller/src/mpc.cpp index 8e99880b68050..cb13bcce18a30 100644 --- a/control/mpc_lateral_controller/src/mpc.cpp +++ b/control/mpc_lateral_controller/src/mpc.cpp @@ -753,10 +753,9 @@ double MPC::calcDesiredSteeringRate( const size_t STEER_IDX = 2; // for kinematics model - const auto steer_0 = x0(STEER_IDX, 0); const auto steer_1 = Xex(STEER_IDX, 0); - - const auto steer_rate = (steer_1 - steer_0) / predict_dt; + const auto steer_2 = Xex(STEER_IDX + m_vehicle_model_ptr->getDimX(), 0); + const auto steer_rate = (steer_2 - steer_1) / predict_dt; return steer_rate; }