Ask Your Question

Why doesn't the karto package build?

asked 2011-12-16 02:25:28 -0500

Hozefa Indorewala gravatar image

Hello all,

I checked out the karto package and built it initially using rosmake but the node wasn't built. After going through the CMakeLists.txt, I found out that the lines to build the node were commented out and un-commenting and building the package again led me to errors.

I was wondering if this package is still maintained. I am using running ros-electric on my machine. Thank you in advance for your help.

Cheers, Hozefa

edit retag flag offensive close merge delete


The karto node generation from the cpp source code is commented in the CMakeLists.txt because the code related with the TF API is broken. See the patch I've attatched below.

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2013-02-05 06:18:23 -0500 )edit

3 Answers

Sort by » oldest newest most voted

answered 2012-02-24 04:38:51 -0500

FabricioFC gravatar image

updated 2012-02-24 04:40:08 -0500

I managed to compile 36074 revision.

cmake complained about the ROS_PACKAGE_PATH variable, to solve this:

export ROS_PACKAGE_PATH=/path/to/your/karto/checkout:$ROS_PACKAGE_PATH

After this:

cmake -G "Unix Makefiles" .


edit flag offensive delete link more

answered 2012-02-24 02:14:33 -0500

FabricioFC gravatar image

I was getting the same issue and this happens because the cmakelist is messed up, try to get another version of commit.

And the tutorial is wrong, there is no need of these \ in "cmake -G \"Unix Makefiles\" .."

edit flag offensive delete link more

answered 2013-02-05 05:23:49 -0500

updated 2013-02-05 06:16:58 -0500

The proposed solutions are not enough to solve the problem on the current HEAD revision. Several things are still broken. Here I provide a patch over the revision r40357 to make the karto package work again on fuerte. Enjoy!


  • fixed dependencies with boost, eigen and sba in the CMakeLists.txt and manifest.xml
  • fixed some broken code related with tf (probably related with API changes)
  • fixed stage demo config file (deprecated syntax laser to ranger)
Index: manifest.xml
--- manifest.xml    (revision 40357)
+++ manifest.xml    (working copy)
@@ -16,6 +16,7 @@
   <depend package="rosconsole"/>
   <depend package="nav_msgs"/>
   <depend package="message_filters"/>
+  <depend package="sba"/>

     <cpp cflags="-I${prefix}/karto/include" lflags="-Wl,-rpath,${prefix}/karto/lib -L${prefix}/karto/lib -lOpenKarto"/>
Index: src/slam_karto.cpp
--- src/slam_karto.cpp  (revision 40357)
+++ src/slam_karto.cpp  (working copy)
@@ -218,7 +218,7 @@

     // Get the laser's pose, relative to base.
     tf::Stamped<tf::pose> ident;
-    tf::Stamped<bttransform> laser_pose;
+    tf::Stamped<tf::pose> laser_pose;
     ident.frame_id_ = scan->header.frame_id;
     ident.stamp_ = scan->header.stamp;
@@ -298,9 +298,9 @@
 SlamKarto::getOdomPose(karto::Pose2& karto_pose, const ros::Time& t)
   // Get the robot's pose
-  tf::Stamped<tf::pose> ident (btTransform(tf::createQuaternionFromRPY(0,0,0),
-                                           btVector3(0,0,0)), t, base_frame_);
-  tf::Stamped<bttransform> odom_pose;
+  tf::Stamped<tf::transform> ident (tf::Transform(tf::createQuaternionFromRPY(0,0,0),
+                                           tf::Vector3(0,0,0)), t, base_frame_);
+  tf::Stamped<tf::transform> odom_pose;
     tf_.transformPose(odom_frame_, ident, odom_pose);
@@ -563,8 +563,8 @@
     tf::Stamped<tf::pose> odom_to_map;
-      tf_.transformPose(odom_frame_,tf::Stamped<tf::pose> (btTransform(tf::createQuaternionFromRPY(0, 0, corrected_pose.GetHeading()),
-                                                                    btVector3(corrected_pose.GetX(), corrected_pose.GetY(), 0.0)).inverse(),
+      tf_.transformPose(odom_frame_,tf::Stamped<tf::pose> (tf::Transform(tf::createQuaternionFromRPY(0, 0, corrected_pose.GetHeading()),
+                                                                    tf::Vector3(corrected_pose.GetX(), corrected_pose.GetY(), 0.0)).inverse(),
                                                                     scan->header.stamp, base_frame_),odom_to_map);
     catch(tf::TransformException e)
Index: worlds/
--- worlds/ (revision 40357)
+++ worlds/ (working copy)
@@ -4,7 +4,7 @@
   gui_nose 0

-define topurg laser
+define topurg ranger

   range_max 30.0
Index: CMakeLists.txt
--- CMakeLists.txt  (revision 40357)
+++ CMakeLists.txt  (working copy)
@@ -11,8 +11,14 @@
   message(FATAL_ERROR "Build of Karto failed")

 # Build the ROS wrapper
-# rosbuild_add_executable(bin/slam_karto src/slam_karto.cpp src/spa_solver.cpp)
-# target_link_libraries(bin/slam_karto OpenKarto)
+rosbuild_add_executable(bin/slam_karto src/slam_karto.cpp src/spa_solver.cpp)
+target_link_libraries(bin/slam_karto OpenKarto)
+rosbuild_link_boost(bin/slam_karto signals)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-12-16 02:25:28 -0500

Seen: 1,222 times

Last updated: Feb 05 '13