Ask Your Question
0

CPP file can't find MoveIT dependencies.

asked 2017-06-13 05:26:44 -0500

nubdienub gravatar image

Hi, I've followed the MoveIT tutorials with the PR2 robot on motion planning (move_group) ( http://docs.ros.org/kinetic/api/movei... ) 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 planning_scene_interface.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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-02-15 08:23:28 -0500

atieh gravatar image

Hi Add this to your CMakeLists.txt:

include_directories( include ${catkin_INCLUDE_DIRS} )

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

2 followers

Stats

Asked: 2017-06-13 05:26:44 -0500

Seen: 577 times

Last updated: Jun 13 '17