Skip to content

Commit

Permalink
set ego pitch to 0 if road slope is not simulated
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
  • Loading branch information
danielsanchezaran committed Nov 6, 2023
1 parent f952b6e commit 684bffd
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ void SimplePlanningSimulator::on_timer()
}

// calculate longitudinal acceleration by slope
const double ego_pitch_angle = calculate_ego_pitch();
const double acc_by_slope =
enable_road_slope_simulation_ ? -9.81 * std::sin(ego_pitch_angle) : 0.0;
constexpr double gravity_acceleration = -9.81;
const double ego_pitch_angle = enable_road_slope_simulation_ ? calculate_ego_pitch() : 0.0;
const double acc_by_slope = gravity_acceleration * std::sin(ego_pitch_angle);

// update vehicle dynamics
{
Expand Down

0 comments on commit 684bffd

Please sign in to comment.