Skip to content

Commit

Permalink
fix(simulator, controller): fix inverse pitch calculation (backport a…
Browse files Browse the repository at this point in the history
…utowarefoundation#5199) (#1025)

fix(simulator, controller): fix inverse pitch calculation (autowarefoundation#5199)

Signed-off-by: Mamoru Sobue <[email protected]>
Signed-off-by: Takamasa Horibe <[email protected]>
Co-authored-by: Mamoru Sobue <[email protected]>
Co-authored-by: Takamasa Horibe <[email protected]>
  • Loading branch information
3 people authored Nov 20, 2023
1 parent c19995a commit 0b731b4
Show file tree
Hide file tree
Showing 6 changed files with 508 additions and 2 deletions.
4 changes: 4 additions & 0 deletions control/pid_longitudinal_controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ For instance, if the vehicle is attempting to start with an acceleration of `1.0

A suitable example of a vehicle system for the slope compensation function is one in which the output acceleration from the longitudinal_controller is converted into target accel/brake pedal input without any feedbacks. In this case, the output acceleration is just used as a feedforward term to calculate the target pedal, and hence the issue mentioned above does not arise.

Note: The angle of the slope is defined as positive for an uphill slope, while the pitch angle of the ego pose is defined as negative when facing upward. They have an opposite definition.

![slope_definition](./media/slope_definition.drawio.svg)

#### PID control

For deviations that cannot be handled by FeedForward control, such as model errors, PID control is used to construct a feedback system.
Expand Down
165 changes: 165 additions & 0 deletions control/pid_longitudinal_controller/media/slope_definition.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ PidLongitudinalController::ControlData PidLongitudinalController::getControlData
current_pose, m_trajectory, m_ego_nearest_dist_threshold, m_ego_nearest_yaw_threshold);

// pitch
const double raw_pitch = longitudinal_utils::getPitchByPose(current_pose.orientation);
// NOTE: getPitchByTraj() calculates the pitch angle as defined in
// ../media/slope_definition.drawio.svg while getPitchByPose() is not, so `raw_pitch` is reversed
const double raw_pitch = (-1.0) * longitudinal_utils::getPitchByPose(current_pose.orientation);
const double traj_pitch =
longitudinal_utils::getPitchByTraj(m_trajectory, control_data.nearest_idx, m_wheel_base);
control_data.slope_angle = m_use_traj_for_pitch ? traj_pitch : m_lpf_pitch->filter(raw_pitch);
Expand Down
6 changes: 6 additions & 0 deletions simulator/simple_planning_simulator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ _Note_: The steering/velocity/acceleration dynamics is modeled by a first order
Since the vehicle outputs `odom`->`base_link` tf, this simulator outputs the tf with the same frame_id configuration.
In the simple_planning_simulator.launch.py, the node that outputs the `map`->`odom` tf, that usually estimated by the localization module (e.g. NDT), will be launched as well. Since the tf output by this simulator module is an ideal value, `odom`->`map` will always be 0.

### (Caveat) Pitch calculation

Ego vehicle pitch angle is calculated in the following manner.

![pitch calculation](./media/pitch-calculation.drawio.svg)

## Error detection and handling

The only validation on inputs being done is testing for a valid vehicle model type.
Expand Down
Loading

0 comments on commit 0b731b4

Please sign in to comment.