ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Look at below example function, you provide a target goal and constructed movegroup interface of your manipulator.

/**
 * @brief moves robot tcp in joint space, a straight line following is not guarenteed
 *
 * @param robot_tcp_goal_in_joint_space
 * @param move_group_ptr_
 */
void RobotController::moveEndEffectortoGoalinJointSpace(
    geometry_msgs::Pose robot_tcp_goal_in_joint_space,
    moveit::planning_interface::MoveGroupInterface *move_group_ptr_) {
    // set pose target for tcp
    move_group_ptr_->setPoseTarget(robot_tcp_goal_in_joint_space);

    // Now, we call the planner to compute the plan
    moveit::planning_interface::MoveGroupInterface::Plan my_plan;

    // chechk wheter a sucessfull plan was found
    bool success = (move_group_ptr_->plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);

    // stream some info about this sucess state
    ROS_INFO_NAMED("Motion Plan for End-Effector %s", success ? "SUCCESSED" : "FAILED");

    // Move the manipulator according to Updated End-Effector goal pose
    move_group_ptr_->execute(my_plan);
}