Skip to content

Commit

Permalink
fix(vehicle_cmd_gate): use the current state for filtering when stopp…
Browse files Browse the repository at this point in the history
…ed (autowarefoundation#4174)

Signed-off-by: Maxime CLEMENT <maxime.clement@tier4.jp>
  • Loading branch information
maxime-clem authored and tkimura4 committed Jul 5, 2023
1 parent 4cd8e7a commit da10a8f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,11 @@ AckermannControlCommand VehicleCmdGate::filterControlCommand(const AckermannCont
if (mode.is_in_transition) {
filter_on_transition_.filterAll(dt, current_steer_, out);
} else {
// When ego is stopped and the input command is not stopping,
// use the actual vehicle longitudinal state for the filtering
// this is to prevent the jerk limits being applied and causing
// a delay when restarting the vehicle.
if (ego_is_stopped && !input_cmd_is_stopping) filter_.setPrevCmd(current_status_cmd);
filter_.filterAll(dt, current_steer_, out);
}

Expand All @@ -511,14 +516,6 @@ AckermannControlCommand VehicleCmdGate::filterControlCommand(const AckermannCont
// filter in manual mode.
prev_values.longitudinal = out.longitudinal; // TODO(Horibe): to be removed

// When ego is stopped and the input command is stopping,
// use the actual vehicle longitudinal state for the next filtering
// this is to prevent the jerk limits being applied on the "stop acceleration"
// which may be negative and cause delays when restarting the vehicle.
if (ego_is_stopped && input_cmd_is_stopping) {
prev_values.longitudinal = current_status_cmd.longitudinal;
}

filter_.setPrevCmd(prev_values);
filter_on_transition_.setPrevCmd(prev_values);

Expand Down

0 comments on commit da10a8f

Please sign in to comment.