-
Notifications
You must be signed in to change notification settings - Fork 646
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(autoware_behavior_velocity_planner_common): add node clock, fix use sim time #8876
fix(autoware_behavior_velocity_planner_common): add node clock, fix use sim time #8876
Conversation
…se sim time Signed-off-by: Dawid Moszynski <[email protected]>
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
@takayuki5168 san could you assign someone to review this? It's a very simple one. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8876 +/- ##
==========================================
- Coverage 28.02% 28.01% -0.02%
==========================================
Files 1316 1320 +4
Lines 98601 98649 +48
Branches 39771 39773 +2
==========================================
+ Hits 27636 27637 +1
- Misses 70819 70866 +47
Partials 146 146
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you!
…se sim time (autowarefoundation#8876) Signed-off-by: Dawid Moszynski <[email protected]> Signed-off-by: prakash-kannaiah <[email protected]>
Description
The
behavior_velocity_planner
module has a bug that causes it to work incorrectly whenuse_sim_time == True
- it should use the time published on/clock
, however, it does not do this.Related links
--
How was this PR tested?
I used tier4 evaluator scenario scenario for local testing. The tests included comparison of behavior for the same setup but different values of the
use_sim_time
parameter (eitherTrue
orFalse
).The result of the scenario is
Passed
foruse_sim_time == False
.The result of the scenario is
Failure
foruse_sim_time == True
, as theEgo
, after stopping before the pedestrian crosswalk (and reaching a linear speed equal to0.0000
), immediately started moving again by reaching the linear small speed (less than0.1000
) and stopped again.In the scenario, such behavior is not allowed, so therefore it caused
Failure
and helped detect this issue.To get
Passed
I've relaxed the condition that checks the stopped state fromspeed<0.0001
tospeed<0.1000
.After this change, the scenario seemed to run identically for both cases - after Ego stopped before the crosswalk, it gently moved and stopped again (reaching a speed less than
0.1000
, so the conditions were met and gotPassed
).The change in Ego's behavior is related to the
behavior_velocity_crosswalk_module
- which, after the vehicle stops, transitions toIGNORE
state - this transition does not occur in the case ofuse_sim_time == False
.Below I've attached the video before the changes:
YIELD
state,IGNORE
state,YIELD
state,issue.mp4
Reason
The reason by which the
behavior_velocity_crosswalk_module
transitions to theIGNORE
state is a bug in the velocity buffer, when the parameteruse_sim_time == True
.behavior_velocity_crosswalk_module
behaves as if the velocity buffer is off and theplanner_data_->isVehicleStopped()
call (here) returnsTrue
as immediately as the linear velocity ofEgo
reaches 0.0.TwistStamped
objects in the velocity buffer queue contain timestamps that are consistent with the simulation time (starts at zero) while in theisVehicleStopped()
method they are compared with the system time (epoch) - it can be seen here.rclcpp::Clock().now()
instead of usingclock_->now()
- clock that is assigned to the node and takes into account the node parameteruse_sim_time
. (I realize that in the case of using the staticrclcpp::Clock().now()
method, the time from the topic/clock
should be used, but this is not happening, even though the publication /clock starts before the start of the module and publishes continuously)Fix
I’ve managed to fix this bug by making sure that module
behavior_velocity_crosswalk_module
uses the clock assigned to the node (takes into accountuse_sim_time
) and now timestamps are correctly compared, velocity buffer works as expected. The changes can be seen in this PR. Below I've attached the video after the changes.fixed.mp4
Notes for reviewers
Note: Analysis and tests were performed on the tier4/v.0.26.1 version.
Interface changes
None.
Effects on system behavior
The module
behavior_velocity_crosswalk_module
uses the clock assigned to the node (takes into accountuse_sim_time
).