-
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
getClosestAngularBin()
returns unexpected bin number
#4094
Comments
Am I correct in saying that simply casting the double back down to a float resolve the issue?
If so, can you submit a PR, that should be easy enough to merge. I'll also take a look when you submit that PR at other implicit double -> float conversions. I did a quick glance and I see a small number of other places that I should be more explicit about that conversion, but this is the only critical one. From the 3 places that its used, it looks like double really is the valid input type, so we can squash it in the function itself. Two could be made into |
Correct, casting the double to a float resolves the issue. I can submit a PR but I wonder which branch should it go towards? |
Put it towards Thanks for the report and soon-to-come PR! 😄 |
My pleasure! I had trouble building |
All PRs need to be targeted to main and I'll backport to Humble using our tools. If the static cast works in Humble, there's no reason it shouldn't in rolling as well. I looked into this as well and I don't see an issue with that. If your tests pass in Rolling as well (add those unit tests) then we're all good :-) |
Any update? Should be a small change 😄 |
Sorry work got a bit busy last week. I should be able to get it done this week. Sorry about the delay! |
Merging imminent, waiting on CI Thanks @hsong-MLE |
Bug report
Background information
When using
getClosestAngularBin()
in a custom planner implementation, I noticed the method sometimes returns unexpected bin numbers which could be a result of the divisiontheta / bin_size
wheretheta
is of typedouble
whilebin_size
is of typefloat
. In diagnosing the issue, I noticed there was no tests, so I wrote tests for thegetClosestAngularBin()
method to verify its behavior. An example of these tests is given below.Required Info:
Operating System:
Ubuntu 22.04
ROS2 Version:
humble
Version or commit hash:
ros-humble-navigation2 1.1.12-1jammy.20231005.224358
DDS implementation:
default
Steps to reproduce issue
To reproduce within the
nav2_smac_planner
package:test_nodehybrid.cpp
:To reproduce in a standalone implementation:
my_test_file.cpp
g++ my_file.cpp -o my_file
./my_file
Expected behavior
Actual behavior
The text was updated successfully, but these errors were encountered: