Moveit: /opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type typedef std::shared_ptr<Type> Name##Ptr;

Created on 6 Mar 2017  Â·  5Comments  Â·  Source: ros-planning/moveit

Description

I program C++ file with movegroup interface according to the moveit tutorial, the program i built is show in the follwing:

#include <ros/ros.h>
#include <moveit/move_group_interface/move_group_interface.h>
int main(int argc, char **argv)
{
  ros::init(argc, argv, "lesson_move_group");


  ros::AsyncSpinner spinner(1);
  spinner.start();

  moveit::planning_interface::MoveGroup group("manipulator");

  std::map<std::string, double> joints;
  joints["shoulder_pan_joint"] = -0.40;
  joints["shoulder_lift_joint"] =  0.27;
  joints["elbow_joint"] =  0.48;
  joints["wrist_1_joint"] =  0.07;
  joints["wrist_2_joint"] =  0.75;
  joints["wrist_3_joint"] = -0.19;

  group.setJointValueTarget(joints);

  group.move();


}

Overview of your issue here.
After catkin_make the package, the erros are:

In file included from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:0:
/opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:43:2: warning: #warning "This header is deprecated and will go away in ROS lunar." "Please use moveit/move_group_interface/move_group_interface.h" "and the class MoveGroupInterface instead of MoveGroup" [-Wcpp]
 #warning "This header is deprecated and will go away in ROS lunar."\
  ^
In file included from /opt/ros/kinetic/include/moveit/macros/class_forward.h:40:0,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group_interface.h:41,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:40,
                 from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:
/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<Type> Name##Ptr;                                                                             \
                ^
/opt/ros/kinetic/include/moveit/macros/class_forward.h:51:3: note: in expansion of macro ‘MOVEIT_DECLARE_PTR’
   MOVEIT_DECLARE_PTR(C, C);
   ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:50:1: note: in expansion of macro ‘MOVEIT_CLASS_FORWARD’
 MOVEIT_CLASS_FORWARD(Shape);
 ^
/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:53:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<const Type> Name##ConstPtr;
                ^
/opt/ros/kinetic/include/moveit/macros/class_forward.h:51:3: note: in expansion of macro ‘MOVEIT_DECLARE_PTR’
   MOVEIT_DECLARE_PTR(C, C);
   ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:50:1: note: in expansion of macro ‘MOVEIT_CLASS_FORWARD’
 MOVEIT_CLASS_FORWARD(Shape);
....
....

