CPP file can't find MoveIT dependencies.
Hi, I've followed the MoveIT tutorials with the PR2 robot on motion planning (movegroup) (http://docs.ros.org/kinetic/api/moveittutorials/html/doc/pr2tutorials/planning/src/doc/movegroupinterfacetutorial.html) and it worked so far that I could see the robot move its arm in RVIZ through MoveIT.
Now, I wanted to try this out on my robot so what I did was I created a new package for my robot through the MoveIT setup assistant with the URDF file that I have. After that I tried to take some minimal amount of code from the tutorial into my own arm.cpp file like this:
#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>
int main(int argc, char **argv)
{
ros::init(argc, argv, "arm");
ros::NodeHandle node_handle;
ros::AsyncSpinner spinner(1);
spinner.start();
static const sd::string PLANNING_GROUP = "arm";
moveit::planning_interface::MoveGroupInterface move_group(PLANNING_GROUP);
moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
const robot_state::JointModelGroup *joint_model_group = move_group.getCurrentState()->getJointModelGroup(PLANNING_GROUP);
//We gebruiken rviz voor de visualisatie
namespace rvt = rviz_visual_tools;
moveit_visual_tools::MoveItVisualTools visual_tools("odom_combined");
visual_tools.deleteAllMarkers();
visual_tools.loadRemoteControl();
//Eigen::Affine3d text_pose = Eigen::Affine3d::Identity();
//text_pose.translation().z() = 1.75; // above head of PR2
//visual_tools.publishText(text_pose, "Arm", rvt::WHITE, rvt::XLARGE);
visual_tools.trigger();
ROS_INFO_NAMED("arm", "Reference frame: %s", move_group.getPlanningFrame().c_str());
ROS_INFO_NAMED("gripper", "End effector link: %s", move_group.getEndEffectorLink().c_str());
geometry_msgs::Pose target_pose1;
target_pose1.orientation.w = 1.0;
target_pose1.position.x = 0.28;
target_pose1.position.y = -0.7;
target_pose1.position.z = 1.0;
move_group.setPoseTarget(target_pose1);
moveit::planning_interface::MoveGroupInterface::Plan my_plan;
bool success = move_group.plan(my_plan);
ROS_INFO_NAMED("arm", "Visualizing plan 1 (pose goal) %s", success ? "" : "FAILED");
ROS_INFO_NAMED("arm", "Visualizing plan 1 as trajectory line");
visual_tools.publishAxisLabeled(target_pose1, "pose1");
visual_tools.publishText(text_pose, "Pose Goal", rvt::WHITE, rvt::XLARGE);
visual_tools.publishTrajectoryLine(my_plan.trajectory_, joint_model_group);
visual_tools.trigger();
visual_tools.prompt("next step");
move_group.move()
}
Now, everytime I try to build my catkin workspace (catkin_make) I get the following error:
fatal error: moveit/move_group_interface/move_group_interface.h: No such file or directory
compilation terminated.
If I comment out that line this error occurs on planningsceneinterface.h and If I comment this one out it happends to DisplayRobotState.h and so on...
My CmakeList looks likes this:
cmake_minimum_required(VERSION 2.8.3)
project(knaak)
find_package(catkin REQUIRED
COMPONENTS
moveit_core
moveit_ros_planning
moveit_ros_planning_interface
pluginlib
geometric_shapes
moveit_visual_tools
)
catkin_package(
CATKIN_DEPENDS
moveit_core
moveit_ros_planning_interface
interactive_markers
)
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
PATTERN "setup_assistant.launch" EXCLUDE)
install(DIRECTORY config DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
add_executable(arm arm.cpp)
And my Package.xml looks like this:
<package>
<name>knaak</name>
<version>0.3.0</version>
<description>
An automatically generated package with all the configuration and launch files for using the robotarm_urdf with the MoveIt! Motion Planning Framework
</description>
<author email="place@hold.er">placeholder</author>
<maintainer email="place@hold.er">placeholder</maintainer>
<license>BSD</license>
<url type="website">http://moveit.ros.org/</url>
<url type="bugtracker">https://github.com/ros-planning/moveit/issues</url>
<url type="repository">https://github.com/ros-planning/moveit</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>pluginlib</build_depend>
<build_depend>moveit_core</build_depend>
<build_depend>moveit_ros_planning_interface</build_depend>
<build_depend>moveit_ros_perception</build_depend>
<build_depend>interactive_markers</build_depend>
<build_depend>geometric_shapes</build_depend>
<build_depend>moveit_visual_tools</build_depend>
<run_depend>pluginlib</run_depend>
<run_depend>moveit_core</run_depend>
<run_depend>moveit_fake_controller_manager</run_depend>
<run_depend>moveit_ros_planning_interface</run_depend>
<run_depend>moveit_ros_perception</run_depend>
<run_depend>interactive_markers</run_depend>
<run_depend>moveit_visual_tools</run_depend>
<run_depend>moveit_ros_move_group</run_depend>
<run_depend>moveit_kinematics</run_depend>
<run_depend>moveit_planners_ompl</run_depend>
<run_depend>moveit_ros_visualization</run_depend>
<run_depend>joint_state_publisher</run_depend>
<run_depend>robot_state_publisher</run_depend>
<run_depend>xacro</run_depend>
<!-- This package is referenced in the warehouse launch files, but does not build out of the box at the moment. Commented the dependency until this works. -->
<!-- <run_depend>warehouse_ros_mongo</run_depend> -->
<build_depend>robotarm_urdf</build_depend>
<run_depend>robotarm_urdf</run_depend>
</package>
Can anyone help me out getting these dependencies to work? Thanks in advance.
Asked by nubdienub on 2017-06-13 05:26:44 UTC
Answers
Hi Add this to your CMakeLists.txt:
include_directories( include ${catkin_INCLUDE_DIRS} )
Asked by atieh on 2021-02-15 09:23:28 UTC
Comments