0
$\begingroup$

Rosanswers logo

Hi @all

i would like to install ros jade on osx. i know that is in experimental state but there's no other way.

in package robot_state_publisher an error is generated.

[ 71%] Building CXX object CMakeFiles/robot_state_publisher.dir/src/joint_state_listener.cpp.o

/Users/blubb/ros_catkin_ws/src/robot_state_publisher/src/joint_state_listener.cpp:165:74: error: no viable conversion from '__map_iterator<__tree_iterator<__value_type<[...],
      std::__1::shared_ptr<urdf::Joint>>, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>, std::__1::shared_ptr<urdf::Joint> >, void *> *, [...]>>' to
      '__map_iterator<__tree_iterator<__value_type<[...], boost::shared_ptr<urdf::Joint>>, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char>,
      boost::shared_ptr<urdf::Joint> >, void *> *, [...]>>'
 for(std::map< std::string, boost::shared_ptr< urdf::Joint > >::iterator i = model.joints_.begin(); i != model.joints_.end(); i++){

if i comment out the following lines in file ros_catkin_ws/src/robot_state_publisher/src/joint_state_listener.cpp all package are compiled successful

In main function:

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

its looks like the compiler can´t cast std::shared_ptr to boost::shared_ptr. On my laptop i have a working version of ROS indigo and the file looks the same and it works.

Can anybody help me?

Thanks


Originally posted by Twista3579 on ROS Answers with karma: 31 on 2017-10-06

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by IsaacT with karma: 16 on 2017-10-15

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.