ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Add the installation prefix to CMAKE_PREFIX_PATH

asked 2014-02-18 09:09:39 -0500

Suresh_8891 gravatar image

Hi, I am trying to make a subscriber program that listens to an installed package called roscopter. I know the topic and package name. In the CMakeLists i have included the package "roscopter"

find_package(catkin REQUIRED COMPONENTS roscpp roscopter)

However, when i run catkin_make it could not find the package. If tried manually changing the CMAKE_PREFIX_PATH however the error continues.

Here is the cpp that i have:

#include <ros/ros.h>
#include <roscopter/Attitude.h>
#include <iomanip> // for std::setprecision and std::fixed

// A callback function.  Executed each time a new pose
// message arrives.
void attMessageReceived(const roscopter::Attitude& msg) {
  ROS_INFO_STREAM(std::setprecision(2) << std::fixed
    << "roll" <<  msg.roll;

int main(int argc, char **argv) {
  // Initialize the ROS system and become a node.
  ros::init(argc, argv, "subscribe_to_atttiude");
  ros::NodeHandle nh;

  // Create a subscriber object.
  ros::Subscriber sub = nh.subscribe("Attitude", 1000,

  // Let ROS take over.

And the CMakeLists.txt is as follows:

# What version of CMake is needed?
cmake_minimum_required(VERSION 2.8.3)

# The name of this package.

# Find the catkin build system, and any other packages on which we depend.
find_package(catkin REQUIRED COMPONENTS roscpp roscopter)

# Declare our catkin package.

# Specify locations of header files.
include_directories(include ${catkin_INCLUDE_DIRS})
include_directories(include ${~/home/CATWorkspaces})

# Declare the executable, along with its source files.
add_executable(subatt subatt.cpp)

# Specify libraries against which to link.
target_link_libraries(subatt ${catkin_LIBRARIES})

Any help is highly appreciated. Thanks!

edit retag flag offensive close merge delete


Which ROS distro are you using? I can't see roscopter as being a released catkin package anywhere.

Dirk Thomas gravatar image Dirk Thomas  ( 2014-02-18 09:39:49 -0500 )edit

I am using hydro on ubuntu 13.10. I was able to locate the required config files manually in the workspace. If it truly doesnt have catkin package, how should i go about doing this? Thanks for your response!

Suresh_8891 gravatar image Suresh_8891  ( 2014-02-18 11:44:50 -0500 )edit

If roscopter is a rosbuild package you can not use it from a catkin package. The only option would be to also use rosbuild for your package. If there is a catkin-based version you could use that from your catkin package.

Dirk Thomas gravatar image Dirk Thomas  ( 2014-02-18 12:03:56 -0500 )edit

Noted. But i used catkin_make with roscopter. I followed the following steps: To be exact: "catkin_make --pkg roscopter". So theoretically it should be possible right?

Suresh_8891 gravatar image Suresh_8891  ( 2014-02-18 13:39:03 -0500 )edit

Noted. Thanks for assistance!

Suresh_8891 gravatar image Suresh_8891  ( 2014-02-18 15:59:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-18 13:59:27 -0500

Dirk Thomas gravatar image

The referenced roscopter repo does not have any headers so "roscopter/Attitude.h" won't be found. Beside that package has several other problems just from a first look to the package.xml and CMakeLists.txt file.

edit flag offensive delete link more

Question Tools


Asked: 2014-02-18 09:09:39 -0500

Seen: 18,999 times

Last updated: Feb 18 '14