move_group_test/CMakeFiles/move_joint.dir/build.make:62: recipe for target 'move_group_test/CMakeFiles/move_joint.dir/src/move_joint.cpp.o' failed
make[2]: *** [move_group_test/CMakeFiles/move_joint.dir/src/move_joint.cpp.o] Error 1
CMakeFiles/Makefile2:4223: recipe for target 'move_group_test/CMakeFiles/move_joint.dir/all' failed
make[1]: *** [move_group_test/CMakeFiles/move_joint.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

It seems that the problem comes from the library of moveit because of Compatibility or for the other reason. Can yo tell me how to resolve the problem

Your environment

  • ROS Distro: Kinetic
  • OS Version: e.g. Ubuntu 16.04

Steps to reproduce

Tell us how to reproduce this issue. Attempt to provide a working demo, perhaps using Docker.

Expected behaviour

Tell us what should happen

Actual behaviour

Tell us what happens instead

Backtrace or Console output

[ 25%] Built target ur_msgs_generate_messages_nodejs
[ 27%] Building CXX object move_group_test/CMakeFiles/move_joint.dir/src/move_joint.cpp.o
[ 43%] Built target ur_msgs_generate_messages_eus
[ 60%] Built target ur_msgs_generate_messages_py
[ 74%] Built target ur_msgs_generate_messages_cpp
[ 87%] Built target ur_msgs_generate_messages_lisp
[ 91%] Built target ur10_moveit_plugin
[ 91%] Built target ur_msgs_generate_messages
[ 94%] Built target ur5_moveit_plugin
[ 98%] Built target ur3_moveit_plugin
In file included from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:0:
/opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:43:2: warning: #warning "This header is deprecated and will go away in ROS lunar." "Please use moveit/move_group_interface/move_group_interface.h" "and the class MoveGroupInterface instead of MoveGroup" [-Wcpp]
 #warning "This header is deprecated and will go away in ROS lunar."\
  ^
In file included from /opt/ros/kinetic/include/moveit/macros/class_forward.h:40:0,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group_interface.h:41,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:40,
                 from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:
/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<Type> Name##Ptr;                                                                             \
                ^
/opt/ros/kinetic/include/moveit/macros/class_forward.h:51:3: note: in expansion of macro ‘MOVEIT_DECLARE_PTR’
   MOVEIT_DECLARE_PTR(C, C);
   ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:50:1: note: in expansion of macro ‘MOVEIT_CLASS_FORWARD’
 MOVEIT_CLASS_FORWARD(Shape);
 ^
/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:53:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<const Type> Name##ConstPtr;
                ^
/opt/ros/kinetic/include/moveit/macros/class_forward.h:51:3: note: in expansion of macro ‘MOVEIT_DECLARE_PTR’
   MOVEIT_DECLARE_PTR(C, C);
   ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:50:1: note: in expansion of macro ‘MOVEIT_CLASS_FORWARD’
 MOVEIT_CLASS_FORWARD(Shape);
 ^
In file included from /opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:42:0,
                 from /opt/ros/kinetic/include/moveit/robot_model/robot_model.h:48,
                 from /opt/ros/kinetic/include/moveit/robot_state/robot_state.h:41,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group_interface.h:43,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:40,
                 from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:174:21: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
   const std::vector<shapes::ShapeConstPtr>& getShapes() const
                     ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:174:21: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:174:42: error: template argument 1 is invalid
   const std::vector<shapes::ShapeConstPtr>& getShapes() const
                                          ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:174:42: error: template argument 2 is invalid
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:179:38: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
   void setGeometry(const std::vector<shapes::ShapeConstPtr>& shapes, const EigenSTL::vector_Affine3d& origins);
                                      ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:179:38: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:179:59: error: template argument 1 is invalid
   void setGeometry(const std::vector<shapes::ShapeConstPtr>& shapes, const EigenSTL::vector_Affine3d& origins);
                                                           ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:179:59: error: template argument 2 is invalid
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:254:15: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
   std::vector<shapes::ShapeConstPtr> shapes_;
               ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:254:15: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:254:36: error: template argument 1 is invalid
   std::vector<shapes::ShapeConstPtr> shapes_;
                                    ^
/opt/ros/kinetic/include/moveit/robot_model/link_model.h:254:36: error: template argument 2 is invalid
In file included from /opt/ros/kinetic/include/moveit/macros/class_forward.h:40:0,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group_interface.h:41,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:40,
                 from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:
/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<Type> Name##Ptr;                                                                             \
                ^
/opt/ros/kinetic/include/moveit/macros/class_forward.h:51:3: note: in expansion of macro ‘MOVEIT_DECLARE_PTR’
   MOVEIT_DECLARE_PTR(C, C);
   ^
/opt/ros/kinetic/include/moveit/kinematics_base/kinematics_base.h:137:1: note: in expansion of macro ‘MOVEIT_CLASS_FORWARD’
 MOVEIT_CLASS_FORWARD(KinematicsBase);
 ^
/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:53:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<const Type> Name##ConstPtr;
                ^
/opt/ros/kinetic/include/moveit/macros/class_forward.h:51:3: note: in expansion of macro ‘MOVEIT_DECLARE_PTR’
   MOVEIT_DECLARE_PTR(C, C);
   ^
/opt/ros/kinetic/include/moveit/kinematics_base/kinematics_base.h:137:1: note: in expansion of macro ‘MOVEIT_CLASS_FORWARD’
 MOVEIT_CLASS_FORWARD(KinematicsBase);
 ^
In file included from /opt/ros/kinetic/include/moveit/robot_model/robot_model.h:48:0,
                 from /opt/ros/kinetic/include/moveit/robot_state/robot_state.h:41,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group_interface.h:43,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:40,
                 from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:56:25: error: ‘KinematicsBasePtr’ is not a member of ‘kinematics’
 typedef boost::function<kinematics::KinematicsBasePtr(const JointModelGroup*)> SolverAllocatorFn;
                         ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:56:25: error: ‘KinematicsBasePtr’ is not a member of ‘kinematics’
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:56:77: error: a function call cannot appear in a constant-expression
 typedef boost::function<kinematics::KinematicsBasePtr(const JointModelGroup*)> SolverAllocatorFn;
                                                                             ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:56:78: error: template argument 1 is invalid
 typedef boost::function<kinematics::KinematicsBasePtr(const JointModelGroup*)> SolverAllocatorFn;
                                                                              ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:101:17: error: ‘KinematicsBaseConstPtr’ in namespace ‘kinematics’ does not name a type
     kinematics::KinematicsBaseConstPtr solver_instance_const_;
                 ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:103:17: error: ‘KinematicsBasePtr’ in namespace ‘kinematics’ does not name a type
     kinematics::KinematicsBasePtr solver_instance_;
                 ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:529:21: error: ‘KinematicsBaseConstPtr’ in namespace ‘kinematics’ does not name a type
   const kinematics::KinematicsBaseConstPtr& getSolverInstance() const
                     ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:534:21: error: ‘KinematicsBasePtr’ in namespace ‘kinematics’ does not name a type
   const kinematics::KinematicsBasePtr& getSolverInstance()
                     ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h: In member function ‘moveit::core::JointModelGroup::KinematicsSolver::operator bool() const’:
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:81:51: error: ‘solver_instance_’ was not declared in this scope
       return allocator_ && !bijection_.empty() && solver_instance_;
                                                   ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h: In member function ‘void moveit::core::JointModelGroup::KinematicsSolver::reset()’:
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:86:7: error: ‘solver_instance_’ was not declared in this scope
       solver_instance_.reset();
       ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:87:7: error: ‘solver_instance_const_’ was not declared in this scope
       solver_instance_const_.reset();
       ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h: In member function ‘bool moveit::core::JointModelGroup::setRedundantJoints(const std::vector<std::__cxx11::basic_string<char> >&)’:
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:543:33: error: ‘struct moveit::core::JointModelGroup::KinematicsSolver’ has no member named ‘solver_instance_’
     if (group_kinematics_.first.solver_instance_)
                                 ^
/opt/ros/kinetic/include/moveit/robot_model/joint_model_group.h:544:38: error: ‘struct moveit::core::JointModelGroup::KinematicsSolver’ has no member named ‘solver_instance_’
       return group_kinematics_.first.solver_instance_->setRedundantJoints(joints);
                                      ^
In file included from /opt/ros/kinetic/include/moveit/macros/class_forward.h:40:0,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group_interface.h:41,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:40,
                 from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:
/opt/ros/kinetic/include/moveit/robot_model/robot_model.h: At global scope:
/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<Type> Name##Ptr;                                                                             \
                ^
/opt/ros/kinetic/include/moveit/macros/class_forward.h:51:3: note: in expansion of macro ‘MOVEIT_DECLARE_PTR’
   MOVEIT_DECLARE_PTR(C, C);
   ^
/opt/ros/kinetic/include/moveit/robot_model/robot_model.h:64:1: note: in expansion of macro ‘MOVEIT_CLASS_FORWARD’
 MOVEIT_CLASS_FORWARD(RobotModel);
 ^
/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:53:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<const Type> Name##ConstPtr;
                ^
/opt/ros/kinetic/include/moveit/macros/class_forward.h:51:3: note: in expansion of macro ‘MOVEIT_DECLARE_PTR’
   MOVEIT_DECLARE_PTR(C, C);
   ^
/opt/ros/kinetic/include/moveit/robot_model/robot_model.h:64:1: note: in expansion of macro ‘MOVEIT_CLASS_FORWARD’
 MOVEIT_CLASS_FORWARD(RobotModel);
 ^
In file included from /opt/ros/kinetic/include/moveit/robot_state/robot_state.h:41:0,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group_interface.h:43,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:40,
                 from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:
/opt/ros/kinetic/include/moveit/robot_model/robot_model.h:601:11: error: ‘ShapePtr’ in namespace ‘shapes’ does not name a type
   shapes::ShapePtr constructShape(const urdf::Geometry* geom);
           ^
In file included from /opt/ros/kinetic/include/moveit/robot_state/robot_state.h:42:0,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group_interface.h:43,
                 from /opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:40,
                 from /home/lkj/catkin_ws/src/move_group_test/src/move_joint.cpp:2:
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:63:80: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
   AttachedBody(const LinkModel* link, const std::string& id, const std::vector<shapes::ShapeConstPtr>& shapes,
                                                                                ^
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:63:80: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:63:101: error: template argument 1 is invalid
   AttachedBody(const LinkModel* link, const std::string& id, const std::vector<shapes::ShapeConstPtr>& shapes,
                                                                                                     ^
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:63:101: error: template argument 2 is invalid
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:88:21: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
   const std::vector<shapes::ShapeConstPtr>& getShapes() const
                     ^
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:88:21: error: ‘ShapeConstPtr’ is not a member of ‘shapes’
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:88:42: error: template argument 1 is invalid
   const std::vector<shapes::ShapeConstPtr>& getShapes() const
                                          ^
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:88:42: error: template argument 2 is invalid
/opt/ros/kinetic/include/moveit/robot_state/attached_body.h:141:15: error: ‘ShapeConstPtr’ is not a member of ‘shapes’

Use gist.github.com to copy-paste the console output or segfault backtrace using gdb.

Most helpful comment

/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<Type> Name##Ptr;

Have you enabled C++11 in your CMakeLists.txt? If not, that is most likely the cause of your issue.

moveit_core/CMakeLists.txt shows one way to do that.

All 5 comments

/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<Type> Name##Ptr;

Have you enabled C++11 in your CMakeLists.txt? If not, that is most likely the cause of your issue.

moveit_core/CMakeLists.txt shows one way to do that.

YES! It works to add C++11 in CMakeList.txt.

@lkj1114889770 cool same issue, and thanks @gavanderhoorn . Did you rebuild moveIt with C++11 from source ? I'm migrating code from indigo to kinectic, and add add_compile_options(-std=c++11) in every custom ros package CMakeLists.txt. But not yet rebuild moveit from source.

@YuehChuan You don't have to build MoveIt yourself, but all packages that include MoveIt headers have to be compiles with -std=c++11 which is what adding add_compile_options(-std=c++11) to the beginning of all the respective package/CMakeLists.txt does.

/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
   typedef std::shared_ptr<Type> Name##Ptr;

Have you enabled C++11 in your CMakeLists.txt? If not, that is most likely the cause of your issue.

moveit_core/CMakeLists.txt shows one way to do that.

yes,good job.Thanks

Was this page helpful?
0 / 5 - 0 ratings