Skip to content

Commit d677314

Browse files
authored
fix(mpc_lateral_controller): align the MPC steering angle when the car is controlled manually. (#7109)
* align the MPC steering angle when the car is controlled manually. Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * update the condition for is_driving_manually Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * STOP mode included Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * comment the is_driving_manually Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * align the steering outside (after) the solver. Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * use the flag input_data.current_operation_mode.is_autoware_control_enabled Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * correct a typo Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * correct the under control condition check Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * undo the space delete Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * unchange the unrelevant line Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> * pre-commit Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com> --------- Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
1 parent fffb149 commit d677314

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

control/autoware_mpc_lateral_controller/src/mpc.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void MPC::setReferenceTrajectory(
244244

245245
void MPC::resetPrevResult(const SteeringReport & current_steer)
246246
{
247-
// Consider limit. The prev value larger than limitation brakes the optimization constraint and
247+
// Consider limit. The prev value larger than limitation breaks the optimization constraint and
248248
// results in optimization failure.
249249
const float steer_lim_f = static_cast<float>(m_steer_lim);
250250
m_raw_steer_cmd_prev = std::clamp(current_steer.steering_tire_angle, -steer_lim_f, steer_lim_f);

control/autoware_mpc_lateral_controller/src/mpc_lateral_controller.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ trajectory_follower::LateralOutput MpcLateralController::run(
287287
// the vehicle will return to the path by re-planning the trajectory or external operation.
288288
// After the recovery, the previous value of the optimization may deviate greatly from
289289
// the actual steer angle, and it may make the optimization result unstable.
290-
if (!is_mpc_solved) {
290+
if (!is_mpc_solved || !is_under_control) {
291291
m_mpc->resetPrevResult(m_current_steering);
292292
} else {
293293
setSteeringToHistory(ctrl_cmd);

0 commit comments

Comments
 (0)