From fbb8e401ccd1d691ab18213eb58e663f4b792a48 Mon Sep 17 00:00:00 2001 From: Tomoya Kimura Date: Tue, 17 Oct 2023 14:32:03 +0900 Subject: [PATCH] fix(mpc): change the way to calculate target steering rate (#955) Signed-off-by: Takamasa Horibe Co-authored-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; }