ANYbotics / elevation_mapping

Robot-centric elevation mapping for rough terrain navigation
BSD 3-Clause "New" or "Revised" License
1.31k stars 445 forks source link

Can't write elevation_mapping code in main() #216

Open mhowe8 opened 2 years ago

mhowe8 commented 2 years ago

I am writing my own subscriber to an elevation map. I have my own elevation map stored as a global variable and with each message I convert it into a map and store it as my global map. For some reason, whenever I call functions on this map in main, I get this error:

[elev_map_listener-10] process has died [pid 13617, exit code -8, cmd /home/mikey/travels_ws/devel/lib/travels_main/elev_map_listener name:=elev_map_listener log:=/home/mikey/.ros/log/98279fcc-eda7-11ec-90cc-b1a665a9a6bc/elev_map_listener-10.log]. log file: /home/mikey/.ros/log/98279fcc-eda7-11ec-90cc-b1a665a9a6bc/elev_map_listener-10*.log

However, when I write code that directly involves the map (call elevation_mapping or GridMap functions on the map) in the callback function for the subscriber, or in functions that I call from the callback function, it works fine.

I would like to be able to write my code in main.

maximilianwulf commented 2 years ago

Can you add more debug output?

mhowe8 commented 2 years ago

Running it with valgrind doesn't work either, I think the issue is that I don't have enough space in memory but I will get back to you.

mhowe8 commented 2 years ago

Thread 1 "elev_map_listen" received signal SIGFPE, Arithmetic exception. 0x00007ffff7f5cec1 in grid_map::getIndexFromLinearIndex(unsigned long, Eigen::Array<int, 2, 1, 0, 2, 1> const&, bool) () from /opt/ros/noetic/lib/libgrid_map_core.so (gdb) bt

0 0x00007ffff7f5cec1 in grid_map::getIndexFromLinearIndex(unsigned long, Eigen::Array<int, 2, 1, 0, 2, 1> const&, bool) ()

from /opt/ros/noetic/lib/libgrid_map_core.so

1 0x00007ffff7f6853c in grid_map::GridMapIterator::operator*() const ()

from /opt/ros/noetic/lib/libgrid_map_core.so

2 0x00005555555b5dc7 in main (argc=1, argv=0x7fffffffd2e8)

at /home/mikey/2022-big-idea-software/src/travels_main/src/elev_map_listener.cpp:674