Closed GoesM closed 4 months ago
I insert log to confirm what happened after getparamer()
as following:
get_parameter("max_particles", max_particles_);
get_parameter("min_particles", min_particles_);
std::cerr << "-------------------------------------------------------" << std::endl;
std::cerr << "max_particles:" << max_particles_ << std::endl;
std::cerr << "min_particles:" << min_particles_ << std::endl;
std::cerr << "-------------------------------------------------------" << std::endl;
and I get the log following:
[amcl-7] -------------------------------------------------------
[amcl-7] max_particles:2000
[amcl-7] min_particles:821708790
[amcl-7] -------------------------------------------------------
it's quiet strange that the get_parameter()
read a wrong value.
-67897767946
That is out of bounds of what an int
can represents (+/-2147483647), so my guess is that its a wrap around issue. That is undefined behavior so getting a weird number seems to track for me.
uh of course you're right. I missed such situation. ^_^
this issue is mainly for adding ticket for https://github.com/ros-navigation/navigation2/issues/4005
Bug report
Required Info:
Steps to reproduce issue
Here is our launch command:
there's only one difference between
my_nav2_params.yaml
and defaultednav2_params.yaml
:Expected behavior
no bug occurs
Actual behavior
face to the asan report:
Additional information
It seems that here's already a check for the negative value, however it doesn't work actually.
https://github.com/ros-navigation/navigation2/blob/4fa12acec79a08f472d9d04ac08997db47f2a398/nav2_amcl/src/amcl_node.cpp#L1126-L1131
And if the value of
min_particles
is less thanmax_particles
,min_particles
's value should not affect thepf_alloc()
function. So it's very odd to me .I guess there may be a value change during the
getparameter()
, and the detail of why this check doesn't work needs to be checked.