Code Monkey home page Code Monkey logo

Comments (11)

yunkong11 avatar yunkong11 commented on August 17, 2024 1

Another suggestion could be that, in src/visual_odometry/CMakeLists.txt, at both line 145 and 152, add ${OpenCV_LIBS} along with ${catkin_LIBRARIES}.

I solved this problem according to your suggestion,thank you very much.

from vloam-cmu-16833.

YukunXia avatar YukunXia commented on August 17, 2024

I haven't seen this, but could you make another minimal testing folder for OpenCV? Generate a cv::Mat and print, or imread an image and visualize it out. See how you properly configure your OpenCV libraries in your CMakeLists.txt, and replace all OpenCV configurations under this repository with that one.

Some tips that may help:

  • Check your OpenCV installed folder
    • Since I set the minimal OpenCV version to 4.5.1, it's likely that you have to manually install it, rather than use one-liner from apt-get. If you do that, there's a step to choose the installation path. Maybe you can specify that path before every "find_package".
    • A lower OpenCV version may also work with this repo. I don't think I used any fancy OpenCV functions, so change the version number if that's necessary and good luck.
  • Check OpenCVconfig.cmake under a system path. At line 80 or so, OpenCV_INSTALL_PATH is defined. Check if the defined path is the correct one.

from vloam-cmu-16833.

YukunXia avatar YukunXia commented on August 17, 2024

Another suggestion could be that, in src/visual_odometry/CMakeLists.txt, at both line 145 and 152, add ${OpenCV_LIBS} along with ${catkin_LIBRARIES}.

from vloam-cmu-16833.

KalmanSLAMer avatar KalmanSLAMer commented on August 17, 2024

I get this problem "tried to advertise a service that is already advertised in this node" when I run this program. Have you faced this issue? Looking forward to your reply.

from vloam-cmu-16833.

YukunXia avatar YukunXia commented on August 17, 2024

I get this problem "tried to advertise a service that is already advertised in this node" when I run this program. Have you faced this issue? Looking forward to your reply.

@wwq985 This is really another problem. Could you please open another issue?

In that new issue, please attach some more information, eg. which service is complaining, which command you have input into each terminal, and if there's any other ROS program/node running.

from vloam-cmu-16833.

KalmanSLAMer avatar KalmanSLAMer commented on August 17, 2024

Thanks.
when I roslaunch this,
process[vloam_main_node -1]: started with pid [18081]
process[rviz-2]: started with pid [18082]
[ERROR] [1626056112.350555675]: Tried to advertise a service that is already advertised in this node [/rviz/compressed/setparameters]
There is nothing when I play the bag.

from vloam-cmu-16833.

kloukiniotisandreas avatar kloukiniotisandreas commented on August 17, 2024

Adding the path to opencv in include_directories solved the issue. Thanks
e.g.
include_directories(
${catkin_INCLUDE_DIRS}
/usr/local/include/opencv4
${OpenCV_INCLUDE_DIRS}
)

from vloam-cmu-16833.

YukunXia avatar YukunXia commented on August 17, 2024

Adding the path to opencv in include_directories solved the issue. Thanks
e.g.
include_directories(
${catkin_INCLUDE_DIRS}
/usr/local/include/opencv4
${OpenCV_INCLUDE_DIRS}
)

@kloukiniotisandreas This I think means that your opencv hasn't been properly configured with CMake. ${OpenCV_INCLUDE_DIRS} should imply your opencv's include folder, eg. /usr/local/include/opencv4. Anyway, you can run the program now.

from vloam-cmu-16833.

yunkong11 avatar yunkong11 commented on August 17, 2024

