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

Revision history [back]

I had the exact same problem on Gentoo when compiling Indigo. I managed to fix it with the following changes:

--- a/joint_state_listener.cpp  2017-10-15 13:50:04.198605688 +0200
+++ b/joint_state_listener.cpp  2017-10-15 13:50:41.560552892 +0200
@@ -131,6 +131,12 @@
       last_publish_time_[state->name[i]] = state->header.stamp;
   }
 }
+// From: https://stackoverflow.com/a/12315035
+template<typename T>
+boost::shared_ptr<T> make_shared_ptr(std::shared_ptr<T>& ptr)
+{
+    return boost::shared_ptr<T>(ptr.get(), [ptr](T*) mutable {ptr.reset();});
+}

 // ----------------------------------
 // ----- MAIN -----------------------
@@ -161,9 +167,9 @@

   MimicMap mimic;

-  for(std::map< std::string, boost::shared_ptr< urdf::Joint > >::iterator i = model.joints_.begin(); i != model.joints_.end(); i++){
+  for(auto i = model.joints_.begin(); i != model.joints_.end(); i++){
     if(i->second->mimic){
-      mimic.insert(make_pair(i->first, i->second->mimic));
+      mimic.insert(make_pair(i->first, make_shared_ptr<urdf::JointMimic>(i->second->mimic)));
     }
   }

I'm not sure if this'll break anything or introduce memory leaks, but it compiles.