Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(simple_planning_simulator): fix ego sign pitch problem #5616

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions simulator/simple_planning_simulator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ Ego vehicle pitch angle is calculated in the following manner.

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

NOTE: driving against the line direction (as depicted in image's bottom row) is not supported and only shown for illustration purposes.

## Error detection and handling

The only validation on inputs being done is testing for a valid vehicle model type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ void SimplePlanningSimulator::on_timer()

// calculate longitudinal acceleration by slope
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);
const double ego_pitch_angle = calculate_ego_pitch();
const double slope_angle = enable_road_slope_simulation_ ? -ego_pitch_angle : 0.0;
const double acc_by_slope = gravity_acceleration * std::sin(slope_angle);

// update vehicle dynamics
{
Expand Down
Loading