I also encountered the same problem,I am using ros melodic and Ubuntu 18.04。
[ 98%] Linking CXX executable /home/fp/catkin_ws/devel/lib/vloam_main/vloam_main_node
/home/fp/catkin_ws/devel/lib/libimage_util.so:对‘cv::imshow(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&)’未定义的引用
/home/fp/catkin_ws/devel/lib/libimage_util.so:对‘cv::namedWindow(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, int)’未定义的引用
/home/fp/catkin_ws/devel/lib/libimage_util.so:对‘cv::calcOpticalFlowPyrLK(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputOutputArray const&, cv::_OutputArray const&, cv::OutputArray const&, cv::Size, int, cv::TermCriteria, int, double)’未定义的引用
/home/fp/catkin_ws/devel/lib/libimage_util.so:对‘cv::waitKey(int)’未定义的引用
/home/fp/catkin_ws/devel/lib/libpoint_cloud_util.so:对‘cv::setMouseCallback(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, void ()(int, int, int, int, void), void*)’未定义的引用
collect2: error: ld returned 1 exit status
VLOAM-CMU-16833-master/src/vloam_main/CMakeFiles/vloam_main_node.dir/build.make:818: recipe for target '/home/fp/catkin_ws/devel/lib/vloam_main/vloam_main_node' failed
make[2]: *** [/home/fp/catkin_ws/devel/lib/vloam_main/vloam_main_node] Error 1
CMakeFiles/Makefile2:3069: recipe for target 'VLOAM-CMU-16833-master/src/vloam_main/CMakeFiles/vloam_main_node.dir/all' failed
make[1]: *** [VLOAM-CMU-16833-master/src/vloam_main/CMakeFiles/vloam_main_node.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

In vloam_main/CMakeFiles,I add the path to opencv
include_directories(
include
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
/usr/local/include/opencv4
${OpenCV_INCLUDE_DIRS})

But still not resolved,Looking forward to your reply.

from vloam-cmu-16833.

YukunXia avatar YukunXia commented on August 17, 2024

I also encountered the same problem,I am using ros melodic and Ubuntu 18.04。 [ 98%] Linking CXX executable /home/fp/catkin_ws/devel/lib/vloam_main/vloam_main_node /home/fp/catkin_ws/devel/lib/libimage_util.so:对‘cv::imshow(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, cv::_InputArray const&)’未定义的引用 /home/fp/catkin_ws/devel/lib/libimage_util.so:对‘cv::namedWindow(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, int)’未定义的引用 /home/fp/catkin_ws/devel/lib/libimage_util.so:对‘cv::calcOpticalFlowPyrLK(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::InputOutputArray const&, cv::OutputArray const&, cv::OutputArray const&, cv::Size, int, cv::TermCriteria, int, double)’未定义的引用 /home/fp/catkin_ws/devel/lib/libimage_util.so:对‘cv::waitKey(int)’未定义的引用 /home/fp/catkin_ws/devel/lib/libpoint_cloud_util.so:对‘cv::setMouseCallback(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, void ()(int, int, int, int, void), void*)’未定义的引用 collect2: error: ld returned 1 exit status VLOAM-CMU-16833-master/src/vloam_main/CMakeFiles/vloam_main_node.dir/build.make:818: recipe for target '/home/fp/catkin_ws/devel/lib/vloam_main/vloam_main_node' failed make[2]: *** [/home/fp/catkin_ws/devel/lib/vloam_main/vloam_main_node] Error 1 CMakeFiles/Makefile2:3069: recipe for target 'VLOAM-CMU-16833-master/src/vloam_main/CMakeFiles/vloam_main_node.dir/all' failed make[1]: *** [VLOAM-CMU-16833-master/src/vloam_main/CMakeFiles/vloam_main_node.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j12 -l12" failed

In vloam_main/CMakeFiles,I add the path to opencv include_directories( include ${catkin_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS} ${CERES_INCLUDE_DIRS} /usr/local/include/opencv4 ${OpenCV_INCLUDE_DIRS})

But still not resolved,Looking forward to your reply.

The main problem is that there're undefined references of OpenCV. Did you manage to compile any code using OpenCV with CMake? If so, please feel free to adapt the cmakelists under this repo. And maybe share your solution here.

https://github.com/YukunXia/VLOAM-CMU-16833/blob/master/src/vloam_main/CMakeLists.txt#L180-L182

The ${OpenCV_LIBS} should get the linking job done. Maybe you can check this variable in your cmakelists? eg. print this variable.

from vloam-cmu-16833.

YukunXia avatar YukunXia commented on August 17, 2024

Another suggestion could be that, in src/visual_odometry/CMakeLists.txt, at both line 145 and 152, add ${OpenCV_LIBS} along with ${catkin_LIBRARIES}.

I solved this problem according to your suggestion,thank you very much.

Cool. I'll close this issue again.

from vloam-cmu-16833.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.