Move Group Interface C++
Hi, I am trying the first lot of tutorials from the moveit website and I am having trouble with the move group interface. Here is my cpp file:
#include <moveit/planning_scene_interface/planning_scene_interface.h>
#include <ros/ros.h>
#include <moveit/move_group_interface/move_group.h>
#include "std_msgs/String.h"
#include <moveit_msgs/DisplayTrajectory.h>
moveit::planning_interface::MoveGroup group("arm_t");
moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
int main(int argc, char **argv)
{
ros::NodeHandle node;
ros::Publisher display_publisher = node.advertise<moveit_msgs::DisplayTrajectory>("/move_group/display_planned_path", 1, true);
moveit_msgs::DisplayTrajectory display_trajectory;
ROS_INFO("Reference frame: %s", group.getPlanningFrame().c_str());
ROS_INFO("Reference frame: %s", 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;
group.setPoseTarget(target_pose1);
moveit::planning_interface::MoveGroup::Plan my_plan;
bool success = group.plan(my_plan);
ROS_INFO("Visualizing plan 1 (pose goal) %s",success?"":"FAILED");
/* Sleep to give Rviz time to visualize the plan. */
sleep(5.0);
return 0;
}
When I try to catkin_make, It come up with the following error:
CMakeFiles/moveit_trial.dir/src/nod_plan.cpp.o: In function `main':
nod_plan.cpp:(.text+0x197): undefined reference to `moveit::planning_interface::MoveGroup::getPlanningFrame() const'
nod_plan.cpp:(.text+0x2a1): undefined reference to `moveit::planning_interface::MoveGroup::getEndEffectorLink() const'
nod_plan.cpp:(.text+0x375): undefined reference to `moveit::planning_interface::MoveGroup::setPoseTarget(geometry_msgs::Pose_<std::allocator<void> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
nod_plan.cpp:(.text+0x3b7): undefined reference to `moveit::planning_interface::MoveGroup::plan(moveit::planning_interface::MoveGroup::Plan&)'
CMakeFiles/moveit_trial.dir/src/nod_plan.cpp.o: In function `__static_initialization_and_destruction_0(int, int)':
nod_plan.cpp:(.text+0x7f7): undefined reference to `moveit::planning_interface::MoveGroup::MoveGroup(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::shared_ptr<tf::Transformer> const&, ros::Duration const&)'
nod_plan.cpp:(.text+0x82c): undefined reference to `moveit::planning_interface::MoveGroup::~MoveGroup()'
nod_plan.cpp:(.text+0x848): undefined reference to `moveit::planning_interface::PlanningSceneInterface::PlanningSceneInterface()'
nod_plan.cpp:(.text+0x84d): undefined reference to `moveit::planning_interface::PlanningSceneInterface::~PlanningSceneInterface()'
collect2: ld returned 1 exit status
make[2]: *** [/home/thibault/reem-sim_ws/devel/lib/moveit_trial/moveit_trial] Error 1
make[1]: *** [moveit_trial/CMakeFiles/moveit_trial.dir/all] Error 2
I have tried modifying my CmakeLists and package.xml but it still comes up with the same error. Can anyone help with this issue please.
Thanks.
Hey, facing the same problem, how did you solve it?