You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Elevation mapping throws std::bad_alloc() as soon as the map is supposed to be moved. Adding point clouds to a map fixed in position works.
Where in the code the problem occurs
Using gdb leads to ElevationMap.cpp:286. At the core, the problem is that grid_map::EllipseIterator.cpp:32 is not initialized. This function is called by ElevationMap.cpp:285. Eigen allocates an immense amount of memory and finally throws std::bad_alloc() from Eigen/src/Core/util/Memory.h:362-367.
A quick, hacky fix is to skip the map fusion process of a specific cell in case too much memory is allocated. This code is added between ElevationMap.cpp:285 and ElevationMap.cpp:286:
// If maxNumberOfCellsToFuse is too high, Eigen will throw a std::bad_alloc() error.// Therefore, skip fusing in that case.if (maxNumberOfCellsToFuse > (size_t(-1) / sizeof(float))) {
// Skip fusing.
fusedMap_.at("elevation", *areaIterator) = rawMapCopy.at("elevation", *areaIterator);
fusedMap_.at("lower_bound", *areaIterator) = rawMapCopy.at("elevation", *areaIterator) - 2.0 * sqrt(rawMapCopy.at("variance", *areaIterator));
fusedMap_.at("upper_bound", *areaIterator) = rawMapCopy.at("elevation", *areaIterator) + 2.0 * sqrt(rawMapCopy.at("variance", *areaIterator));
fusedMap_.at("color", *areaIterator) = rawMapCopy.at("color", *areaIterator);
continue;
}
This is only a temporary fix. The issue should be fixed more permanently in grid_map.
The text was updated successfully, but these errors were encountered:
System
Problem
Elevation mapping throws
std::bad_alloc()
as soon as the map is supposed to be moved. Adding point clouds to a map fixed in position works.Where in the code the problem occurs
Using gdb leads to
ElevationMap.cpp:286
. At the core, the problem is thatgrid_map::EllipseIterator.cpp:32
is not initialized. This function is called byElevationMap.cpp:285
. Eigen allocates an immense amount of memory and finally throwsstd::bad_alloc()
fromEigen/src/Core/util/Memory.h:362-367
.Hacky fix
A quick, hacky fix is to skip the map fusion process of a specific cell in case too much memory is allocated. This code is added between
ElevationMap.cpp:285
andElevationMap.cpp:286
:This is only a temporary fix. The issue should be fixed more permanently in
grid_map
.The text was updated successfully, but these errors were encountered: