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

Can't find package: cartographer_ros

asked 2019-07-02 13:03:46 -0600

Alan8 gravatar image

updated 2019-07-03 15:09:53 -0600

gvdhoorn gravatar image

I'm trying to get a marker array containing pose info from cartographer_ros. I got the 2D cartographer_ros demo working, and the Subscribe demo working.

I'm now trying to modify the Subscribe demo to get pose messages from cartographer_ros, but the documentation for this is sparse so I'm experimenting.

The error I'm getting is not being able to "link" with cartographer_ros:

-- +++ processing catkin package: 'agitr'
-- ==> add_subdirectory(agitr)
-- Could NOT find cartographer_ros (missing: cartographer_ros_DIR)
-- Could not find the required component 'cartographer_ros'. The
following CMake error indicates that
you either need to install the package
with the same name or change your
environment so that it can be found.
CMake Error at


<?xml  version ="1.0"?> <package>
                Examples from A Gentle Introduction to ROS
        </description> <maintainer  email="">
        Alan </maintainer> <license>TO DO</license>





find_package(catkin REQUIRED
COMPONENTS roscpp cartographer_ros)



#include <ros/ros.h>
#include <cartographer_ros/Pose.h>
#include <iomanip>

// for std :: setprecision and std :: fixed
// A callback function.  Executed each time a new pose
// message arrives.

void poseMessageReceived ( const  cartographer_ros::Pose& msg)  {
         ROS_INFO_STREAM( std::setprecision(2) << std::fixed
                         << " position =(" <<  msg.x << ", " << msg.y << " ) "
                         << "direction=" << msg.theta ) ;

int main (int argc, char **argv)  {
        // Initialize the ROS system and become a node.
        ros::init (argc, argv, "subscribe_to_pose");
        ros::NodeHandle nh;
        ROS_INFO_STREAM("We're in main.\n");

      // Create a subscriber object.
      ros::Subscriber sub = nh.subscribe("cartographer_ros/pose", 1000,
            // Let ROS take over.

ROS Environment:



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

# Name of this package.
project (agitr)

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

# Declare our catkin package.
catkin_package ()

# Specify locations of header files.
include_directories(include ${catkin_INCLUDE_DIRS})

# Declare the executable , along with i t s source f i l e s.  I f
# there are multiple executables, use multiple copies of
# this line.
add_executable (subpose subpose.cpp)

# Specify l i b r a r i e s against which to l i n k.  Again , t h i s
# l i n e should be copied f o r each d i s t i n c t executable in
# the package.
target_link_libraries(subpose ${catkin_LIBRARIES})

I'm using Ubuntu 18.04.2 LTS/melodic, gcc version 7.4.0.

(Sorry about the formatting; the XML angle brackets aren't coming through, and the font seems to be changing randomly.)

Thanks! Alan

edit retag flag offensive close merge delete



The formatting was broken because you were formatting things as quotes rather than as pre-formatted text.

Geoff gravatar image Geoff  ( 2019-07-02 18:48:43 -0600 )edit

It may seem obvious, but have you installed cartographer? It is not installed by default. You need to install the package ros-melodic-cartographer-ros.

Geoff gravatar image Geoff  ( 2019-07-02 20:14:20 -0600 )edit

Thanks for the comments Geoff. I assumed it was already installed since I can run the Cartographer 2D demo, but I reinstalled it and I'm getting the same results.

When I type "rospack depends1 cartographer_ros", I get "[rospack] Error: no such package cartographer_ros".

I go over the tutorials, but feel like pieces are missing. Can you tell me where packages are installed, and how they're located? Thanks.

Alan8 gravatar image Alan8  ( 2019-07-03 11:02:31 -0600 )edit

Found the packages: /opt/ros/melodic/share but cartographer_ros isn't there, even though I've "installed" it. Another mystery...

Alan8 gravatar image Alan8  ( 2019-07-03 11:43:10 -0600 )edit

1 Answer

Sort by ┬╗ oldest newest most voted

answered 2019-07-03 12:08:06 -0600

Alan8 gravatar image

updated 2019-07-03 12:19:31 -0600

In case anyone else is wondering how to do an install:

sudo apt-get install ros-melodic-cartographer-ros

The environment variable ROS_PACKAGE_PATH is the list of directories to search for ROS packages.

edit flag offensive delete link more

Question Tools



Asked: 2019-07-02 13:03:46 -0600

Seen: 1,964 times

Last updated: Jul 03 '19