-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Costmap update in accordance to ROS time #3404
Costmap update in accordance to ROS time #3404
Conversation
Fixed formatting. Bring back update and publish of the costmap layers, making sure the cost map is reinitialized by implicit calling update function. Calling proper function. Canceling and reseting of the timer instead of recreation. After second round of review. Check against nullptr_t Typo Nullptr Linter
I've cherry-picked original commit from kpawelczyk's branch to mine. @SteveMacenski, will this PR preserve original kpawelczyk authorship after merge, or am I done something wrong? |
map_update_frequency_); | ||
} | ||
} else { | ||
map_update_timer_->reset(); |
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.
if map_update_timer_
its a nullptr, why reset it?
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.
I think that may actually be dereferencing a nullptr
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.
If map_update_timer_
is a nullptr, we are trying to create a new timer, else - resetting existing timer:
if (!map_update_timer_) {
// map_update_timer_ == nullptr
try to create a new map_update_timer_ object
} else {
// map_update_timer_ != nullptr
// which means that timer is already created. We just need to reset it:
map_update_timer_->reset();
}
I looks like there are no cases where we could dereference a null pointer.
I thought we discussed that having the timer had other issues and that we were just going to update the rates away from |
Yes, the git logs look clean. They store that he's the author but you committed it |
It seems like However, this idea made me a think about the accuracy of solution I've presented before. After close double-check, I've discovered that this solution was using periodic granular
As of experiments, it seems that accuracy of this approach somewhat similar to having our own accurate From the said above, it looks like the solution to have a correct copy of a |
Interesting.
Maybe its worth actually just changing the Rate in rclcpp to support what we need instead? I have a call with the ROS Maintainers later today, I'll inquire about the interest of this.
Can you show me this "nav2_utils::ROSTimer"? I don't see it in the stack. |
It is an implementation of rclcpp::GenericRate moved on ROS-time rails. This is a prototype not published yet, but here we are:
Any news from RCLCPP team? If so, I am ready to submit a new feature request there. |
See Slack - I got some feedback and resources from Tully and Chris about how to contribute a ROS Time version of Rate into rclcpp. There's interest in it so we don't have to maintain it here |
Could you please link to the continuation of this? Is there a PR for rclcpp? |
Yes, the proper way - is to add ROS-time respective rate to RCLCPP API. The according PR is: ros2/rclcpp#2123 |
What's the story here? Is the change being looked at for Rolling now? |
I've just created a new PR ros2/system_tests#516 in |
OK! Let me know if I can help |
Yay! rclcpp is merged! |
@AlexeyMerzlyakov from your analysis in #3325 (comment) with the higher variation of executions, is this ready to go (e.g. not suffering from this problem)? I'm looking to address the timing issues myself this week, it looks like you covered this one but can you verify this doesn't suffer from that problem you previously mentioned and that this is good to go? Or, does it make sense to instead just change https://github.com/ros-planning/navigation2/blob/main/nav2_costmap_2d/src/costmap_2d_ros.cpp#L496 WallRate to the new Rate with clock API |
This PR is used as an alternative for updated Regarding the #3325 (comment) time variations - this was related to inaccurate waiting grain approach in proposed by #3325 (comment) solution
which was finally refused. So this should not be an our case for now (although it still deserves performance re-measurement of new |
Ok got it! Closing in favor of the new API then, thanks for the clarification and your help on this issue! |
This is continue of #3327 ticket, supplemented by review items resolved.
Basic Info
colcon test --packages-select nav2_costmap_2d nav2_system_tests
Description of contribution in a few bullet points
use_sim_time
parameters is true.resume()
afterstop()
: the behavior was changed. In default case, we will hang in this routine; while after this PR the execution just returns back fromresume()
when node is stopped. This seems to cause no issue:resume()
should be called afterpause()
, whilestop()
is chaind withstart()
. So, behavior should be even more correct causing no hangs at this case.For Maintainers: