ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
1

undefined reference to moveit core api

asked 2018-07-08 23:06:45 -0500

hejiav5 gravatar image

updated 2018-07-09 13:11:30 -0500

Description

When I compile my program which uses moveit, I got following error msgs:

undefined reference to `robot_model_loader::RobotModelLoader::RobotModelLoader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
undefined reference to `robot_model_loader::RobotModelLoader::~RobotModelLoader()'
undefined reference to `robot_model_loader::RobotModelLoader::~RobotModelLoader()'

Your environment

  • ROS Distro: Kinetic
  • OS Version: Ubuntu 16.04
  • Binary build
  • release version: 0.9.12

The code I am trying to compile

#include <pluginlib/class_loader.h>
#include <ros/ros.h>

// MoveIt!
#include <moveit/robot_model_loader/robot_model_loader.h>
#include <moveit/robot_model/robot_model.h>
#include <moveit/planning_interface/planning_interface.h>
#include <moveit/planning_scene/planning_scene.h>
#include <moveit/kinematic_constraints/utils.h>
#include <moveit_msgs/DisplayTrajectory.h>
#include <moveit_msgs/PlanningScene.h>


int main( int argc, char **argv ) {

    ros::init( argc, argv, "move_group_testr" );
    ros::AsyncSpinner spinner(1);
    spinner.start();

    ros::NodeHandle nh;
    ros::NodeHandle nh_private("~");

    robot_model_loader::RobotModelLoader robot_model_loader( "robot_description" );

    return 0;
}

CMakeList.txt I'm using

...
find_package(catkin REQUIRED COMPONENTS
         roscpp
         rospy
         intera_core_msgs
         moveit_core
         moveit_msgs
         shape_msgs
         message_generation
         sensor_msgs
         message_runtime
)
...
target_link_libraries(sawyer_collision_checker_node
    ${catkin_LIBRARIES}
    ${Boost_LIBRARIES}
)
edit retag flag offensive close merge delete

Comments

Can you add the source code you're trying to compile that produces this error. Thanks.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-07-09 03:19:09 -0500 )edit

Hi, I just added my code and CMake file. I'm also sure that following library /opt/ros/kinetic/lib/libmoveit_robot_model.so is included in ${catkin_LIBRARIES}

hejiav5 gravatar image hejiav5  ( 2018-07-09 13:14:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2018-07-09 19:25:34 -0500

Kriegrich gravatar image

Check out the example project in the pr2_moveit_tutorials.

In particular, you need to include moveit_core and moveit_ros_planning_interface in your CMakeLists.txt as follows:

# ...
find_package(catkin REQUIRED COMPONENTS
    # ...
    moveit_core
    moveit_ros_planning_interface
)

catkin_package(
    CATKIN_DEPENDS
    # ...
    moveit_core
    moveit_ros_planning_interface
)
# ...

Make sure to add moveit_core and moveit_ros_planning_interface as build_depend and exec_depend to your package.xml.

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

Stats

Asked: 2018-07-08 23:06:45 -0500

Seen: 746 times

Last updated: Jul 09 '18