@@ -76,9 +76,8 @@ bool MPC::calculateMPC(
76
76
const auto mpc_matrix = generateMPCMatrix (mpc_resampled_ref_trajectory, prediction_dt);
77
77
78
78
// solve Optimization problem
79
- const auto [success_opt, Uex] = executeOptimization (
80
- mpc_matrix, x0_delayed, prediction_dt, mpc_resampled_ref_trajectory,
81
- current_kinematics.twist .twist .linear .x );
79
+ const auto [success_opt, Uex] =
80
+ executeOptimization (mpc_matrix, x0_delayed, prediction_dt, mpc_resampled_ref_trajectory);
82
81
if (!success_opt) {
83
82
return fail_warn_throttle (" optimization failed. Stop MPC." );
84
83
}
@@ -544,8 +543,7 @@ MPCMatrix MPC::generateMPCMatrix(
544
543
* [ -au_lim * dt ] < [uN-uN-1] < [ au_lim * dt ] (*N... DIM_U)
545
544
*/
546
545
std::pair<bool , VectorXd> MPC::executeOptimization (
547
- const MPCMatrix & m, const VectorXd & x0, const double prediction_dt, const MPCTrajectory & traj,
548
- const double current_velocity)
546
+ const MPCMatrix & m, const VectorXd & x0, const double prediction_dt, const MPCTrajectory & traj)
549
547
{
550
548
VectorXd Uex;
551
549
@@ -578,7 +576,7 @@ std::pair<bool, VectorXd> MPC::executeOptimization(
578
576
VectorXd ub = VectorXd::Constant (DIM_U_N, m_steer_lim); // max steering angle
579
577
580
578
// steering angle rate limit
581
- VectorXd steer_rate_limits = calcSteerRateLimitOnTrajectory (traj, current_velocity );
579
+ VectorXd steer_rate_limits = calcSteerRateLimitOnTrajectory (traj);
582
580
VectorXd ubA = steer_rate_limits * prediction_dt;
583
581
VectorXd lbA = -steer_rate_limits * prediction_dt;
584
582
ubA (0 ) = m_raw_steer_cmd_prev + steer_rate_limits (0 ) * m_ctrl_period;
@@ -730,8 +728,7 @@ double MPC::calcDesiredSteeringRate(
730
728
return steer_rate;
731
729
}
732
730
733
- VectorXd MPC::calcSteerRateLimitOnTrajectory (
734
- const MPCTrajectory & trajectory, const double current_velocity) const
731
+ VectorXd MPC::calcSteerRateLimitOnTrajectory (const MPCTrajectory & trajectory) const
735
732
{
736
733
const auto interp = [&](const auto & steer_rate_limit_map, const auto & current) {
737
734
std::vector<double > reference, limits;
@@ -765,13 +762,6 @@ VectorXd MPC::calcSteerRateLimitOnTrajectory(
765
762
return reference.back ();
766
763
};
767
764
768
- // when the vehicle is stopped, no steering rate limit.
769
- constexpr double steer_rate_lim = 5.0 ;
770
- const bool is_vehicle_stopped = std::fabs (current_velocity) < 0.01 ;
771
- if (is_vehicle_stopped) {
772
- return steer_rate_lim * VectorXd::Ones (m_param.prediction_horizon );
773
- }
774
-
775
765
// calculate steering rate limit
776
766
VectorXd steer_rate_limits = VectorXd::Zero (m_param.prediction_horizon );
777
767
for (int i = 0 ; i < m_param.prediction_horizon ; ++i) {
0 commit comments