当前位置:   article > 正文

ORB_SLAM错误总结_failed to invoke rospack to get compile flags for

failed to invoke rospack to get compile flags for package 'orb_slam2_pointma

在编译ORB_SLAM的时候出现的错误:

一、未添加路径

-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
[rosbuild] Building package ORB_SLAM-master
**[rosbuild] Error from directory check: /opt/ros/indigo/share/ros/core/rosbuild/bin/check_same_directories.py /home/jy/work_sp/src/ORB_SLAM-master /home/jy/catkin_ws/src/ORB_SLAM-master**
1
Traceback (most recent call last):
  File "/opt/ros/indigo/share/ros/core/rosbuild/bin/check_same_directories.py", line 48, in <module>
    raise Exception
Exception
CMake Error at /opt/ros/indigo/share/ros/core/rosbuild/private.cmake:102 (message):
  [rosbuild] rospack found package "ORB_SLAM-master" at
  "/home/jy/work_sp/src/ORB_SLAM-master", but the current directory is
  "/home/jy/catkin_ws/src/ORB_SLAM-master".  You should double-check your
  ROS_PACKAGE_PATH to ensure that packages are found in the correct
  precedence order.
Call Stack (most recent call first):
  /opt/ros/indigo/share/ros/core/rosbuild/public.cmake:177 (_rosbuild_check_package_location)
  CMakeLists.txt:4 (rosbuild_init)


-- Configuring incomplete, errors occurred!
See also "/home/jy/catkin_ws/src/ORB_SLAM-master/build/CMakeFiles/CMakeOutput.log"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

在这里插入图片描述

解决办法:

在.zshrc 末尾添加:export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/jy/catkin_ws/src/ORB_SLAM-master
(这个是我的路径 我用的是zsh 大家根据实际情况更改就行)
ORB路径添加到ROS

二、缺少opencv2

cmake ..    
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
[rosbuild] Building package ORB_SLAM-master
Failed to invoke /opt/ros/indigo/bin/rospack deps-manifests ORB_SLAM-master
**[rospack] Error: package 'ORB_SLAM-master' depends on non-existent package 'opencv2' and rosdep claims that it is not a system dependency. Check the ROS_PACKAGE_PATH or try calling 'rosdep update'**


CMake Error at /opt/ros/indigo/share/ros/core/rosbuild/public.cmake:129 (message):
  

  Failed to invoke rospack to get compile flags for package
  'ORB_SLAM-master'.  Look above for errors from rospack itself.  Aborting.
  Please fix the broken dependency!

Call Stack (most recent call first):
  /opt/ros/indigo/share/ros/core/rosbuild/public.cmake:207 (rosbuild_invoke_rospack)
  CMakeLists.txt:4 (rosbuild_init)


-- Configuring incomplete, errors occurred!
See also "/home/jy/catkin_ws/src/ORB_SLAM-master/build/CMakeFiles/CMakeOutput.log"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

在这里插入图片描述

解决办法:

直接将文件manifest.xml中 < depend package=“opencv2”/ > 删除就好了。

三、缺少头文件

/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc: In member function ‘void ORB_SLAM::ORBextractor::ComputeKeyPoints(std::vector<std::vector<cv::KeyPoint> >&)’:
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc:607:63: error: ‘FAST’ was not declared in this scope
                 FAST(cellImage,cellKeyPoints[i][j],fastTh,true);
                                                               ^
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc:616:34: error: ‘ORB’ has not been declared
                 if( scoreType == ORB::HARRIS_SCORE )
                                  ^
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc:683:17: error: ‘KeyPointsFilter’ has not been declared
                 KeyPointsFilter::retainBest(keysCell,nToRetain[i][j]);
                 ^
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc:699:13: error: ‘KeyPointsFilter’ has not been declared
             KeyPointsFilter::retainBest(keypoints,nDesiredFeatures);
             ^
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc: In member function ‘void ORB_SLAM::ORBextractor::operator()(cv::InputArray, cv::InputArray, std::vector<cv::KeyPoint>&, cv::OutputArray)’:
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc:760:82: error: ‘GaussianBlur’ was not declared in this scope
         GaussianBlur(workingMat, workingMat, Size(7, 7), 2, 2, BORDER_REFLECT_101);
                                                                                  ^
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc: In member function ‘void ORB_SLAM::ORBextractor::ComputePyramid(cv::Mat, cv::Mat)’:
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc:800:78: error: ‘INTER_LINEAR’ was not declared in this scope
             resize(mvImagePyramid[level-1], mvImagePyramid[level], sz, 0, 0, INTER_LINEAR);
                                                                              ^
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc:800:90: error: ‘resize’ was not declared in this scope
             resize(mvImagePyramid[level-1], mvImagePyramid[level], sz, 0, 0, INTER_LINEAR);
                                                                                          ^
