How to write Cmakelist to use moveit on elfin robot
Hello ROS community, I am a beginner ROS learner using ROS melodic Ubuntu 18.04 kernal 5.4.0-89-generic.
My purpose is to program the robot manipulator Elfin E3 robotic arm, here's the repository https://github.com/hans-robot/elfin_r...
Where do i add or edit in the Cmakelist.txt, if i wish to use the Moveit and Elfin API? (i.e. i wanted to use #include <moveit move_group_interface="" move_group_interface.h=""> and all the functions they provide)
After catkin_make, I was met with multiple errors that mostly look like this:
CMake Error at /home/imre/catkin_ws/build/moveit_msgs/cmake/moveit_msgs-genmsg.cmake:2055 (add_custom_target):
add_custom_target cannot create target "moveit_msgs_generate_messages_eus"
because another target with the same name already exists. The existing
target is a custom target created in source directory
"/home/imre/catkin_ws/src/qfpack". See documentation for policy CMP0002
for more details.
Call Stack (most recent call first):
/opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
moveit_msgs/CMakeLists.txt:104 (generate_messages)
The following describes how i did it:
I added these headers into the node that i wish to run, i named it drawcomb.cpp. Here's the top section of it:
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/planning_scene_interface/planning_scene_interface.h>
#include <moveit_msgs/DisplayRobotState.h>
#include <moveit_msgs/DisplayTrajectory.h>
#include <moveit_msgs/AttachedCollisionObject.h>
#include <moveit_msgs/CollisionObject.h>
#include <moveit_visual_tools/moveit_visual_tools.h>
#include <ros/ros.h>
Here's my cmakelist.txt :
cmake_minimum_required(VERSION 3.0.2)
project(qfpack)
find_package(catkin REQUIRED COMPONENTS
moveit_core
moveit_planners_ompl
moveit_ros_planning
moveit_ros_planning_interface
actionlib
control_msgs
controller_manager_msgs
elfin_robot_msgs
std_srvs
std_msgs
roscpp
rospy
tf
tf_conversions
genmsg
dynamic_reconfigure
interactive_markers
moveit_visual_tools
moveit_ros_perception
pluginlib
geometric_shapes
pcl_ros
pcl_conversions
rosbag
tf2_ros
tf2_eigen
tf2_geometry_msgs
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES qfpack
CATKIN_DEPENDS roscpp
DEPENDS system_lib
)
add_executable(drawcomb src/drawcomb.cpp)
target_link_libraries(drawcomb ${catkin_LIBRARIES} ${Boost_LIBRARIES})
#add_dependencies(drawcomb qfpack_generate_messages_cpp)
What mistakes did i make in Cmakelist.txt or what have i not done? Thanks for advice!
Look for multiple versions of the same package somewhere in your catkin_ws/src, delete the one you don't want to be using (or add a CATKIN_IGNORE to it), do a catkin clean (or otherwise delete catkin_ws build and devel dirs)