TheCodez / dynamic-occupancy-grid-map

Implementation of "A Random Finite Set Approach for Dynamic Occupancy Grid Maps with Real-Time Application"
MIT License
268 stars 39 forks source link

Build dogm with ros failed #77

Open synsin0 opened 3 years ago

synsin0 commented 3 years ago

Hi, I am building the ros version of dogm, and at the last stage I failed possibly because of some dependencies issues. my error is like follows:

/usr/bin/ld: /usr/local/lib/libdogm.a(dogm.cu.o): relocation R_X86_64_PC32 against symbol `_ZN4dogm12ParticlesSoAC1Ev' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status dynamic-occupancy-grid-map-ros/dogm_ros/CMakeFiles/dogm_ros.dir/build.make:136: recipe for target '/home/yining/rfs_map/devel/lib/libdogm_ros.so' failed make[2]: [/home/yining/rfs_map/devel/lib/libdogm_ros.so] Error 1 CMakeFiles/Makefile2:1204: recipe for target 'dynamic-occupancy-grid-map-ros/dogm_ros/CMakeFiles/dogm_ros.dir/all' failed make[1]: [dynamic-occupancy-grid-map-ros/dogm_ros/CMakeFiles/dogm_ros.dir/all] Error 2 Makefile:159: recipe for target 'all' failed make: *** [all] Error 2

Maybe I need to recompile dogm? But I don't know where goes wrong, maybe it should not be libdogm.a but libdogm.so?

TheCodez commented 3 years ago

Hi @synsin0,

currently the ROS branch is unfishished and highly outdated. I don't know when I can finish it, as I have very little time at the moment. Your best bet currently is probably to use the code demo from the master branch (as this code is up to date) and try to include it into a custom ROS node.

GarronLiu commented 8 months ago

I was confronted with the same problem! But now I fix it. The solution is below:

  1. Delete your original compiled build folder. Modify the cmakelists.txt of DOGM project: add_library(dogm STATIC ${HEADERS_FILES} ${SRC_FILES} ) into add_library(dogm SHARED ${HEADERS_FILES} ${SRC_FILES} ) [In this way you build it into a SHARED object which can be linked to by the ROS code]. Re-run the command mkdir build && cd build; cmake .. && make; sudo make install;
  2. add #include <OgreTexture.h>in the dogm_rviz_plugin/include/dogm_rviz_plugin/dogm_display.h file. Re-run catkin_make in the WS folder. Then you can use the ros version of DOGM.