ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
![]() | 1 | initial version |
I found the example code on MoveIt! tutorials website.
void move_robot (moveit::planning_interface::MoveGroupInterface &group, geometry_msgs::PoseStamped Pose)
{
group.setStartState(*group.getCurrentState());
group.setPoseTarget(Pose);
moveit::planning_interface::MoveGroupInterface::Plan group_Planer;
bool success = (group.plan(group_Planer) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
if (success)
{
ros::Duration(1).sleep();
group.execute(group_Planer);
}
group.clearPoseTargets();
ros::Duration(1).sleep();
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "move");
ros::NodeHandle nh;
ros::AsyncSpinner spinner(1);
spinner.start();
moveit::planning_interface::MoveGroupInterface group("manipulator");
move_robot(group, pose1);
move_robot(group, pose2);
move_robot(group, pose3);
return 0;
}