feat(traffic_simulator): support backward motion in FollowTrajectoryAction#1739
Closed
dmoszynski wants to merge 6 commits intomasterfrom
Closed
feat(traffic_simulator): support backward motion in FollowTrajectoryAction#1739dmoszynski wants to merge 6 commits intomasterfrom
dmoszynski wants to merge 6 commits intomasterfrom
Conversation
…lowTrajectoryAction by adding follow_backwards parameter with automatic velocity and orientation inversion
…datedStatus Enable makeUpdatedStatus to work with negative twist.linear.x values (backward motion) throughout the entire calculation flow. Add workaround to adapt FollowWaypointController (which expects non-negative speeds) by transforming input/output values while preserving physical correctness of kinematic calculations.
Checklist for reviewers ☑️All references to "You" in the following text refer to the code reviewer.
|
|
This PR may breaks the interface to external services! Please see https://tier4.atlassian.net/wiki/spaces/S/pages/1984987364 |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Regressions
No regressions confirmed
Abstract
Add backward motion support to
FollowTrajectoryActionvia thefollow_backwardsparameter.This enables realistic reversing behavior instead of unrealistic 180° in-place rotations.
Background
During work on RJD-1921, scenarios were found where
FollowTrajectoryActionneeds to drive vehicles backward.Before this PR,
FollowTrajectoryActiondid not support this correctly.The problem comes from how
FollowTrajectoryActionworks: it always turns the entity to face the nearest waypoint. This is fine for forward motion. But when the entity and trajectory are on a lanelet and the waypoints are behind the entity, the behavior is wrong:This breaks scenarios that need backward parking or reversing along a trajectory.
Details
This PR introduces the
follow_backwardsparameter to enable backward motion inFollowTrajectoryAction.Scenarios can now explicitly specify when an entity should follow trajectory backward.
Core changes:
follow_backwardsparameterPolylineTrajectorymessage (ros2 msg, protobuf, conversions)ParameterDeclarationnamedfollow_backwards(boolean)falsefor backward compatibilitytrue, the entity drives backward along the trajectoryfollow_backwards = true, the initial velocity of the entity must be non-positive.follow_backwards = truerequiresinitial_velocity <= 0.Orientation handling (key fix)
follow_backwards=true,desired_velocityis reversed 180° around z-axisNegative speed support in
makeUpdatedStatustwist.linear.xnow uses signed values: positive for forward, negative for backwardfollow_backwards=true,twist.linear.xis negative throughout calculationsstd::abs()where neededFollowWaypointControlleradaptationFollowWaypointControllerexpectsspeed >= 0and does not support negative speedsspeedandaccelerationbydirection_signto make negative values positivedirection_signto restore the sign for backward motionBackward compatibility and usage:
When
follow_backwardsis not provided or set tofalse,FollowTrajectoryActionbehaves exactly as before.All existing scenarios continue to work without any modifications.
To enable realistic backward motion in scenarios:
follow_backwards=truein the trajectoryParameterDeclarationExample behavior:
Before (incorrect):
scenario_35fef270-3e48-4435-ab1f-5c194e2b8bf8_11.mp4
After (correct):
scenario_35fef270-3e48-4435-ab1f-5c194e2b8bf8_11_fix.mp4
Known Limitations
FollowTrajectoryActiondoes not support positive initial velocities when follow_backwards = true.FollowWaypointControllerdoes not natively support negative speeds yet; workaround transformation is required (see code TODOs)