Hi MoveIt! users,
I generated a moveit package for my 7 dof arm through the Setup Assistant and the demo is working well. I'm trying now to generate a C++ node which uses the MoveGroup Interface library through this example :
http://moveit.ros.org/wiki/index.php/Groovy/MoveGroup_Interface_tutorial.
I've put this C++ code I called MoveGroupInterface into my generated moveit package and when I try to catkin_make my groovy_workspace I got this error :
Base path: /home/robin/groovy_workspace
Source space: /home/robin/groovy_workspace/src
Build space: /home/robin/groovy_workspace/build
Devel space: /home/robin/groovy_workspace/devel
Install space: /home/robin/groovy_workspace/install
####
#### Running command: "make cmake_check_build_system" in "/home/robin/groovy_workspace/build"
####
####
#### Running command: "make -j2 -l2" in "/home/robin/groovy_workspace/build"
####
Linking CXX executable /home/robin/groovy_workspace/devel/lib/kuka_lbr_simple_moveit_generated/MoveGroupInterface
CMakeFiles/MoveGroupInterface.dir/src/MoveGroupInterface.cpp.o: In function `main':
MoveGroupInterface.cpp:(.text+0xfc): undefined reference to `move_group_interface::MoveGroup::MoveGroup(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::shared_ptr<tf::Transformer> const&, ros::Duration const&)'
MoveGroupInterface.cpp:(.text+0x138): undefined reference to `move_group_interface::MoveGroup::setRandomTarget()'
MoveGroupInterface.cpp:(.text+0x144): undefined reference to `move_group_interface::MoveGroup::move()'
MoveGroupInterface.cpp:(.text+0x155): undefined reference to `move_group_interface::MoveGroup::~MoveGroup()'
MoveGroupInterface.cpp:(.text+0x1b1): undefined reference to `move_group_interface::MoveGroup::~MoveGroup()'
MoveGroupInterface.cpp:(.text+0x1dd): undefined reference to `move_group_interface::MoveGroup::~MoveGroup()'
MoveGroupInterface.cpp:(.text+0x1fd): undefined reference to `move_group_interface::MoveGroup::~MoveGroup()'
collect2: ld returned 1 exit status
make[2]: *** [/home/robin/groovy_workspace/devel/lib/kuka_lbr_simple_moveit_generated/MoveGroupInterface] Error 1
make[1]: *** [kuka_lbr_simple_moveit_generated/CMakeFiles/MoveGroupInterface.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
Here is my MoveGroupInterface.cpp code :
#include <ros/ros.h>
#include <moveit/move_group_interface/move_group.h>
int main(int argc, char **argv)
{
ros::init(argc, argv, "MoveGroupInterface", ros::init_options::AnonymousName);
// start a ROS spinning thread
ros::AsyncSpinner spinner(1);
spinner.start();
// this connects to a running instance of the move_group node
move_group_interface::MoveGroup group("manipulator");
// specify that our target will be a random one
group.setRandomTarget();
// plan the motion and then move the group to the sampled target
group.move();
ros::waitForShutdown();
}
And my CMakelist.txt :
cmake_minimum_required(VERSION 2.8.3)
project(kuka_lbr_simple_moveit_generated)
## Find catkin and any catkin packages - and others packages
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg)
## Find the Eigen package
find_package(Eigen REQUIRED)
include_directories(${EIGEN_INCLUDE_DIRS})
add_definitions(${EIGEN_DEFINITIONS})
## Declare a catkin package
catkin_package()
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY config DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
## Build the executable (located by default at ~/catkin_ws/devel/lib/share/<package name> - in our case at ~/groovy_workspace/build/kuka_lbr_simple_moveit_generated/CMakeFiles/MoveGroupInterface.dir/src)
add_executable(MoveGroupInterface src/MoveGroupInterface.cpp)
## Specify libraries to link a library or executable target against
target_link_libraries(MoveGroupInterface ${catkin_LIBRARIES})
It's clearly a library linking problem, am I all right? It has happen to me the same with my ros standard functions and I fixed it adding a target to the catkin libraries. I guess it should be a similar thing with the /opt/ros/groovy/lib/libmoveit_move_group_interface.so library, shouldn't it? But I can't find out the way to link it in target_link_libraries().
Anyone dealt with the same problem?
Thanks.
Robin