Go to the documentation of this file.00001 #ifndef GRASP_EXECUTION_REACH_TEST_MOVEITPLANNER_H
00002 #define GRASP_EXECUTION_REACH_TEST_MOVEITPLANNER_H
00003
00004 #include <ros/ros.h>
00005 #include <moveit_msgs/MoveItErrorCodes.h>
00006 #include <moveit_msgs/MotionPlanRequest.h>
00007 #include <moveit_msgs/MotionPlanResponse.h>
00008 #include <moveit_msgs/GetMotionPlan.h>
00009 #include <moveit_msgs/GetStateValidity.h>
00010 #include <moveit_msgs/GetCartesianPath.h>
00011 #include <moveit_msgs/RobotTrajectory.h>
00012 #include <moveit/kinematic_constraints/utils.h>
00013 #include <moveit_msgs/PlanningScene.h>
00014
00015 namespace moveit_planning_helper
00016 {
00017
00025 class MoveItPlanner
00026 {
00027 public:
00032 MoveItPlanner(ros::NodeHandle& n,
00033 const std::string& _moveit_motion_plan_service="/plan_kinematic_path",
00034 const std::string& _moveit_check_state_validity_service="/check_state_validity");
00035
00036 ~MoveItPlanner();
00037
00038
00044 static moveit_msgs::Constraints getPoseConstraint(const std::string& link_name,
00045 const geometry_msgs::PoseStamped& pose, double tolerance_pos, double tolerance_angle, int type);
00046
00047
00051 static moveit_msgs::OrientationConstraint getOrientationConstraint(const std::string& link_name,
00052 const geometry_msgs::QuaternionStamped& quat,
00053 const float& x_tolerance,
00054 const float& y_tolerance,
00055 const float& z_tolerance);
00056
00062 static moveit_msgs::Constraints getJointConstraint(const sensor_msgs::JointState& joint_state,
00063 const float& joint_tolerance);
00064
00070 static moveit_msgs::PositionConstraint getSpherePoseConstraint(
00071 const std::string &link_name,
00072 const geometry_msgs::PoseStamped &target_pose,
00073 float arm_reach_span);
00074
00079 static moveit_msgs::PositionConstraint getBoxConstraint(const std::string &link_name,
00080 const geometry_msgs::PoseStamped& box_origin, const double& x, const double& y, const double& z);
00081
00082
00095 moveit_msgs::MoveItErrorCodes requestTrajectory(
00096 const geometry_msgs::PoseStamped& arm_base_pose,
00097 float arm_reach_span,
00098 const std::string& planning_group,
00099 const moveit_msgs::Constraints& goal_constraints,
00100 const moveit_msgs::Constraints * path_constraints,
00101 const sensor_msgs::JointState& start_state,
00102 moveit_msgs::RobotTrajectory& result_traj);
00103
00131 moveit_msgs::MoveItErrorCodes requestTrajectoryForMobileRobot(
00132 const geometry_msgs::PoseStamped& start_pose,
00133 const geometry_msgs::PoseStamped& target_pose,
00134 float arm_reach_span, const std::string& planning_group,
00135 const moveit_msgs::Constraints& goal_constraints,
00136 const moveit_msgs::Constraints * path_constraints,
00137 const sensor_msgs::JointState& start_state,
00138 const std::string& virtual_joint_name,
00139 const std::string& target_frame_virtual_joint,
00140 moveit_msgs::RobotTrajectory& result_traj);
00141
00142 private:
00143
00144 bool init();
00145 void shutdown();
00146
00157 moveit_msgs::MoveItErrorCodes requestTrajectory(const std::string& group_name,
00158 const std::vector<moveit_msgs::Constraints>& goal_constraints,
00159 const sensor_msgs::JointState& from_state,
00160 const moveit_msgs::WorkspaceParameters& wspace,
00161 const sensor_msgs::MultiDOFJointState *mdjs,
00162 const moveit_msgs::Constraints* path_constraints,
00163 moveit_msgs::RobotTrajectory& result);
00164
00165
00166 moveit_msgs::MotionPlanResponse sendServiceRequest(moveit_msgs::MotionPlanRequest& request);
00167
00177 bool makeWorkspace(const geometry_msgs::PoseStamped& from,
00178 const geometry_msgs::PoseStamped& to,
00179 float arm_reach_span, moveit_msgs::WorkspaceParameters& result) const;
00180
00185 bool makeWorkspace(const geometry_msgs::PoseStamped& origin,
00186 float arm_reach_span,
00187 moveit_msgs::WorkspaceParameters& wspace) const;
00188
00189
00190
00191 bool isValidState(const moveit_msgs::RobotState& robot_state, const std::string& group);
00192
00193 std::string moveit_motion_plan_service;
00194 std::string moveit_check_state_validity_service;
00195
00196 ros::ServiceClient motion_plan_client;
00197 ros::ServiceClient state_validity_client;
00198
00199 ros::NodeHandle node;
00200
00201
00202 };
00203 }
00204
00205 #endif // GRASP_EXECUTION_REACH_TEST_MOVEITPLANNER_H