Tag Archives: dyn_small_obs_avoidance Compile Error

How to Solve dyn_small_obs_avoidance Compile Error (eigen version Issue)

Problem description

While Compiling dyn_small_obs_avoidance, catkin_make report an error:

/home/xcs/catkin_ws_dyn/src/dyn_small_obs_avoidance/path_searching/src/kinodynamic_astar.cpp:919:61: error: ‘const class Eigen::ArrayWrapper<const Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>, const Eigen::CwiseBinaryOp<Eigen::internal::scalar_difference_op<double>, const Eigen::Matrix<double, 3, 1>, const Eigen::Matrix<double, 3, 1> > > >’ has no member named ‘floor’
   Vector3i idx = ((pt - origin_) * inv_resolution_).array().floor().cast<int>();
                                                             ^~~~~
/home/xcs/catkin_ws_dyn/src/dyn_small_obs_avoidance/path_searching/src/kinodynamic_astar.cpp:919:74: error: expected primary-expression before ‘int’
   Vector3i idx = ((pt - origin_) * inv_resolution_).array().floor().cast<int>();
   dyn_small_obs_avoidance/path_searching/CMakeFiles/path_searching.dir/build.make:62: recipe for target 'dyn_small_obs_avoidance/path_searching/CMakeFiles/path_searching.dir/src/kinodynamic_astar.cpp.o' failed
make[2]: *** [dyn_small_obs_avoidance/path_searching/CMakeFiles/path_searching.dir/src/kinodynamic_astar.cpp.o] Error 1
CMakeFiles/Makefile2:1260: recipe for target 'dyn_small_obs_avoidance/path_searching/CMakeFiles/path_searching.dir/all' failed
make[1]: *** [dyn_small_obs_avoidance/path_searching/CMakeFiles/path_searching.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed                                                 

Cause analysis:

By modifying the location where the error occurs, it is found that the error still exists, and the judgment error has nothing to do with the code itself
referring to other posts, I found that the previously installed version of eigen is eigen3.2.1, which may be too low
try upgrading the eigen version.


Solution:

1. Uninstall the  eigen

sudo updatedb  
locate eigen3 
sudo rm -rf /usr/include/eigen3 /usr/lib/cmake/eigen3 /usr/share/doc/libeigen3-dev /usr/share/pkgconfig/eigen3.pc /var/lib/dpkg/info/libeigen3-dev.list /var/lib/dpkg/info/libeigen3-dev.md5sums

2. Installation dependency

sudo apt-get install libopenblas-dev
sudo apt-get install --no-install-recommends libboost1.58-all-dev
sudo apt-get install libx11-dev
sudo apt-get install libgl1-mesa-dev 
sudo apt-get install libglu1-mesa-dev 
sudo apt-get install freeglut3-dev
sudo apt-get install doxygen
sudo apt-get install cmake
sudo wget https://nchc.dl.sourceforge.net/project/glew/glew/2.1.0/glew-2.1.0.tgz --no-check-certificate
sudo tar -xzvf glew-2.1.0.tgz
cd glew-2.1.0/
sudo make 
sudo make install
sudo ldconfig -v

Some may not be installed. I will ignore them and continue with the following steps.

3. Download eigen3.3.7, and extract it to the home directory
download address: eigen3.3.7

4. Installing eigen3.3.7

mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig -v

5. Map the path of eigen3 to the /usr/include path.

sudo cp -r /usr/local/include/eigen3 /usr/include/eigen3 
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen

6. Re-enter dyn_small_obs_avoidance workspace catkin_make, compiled successfully.

[ 79%] Building CXX object dyn_small_obs_avoidance/path_planning/CMakeFiles/goal_transform.dir/src/goalpoint_transformer.cpp.o
[ 81%] Building CXX object dyn_small_obs_avoidance/path_planning/CMakeFiles/path_planning_node.dir/src/path_planning.cpp.o
[ 93%] Built target livox_ros_driver_node
[ 95%] Linking CXX executable /home/xcs/catkin_ws_dyn/devel/lib/path_planning/goal_transform
[ 95%] Built target goal_transform
[ 97%] Linking CXX executable /home/xcs/catkin_ws_dyn/devel/lib/path_planning/path_planning_node
[ 97%] Built target path_planning_node
[100%] Linking CXX executable /home/xcs/catkin_ws_dyn/devel/lib/fast_lio/loam_laserMapping