【问题标题】:Linking the PCL library with ROS将 PCL 库与 ROS 链接
【发布时间】:2014-09-26 04:37:24
【问题描述】:

我已经在ubuntu中安装了ROS和PCL... 我的代码中的导入是:

#include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/correspondence.h>
#include <pcl/features/normal_3d_omp.h>
#include <pcl/features/shot_omp.h>
#include <pcl/features/board.h>
#include <pcl/keypoints/uniform_sampling.h>
#include <pcl/recognition/cg/hough_3d.h>
#include <pcl/recognition/cg/geometric_consistency.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <pcl/kdtree/impl/kdtree_flann.hpp>
#include <pcl/common/transforms.h>
#include <pcl/console/parse.h>

当我用这个 CMakeLists 编译程序时:

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(correspondence_grouping)
find_package(PCL 1.3 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(correspondence_grouping correspondence_grouping.cpp)
target_link_libraries(correspondence_grouping ${PCL_COMMON_LIBRARIES}${PCL_IO_LIBRARIES})

出现这个错误:

In file included from /opt/ros/fuerte/include/pcl-1.5/pcl/io/pcd_io.h:43:0,
             from /home/user/Desktop/PCL/Grouping/correspondence_grouping.cpp:1:
/opt/ros/fuerte/include/pcl-1.5/pcl/point_cloud.h:46:29: fatal error: std_msgs/Header.h: No such file or directory

我是 Linux 和 ROS+PCL 的新手(我正在将它们用于大学项目..),但我不明白问题出在哪里。

附:使用 PCL 的其他 cpp 文件也会出现类似的错误。

我不知道如何解决它......

谢谢

【问题讨论】:

    标签: linker header-files point-cloud-library ros


    【解决方案1】:

    我认为您最好使用 ROS 构建系统,根据您使用的 ROS 版本,它是 rosbuildcatkincatkin 是 AFAIK 的一组 CMake 宏,可引入 ROS 依赖项等。

    见:

    http://wiki.ros.org/pcl/Tutorials

    【讨论】:

      【解决方案2】:

      您应该使用 rosbuild 环境创建一个包(参见:[创建一个 ros 包]),然后将其放入您的 CMakelist.txt 以使用 PCL:

       ...
       find_package(PCL 1.3 REQUIRED)
       include_directories(${PCL_INCLUDE_DIRS})
       link_directories(${PCL_LIBRARY_DIRS})
       add_definitions(${PCL_DEFINITIONS})
       ...
      

      std_msgs 的依赖由 manifest.xml(随包自动生成)处理,具有以下标准依赖:

      <package>
      ...
          <depend package="std_msgs"/>
          <depend package="rospy"/>
          <depend package="roscpp"/>
      ...
      </package>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-10-06
        • 2015-03-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多