CMake Error image_transport when trying to catkin_make project

asked 2016-11-21 09:27:53 -0600

niko8505 gravatar image

updated 2016-11-21 09:41:12 -0600

gvdhoorn gravatar image

I am working on ROS Indigo and I am trying to build a simple app that would show the image published by the Astra camera. I do this by subscribing to the following topic /camera/rgb/image_raw. But when running catkin_make I get the following error:

CMake Error at /home/turtlebot/catkin_ws/devel/share/image_transport/cmake/image_transportConfig.cmake:106 (message):
  Project 'image_transport' specifies
  '/home/turtlebot/catkin_ws/src/image_common/image_transport/include' as an
  include dir, which is not found.  It does neither exist as an absolute
  directory nor in
  '/home/turtlebot/catkin_ws/src/image_common/image_transport//home/turtlebot/catkin_ws/src/image_common/image_transport/include'.
  Ask the maintainer 'Jack O'Quin <jack.oquin@gmail.com>, Vincent Rabaud
  <vincent.rabaud@gmail.com>' to fix it.
Call Stack (most recent call first):
  /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:75 (find_package)
  detect_green_object/CMakeLists.txt:3 (find_package)

Here is my code, CMakeLists.txt and package.xml

#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <opencv2/highgui/highgui.hpp>
#include <cv_bridge/cv_bridge.h>

void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
  try
  {
    cv::imshow("view", cv_bridge::toCvShare(msg, "bgr8")->image);
    cv::waitKey(30);
  }
  catch (cv_bridge::Exception& e)
  {
    ROS_ERROR("Could not convert from '%s' to 'bgr8'.", msg->encoding.c_str());
  }
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "image_listener");
  ros::NodeHandle nh;
  cv::namedWindow("view");
  cv::startWindowThread();
  image_transport::ImageTransport it(nh);
  image_transport::Subscriber sub = it.subscribe("/camera/rgb/image_raw", 1, imageCallback);
  ros::spin();
  cv::destroyWindow("view");
}

Here is my package.xml

<?xml version="1.0"?>
<package>
  <name>detect_green_object</name>
  <version>0.0.0</version>
  <description>The detect_green_object package</description>

  <maintainer email="turtlebot@todo.todo">turtlebot</maintainer>

  <license>TODO</license>


  <buildtool_depend>catkin</buildtool_depend>

  <build_depend>cv_bridge</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>sensor_msgs</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>message_filters</build_depend>
  <build_depend>pluginlib</build_depend>
  <build_depend>rosconsole</build_depend>
  <build_depend>roslib</build_depend>
  <build_depend>image_transport</build_depend>
  <build_depend>tf</build_depend>

  <run_depend>cv_bridge</run_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>rospy</run_depend>
  <run_depend>sensor_msgs</run_depend>
  <run_depend>std_msgs</run_depend>
  <run_depend>message_filters</run_depend>
  <run_depend>pluginlib</run_depend>
  <run_depend>rosconsole</run_depend>
  <run_depend>roslib</run_depend>
  <run_depend>image_transport</run_depend>
  <run_depend>tf</run_depend>



  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- Other tools can request additional information be placed here -->

  </export>
</package>

Here is my CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
project( detect_green_object )
find_package(catkin REQUIRED
  COMPONENTS
    roscpp
    cv_bridge
    rospy
    std_msgs   
    message_filters
    pluginlib
    rosconsole
    roslib
    sensor_msgs
    image_transport
    tf
    OpenCV

)
find_package( Boost REQUIRED )

catkin_package( 
  LIBRARIES ${PROJECT_NAME}
  DEPENDS roscpp rospy std_msgs cv_bridge message_filters pluginlib rosconsole roslib sensor_msgs image_transport tf
)


include_directories(
  ${catkin_INCLUDE_DIRS}
)

add_executable( detect_green_object detect_green_object.cpp )
target_link_libraries( detect_green_object ${OpenCV_LIBS} ${catkin_LIBRARIES} )
edit retag flag offensive close merge delete

Comments

1

Not an answer, but roscpp rospy std_msgs cv_bridge message_filters pluginlib rosconsole roslib sensor_msgs image_transport tf are not DEPENDS, but CATKIN_DEPENDS. Also: you have LIBRARIES ${PROJECT_NAME}, but you don't actually build any libraries.

gvdhoorn gravatar imagegvdhoorn ( 2016-11-21 09:41:57 -0600 )edit
1

Finally: as far as I know, OpenCV is not a Catkin package, so you can't / shouldn't add it to the find_package(.. COMPONENTS .. ) list.

gvdhoorn gravatar imagegvdhoorn ( 2016-11-21 09:43:47 -0600 )edit