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(traffic_simulator): set flag valid lanelet pose #1387

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

satoshi-ota
Copy link
Contributor

@satoshi-ota satoshi-ota commented Sep 18, 2024

Description

I found a bug in ego respawn logic. The ego orientation is not set correctly and respawns with wrong pose.

movie-2024-09-18_08.59.17.mp4

Abstract

I analyzed bug and fixed it in this PR.

Background

I found this line was called even when I set map pose as ego's respawn pose. But I thought it was unexpected result because the new pose was substituted to status.pose in this case.

canonicalized_lanelet_pose = pose::canonicalize(status.lanelet_pose, hdmap_utils_ptr);

Details

I think we have to set flag status.lanelet_pose_valid to false when we use map pose.

diff --git a/simulation/traffic_simulator/src/api/api.cpp b/simulation/traffic_simulator/src/api/api.cpp
index d02bbfc7c..5018b3d76 100644
--- a/simulation/traffic_simulator/src/api/api.cpp
+++ b/simulation/traffic_simulator/src/api/api.cpp
@@ -171,6 +171,7 @@ auto API::setEntityStatus(
     EntityStatus status = static_cast<EntityStatus>(entity->getCanonicalizedStatus());
     status.pose = map_pose;
     status.action_status = action_status;
+    status.lanelet_pose_valid = false;
     setEntityStatus(name, status);
   } else {
     THROW_SIMULATION_ERROR("Cannot set entity \"", name, "\" status - such entity does not exist.");

After that ego respawns with correct pose.

movie-2024-09-18_09.25.24.mp4

References

https://github.com/tier4/sim_evaluation_tools/issues/343

Destructive Changes

N/A

Known Limitations

N/A

Copy link

github-actions bot commented Sep 18, 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.

@hakuturu583 hakuturu583 added bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 wait for regression test labels Sep 18, 2024
@satoshi-ota satoshi-ota marked this pull request as ready for review September 18, 2024 04:58
@hakuturu583 hakuturu583 self-requested a review September 18, 2024 06:41
@hakuturu583 hakuturu583 merged commit 5e78ebf into master Sep 18, 2024
17 checks passed
@github-actions github-actions bot deleted the fix/set-flag-invalid-lane-pose branch September 18, 2024 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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