Closed GoesM closed 8 months ago
2km is an outrageous size for an inflation radius - you don't have a 2km wide costmap, do you?
I don't consider that to be a legit solution to the problem you're seeking to address and I wouldn't support messing with lower-level data structures that have been proven in production for 10+ years to support that :wink:
Moreover, inflation radius is a double, not an int, so I'm not sure that your snippet actually works with ROS 2 static parameter type declarations.
It seems that using the vector<>.resize() function here may not handle the corresponding memory allocation correctly.
That seems to point that your problem. If my back of the envelope calculations are right, (233320)^2 is the size of the cache then. If we have doubles, thats `8` bytes. That is over 8.7GB on RAM. That's a ridiculous request unless you're on a high performance computing platform with 20+ GB of RAM. This doesn't seem to point to any issue with Nav2, but what you're doing is probably a little misguided :-)
Moreover, inflation radius is a double, not an int, so I'm not sure that your snippet actually works with ROS 2 static parameter type declarations.
Sorry, I made a typo here. The input we used was 2333.3, and I have corrected it in the original text
2km is an outrageous size for an inflation radius - you don't have a 2km wide costmap, do you?
I am curious about how navigation2-stack performs on micro robots, and I consider the unit of numbers to be mm
during use, which is why I use large values like 2k (which means it represents 2m instead of 2km).
That's a ridiculous request unless you're on a high performance computing platform with 20+ GB of RAM.
It makes sense! It's not very possible to deploy 20+ GB of RAM on a micro robot, so this is indeed caused by my incorrect use.
Thanks for your patience : )
I think it's also a ticket for #4005 , so I link it to that issue.
Bug report
Required Info:
Steps to reproduce issue
To adapt to scenarios where the robot within high-speed needs to decelerate in advance, we tried setting a larger
inflation_radius
for theglobal_costmap
in the configuration and launch navigation2 under this setup.Here is our launch command:
there's only one difference between
my_nav2_params.yaml
and defaultednav2_params.yaml
, ( we specially set the inflation_radius of global_costmap as 2333), as following:Expected behavior
We expected to see the robot's performance within a larger inflation_radius, but we encountered a program crash instead.
Actual behavior
We found WRITE-memory-access-error during the costmap calculation process.
Additional information
asan-report
In order to identify the cause of the program crash, we attempted to use the Asanitizer to capture detailed information about the crash,as following:
our analysis
focus on code lines : inflation_layer.cpp#L354-L361
We noticed that,
vector<>
is used here for computing caches. However, if theinflation_radius
is larger than 2000, the size of vector (is equal tocache_length_ * cache_length_
) would be larger than 10^9, which could lead to issues with memory allocation for the vector.In addition, we have a try to change these code lines as following, to empirically confirm our correct identification of the error in the code.
as a result, we catched the output as following:
It seems that using the
vector<>.resize()
function here may not handle the corresponding memory allocation correctly.suggestion:
If the navigation2-stack is willing to support calculations with such large data, could we consider changing the
vector
to use aLinked List Array
to prevent such memory errors?