/home/jy/catkin_ws/src/ORB_SLAM-master/src/ORBextractor.cc:803:80: error: ‘INTER_NEAREST’ was not declared in this scope
                 resize(mvMaskPyramid[level-1], mvMaskPyramid[level], sz, 0, 0, INTER_NEAREST);
                                                                                ^
make[2]: *** [CMakeFiles/ORB_SLAM-master.dir/src/ORBextractor.cc.o] 错误 1
make[1]: *** [CMakeFiles/ORB_SLAM-master.dir/all] 错误 2
make: *** [all] 错误 2
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

在这里插入图片描述

解决办法:

相应文件的头文件缺少(我的是ORBextractor.cc)。搜了好久的解决办法,一点用都没,后来去官网上找文件。一对比才发现我的头文件少了好几个在这里插入图片描述把缺失的复制上就行了。

实在不行就重装系统吧 我重装系统后一遍跑通orb_slam

四、订阅节点失败

在使用我自己的电脑摄像头来跑ORB_SLAM的时候,摄像头发布的节点名字是usb_cam/******,而ORB_SLAM订阅的节点名字是camera/********
我的usb_cam-test.launch文件是

<launch>
  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video0" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="yuyv" />
    <param name="camera_frame_id" value="usb_cam" />
    <param name="io_method" value="mmap"/>
  </node>
  <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/usb_cam/image_raw"/>
    <param name="autosize" value="true" />
  </node>
</launch>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

这样的节点ORB_SLAM 是没办法订阅的,在rviz界面显示不出摄像头的画面。

解决办法:

修改usb_cam-test.launch文件

<launch>
  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
   <param name="video_device" value="/dev/video0" />
   <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="yuyv" />
    <param name="camera_frame_id" value="camera" />
    <param name="io_method" value="mmap"/>
    <remap from="/usb_cam/image_raw" to="/camera/image_raw" />
  </node>
  <node name="image_view" pkg="image_view" type="image_view"  respawn="false" output="screen">
    <remap from="/image" to="/ORB_SLAM/Frame" />
    <param name="autosize" value="true"/>
    </node>
</launch>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

然后再运行ExampleGroovyOrNewer.launch 文件即可。
或者可以把两个文件结合在一个launch文件里。

<launch>
  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
   <param name="video_device" value="/dev/video0" />
   <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="yuyv" />
    <param name="camera_frame_id" value="camera" />
    <param name="io_method" value="mmap"/>
    <remap from="/usb_cam/image_raw" to="/camera/image_raw" />
  </node>

   <node pkg="image_view" type="image_view" name="image_view" respawn="false" output="log">
    <remap from="/image" to="/ORB_SLAM/Frame" />
    <param name="autosize" value="true"/>
    </node>

    <node pkg="rviz" type="rviz" name="rviz" args="-d $(find ORB_SLAM)/Data/rviz.rviz" output="log">
   </node>

    <node pkg="ORB_SLAM" type="ORB_SLAM" name="ORB_SLAM"  args="Data/ORBvoc.txt Data/Settings.yaml" cwd="node" output="screen">
   </node>

</launch>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

这样只需要启动这一个文件就行了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/292856?site
推荐阅读
相关标签
  

闽ICP备14008679号