OMPL compilation error
Hello, I'm relatively new to C++ and Catkin. I am using OMPL in ROS Noetic for path-planning on a drone, but I'm having trouble with compiling it. I'm including the following files from the OMPL library:
#include <ompl/base/SpaceInformation.h>
#include <ompl/base/spaces/SE3StateSpace.h>
#include <ompl/geometric/PathGeometric.h>
#include <ompl/geometric/planners/informedtrees/ABITstar.h>
#include <ompl/config.h>
I included the OMPL directories and libraries in CMakeLists as follows:
...
find_package(ompl REQUIRED)
...
include_directories(
SYSTEM
include
${catkin_INCLUDE_DIRS}
${Eigen3_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${OMPL_INCLUDE_DIRS}
)
add_library(path_searching
...
src/bitstar.cpp
)
target_link_libraries( path_searching
${catkin_LIBRARIES}
${OMPL_LIBRARIES}
)
When I try to compile the workspace, I get the following error:
/home/catkin_ws/src/path_searching/include/path_searching/bitstar.h:4:10: fatal error: ompl/base/SpaceInformation.h: No such file or directory
4 | #include <ompl/base/SpaceInformation.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
When I look in "/opt/ros/noetic/include", I see that there is a folder called "ompl-1.6", which has one folder called "ompl". If I copy the "ompl" folder to "/opt/ros/noetic/include", it compiles without any errors but this feels like a very hacky workaround. I've tried adding "/opt/ros/noetic/include/ompl-1.6/ompl" to include_directories in CMakeLists, but it didn't work. Also, I tried including the files as:
#include <ompl-1.6/ompl/base/SpaceInformation.h>
#include <ompl-1.6/ompl/base/spaces/SE3StateSpace.h>
#include <ompl-1.6/ompl/geometric/PathGeometric.h>
#include <ompl-1.6/ompl/geometric/planners/informedtrees/ABITstar.h>
#include <ompl-1.6/ompl/config.h>
But this gave the following error:
/opt/ros/noetic/include/ompl-1.6/ompl/base/SpaceInformation.h:40:10: fatal error: ompl/base/State.h: No such file or directory
40 | #include "ompl/base/State.h"
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Asked by pietb on 2023-06-14 10:08:48 UTC
Answers
These error message are usually a symptom of a mismatch between the version of ompl your source code uses and the version of ompl installed on the system. It appears that the src code API you are using is not compatible with the ros-noetic-ompl
apt package. If you obtained this code from a repository, make sure you have checked out the version intended for noetic.
I see there is also an apt system library libompl-dev (v1.4.2). The src code might be compatible with that one. You would choose this alternative by specifying it in the CMakeLists.txt
file, not by hacking up the include path names in the .cpp files.
Asked by Mike Scheutzow on 2023-06-17 15:05:28 UTC
Comments