Skip to content

Commit 5a18803

Browse files
HansOerstedsatoshi-ota
authored andcommitted
align the steering outside (after) the solver.
Signed-off-by: Zhe Shen <lucidshenzhe@gmail.com>
1 parent 6167823 commit 5a18803

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

control/autoware_mpc_lateral_controller/src/mpc.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@ bool MPC::calculateMPC(
102102
// save previous input for the mpc rate limit
103103
m_raw_steer_cmd_pprev = m_raw_steer_cmd_prev;
104104
m_raw_steer_cmd_prev = Uex(0);
105-
if (is_driving_manually) { // align the MPC steering angle to the actual steering angle when the vehicle is manually controlled
106-
m_raw_steer_cmd_pprev = m_raw_steer_cmd_prev;
107-
m_raw_steer_cmd_prev = mpc_data.steer;
108-
}
109105

110106
/* calculate predicted trajectory */
111107
predicted_trajectory =

control/autoware_mpc_lateral_controller/src/mpc_lateral_controller.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,14 @@ trajectory_follower::LateralOutput MpcLateralController::run(
257257
input_data.current_operation_mode.mode == autoware_adapi_v1_msgs::msg::OperationModeState::STOP;
258258

259259
const bool is_mpc_solved = m_mpc->calculateMPC(
260-
m_current_steering, m_current_kinematic_state, ctrl_cmd, predicted_traj, debug_values, is_driving_manually);
260+
m_current_steering, m_current_kinematic_state, ctrl_cmd, predicted_traj, debug_values);
261261

262262
// reset previous MPC result
263263
// Note: When a large deviation from the trajectory occurs, the optimization stops and
264264
// the vehicle will return to the path by re-planning the trajectory or external operation.
265265
// After the recovery, the previous value of the optimization may deviate greatly from
266266
// the actual steer angle, and it may make the optimization result unstable.
267-
if (!is_mpc_solved) {
267+
if (!is_mpc_solved||is_driving_manually) {
268268
m_mpc->resetPrevResult(m_current_steering);
269269
} else {
270270
setSteeringToHistory(ctrl_cmd);

0 commit comments

Comments
 (0)