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(cpp_mock_scenarios, ego_entity_simulation): fix ego issue in random001, fix getCurrentPose() #1361

Merged
merged 9 commits into from
Oct 10, 2024

Conversation

dmoszynski
Copy link
Contributor

@dmoszynski dmoszynski commented Sep 2, 2024

Description

The same issue as RJD 1200 happens, when scenario_simulator_v2 and Autoware are built in RelWithDebInfo.

Abstract

The issue that occurs is related Ego position update - position is not updated correctly and EgoEntitySimulation::getCurrentPose() returns incorrect values.
The issue is most likely related to the optimization performed by the compiler when the -DCMAKE_BUILD_TYPE=RelWithDebInfo is used - more in the details section.

Background

To get rid of the issue, it was necessary to cast the temporary structure Eigen::Procuct<...> to Eigen::Vector3d - otherwise the optimization resulted in different results.

Details

  • I’ve added a rotation matrix as a constant attribute of the EgoEntitySimulation (now the matrix is created at the time of initialization).

    • Previously it was created in many places every time it was needed, this gives a computational profit and also some form of safeguard.

  • I’ve ensured that the temporary Eigen type that can cause issues is cast to Eigen::Vector3d.

    • It is worth to pay extra attention to the commonly used auto in ss2 code and try to avoid it in parts where Eigen structures are used.

const auto relative_position =
Eigen::Vector3d(initial_rotation_matrix_ * world_relative_position_);

  • The PR also includes fixes to the random001 scenario that @SzymonParapura developed in RJD-1200 (the PR was not merged but closed - the fixes are required to make the scenario work well)

}
if (!api_.reachPosition("ego", trigger_position, 20.0) && api_.entityExists(entity_name)) {
api_.despawn(entity_name);
}
}
if (api_.reachPosition("ego", ego_goal_position, 1.0)) {
api_.despawn("ego");
stop(cpp_mock_scenarios::Result::SUCCESS);
}
}
}

  • I’ve conducted tests of the fixed version - everything works fine for -DCMAKE_BUILD_TYPE=RelWithDebInfo - in this jira command I've attached recordings as evidences.
  • In this comment I also described more details about the issue itself.

References

RJD-1296 Jira ticket

Destructive Changes

--

Known Limitations

--

Copy link

github-actions bot commented Sep 2, 2024

Checklist for reviewers ☑️

All references to "You" in the following text refer to the code reviewer.

  • Is this pull request written in a way that is easy to read from a third-party perspective?
  • Is there sufficient information (background, purpose, specification, algorithm description, list of disruptive changes, and migration guide) in the description of this pull request?
  • If this pull request contains a destructive change, does this pull request contain the migration guide?
  • Labels of this pull request are valid?
  • All unit tests/integration tests are included in this pull request? If you think adding test cases is unnecessary, please describe why and cross out this line.
  • The documentation for this pull request is enough? If you think adding documents for this pull request is unnecessary, please describe why and cross out this line.

@dmoszynski dmoszynski changed the title RJD-1298: fix ego issue in random001 , fix EgoEntitySimulation::getCurrentPose() fix(cpp_mock_scenarios, ego_entity_simulation): fix ego issue in random001, fix getCurrentPose() Sep 2, 2024
@dmoszynski dmoszynski added wait for regression test bug Something isn't working bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 labels Sep 4, 2024
@dmoszynski dmoszynski marked this pull request as ready for review September 16, 2024 06:59
@hakuturu583 hakuturu583 merged commit 9e056fc into master Oct 10, 2024
11 checks passed
@github-actions github-actions bot deleted the fix/RJD-1296-fix-random001-ego-issue branch October 10, 2024 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 wait for regression test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants