-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Setting TERRAIN_SPACING Too Small Causes Instant Crash Instead of Running Out of Storage #29392
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
Comments
This is an integer parameter. It's being truncated to zero, leading to division-by-zero. You really want sub-metre accuracy? |
Maybe we should protect against unrealistically small values especially if they can cause problems on a real vehicle |
Thank you @peterbarker and @rmackay9 , I think the simplest solution would be to add a constraint in the code, so that when the grid resolution is set to less than 1, it defaults to 1. Alternatively, we could add a note in the documentation stating: "Do not set TERRAIN_SPACING to less than 1." Another option could be to enhance support for sub-meter resolution, though I'm not entirely sure if that's necessary. |
Hi. I'm interested in this issue. Is someone already working on a fix? |
Bug report
Issue details
Hi~
When the parameter TERRAIN_SPACING is set to a value less than 1, the system crashes, causing the GCS to lose connection.
For example, param set TERRAIN_SPACING 0 or param set TERRAIN_SPACING 0.5
(But there are no errors when TERRAIN_SPACING =1 or 1.5)
According to the parameter description:
"Grid spacings lower than 100 meters waste SD card space if the GCS cannot provide that resolution."
If the value is set below 100, it should only result in wasted storage space (eventually leading to an SD card running out of space), but it should not cause an instant crash. Therefore, I think this is a bug.
The error message from debugging is as follows:
Thread 1 "arducopter" received signal SIGFPE, Arithmetic exception.
0x00005555556979a4 in AP_Terrain::calculate_grid_info(Location const&, AP_Terrain::grid_info&) const ()
Version
SITL, copter, 4.7.0-dev
Platform
[ ] All
[ ] AntennaTracker
[*] Copter
[ ] Plane
[ ] Rover
[ ] Submarine
The text was updated successfully, but these errors were encountered: