kinematics_constraint_aware.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 *
00003 * Software License Agreement (BSD License)
00004 *
00005 *  Copyright (c) 2012, Willow Garage, Inc.
00006 *  All rights reserved.
00007 *
00008 *  Redistribution and use in source and binary forms, with or without
00009 *  modification, are permitted provided that the following conditions
00010 *  are met:
00011 *
00012 *   * Redistributions of source code must retain the above copyright
00013 *     notice, this list of conditions and the following disclaimer.
00014 *   * Redistributions in binary form must reproduce the above
00015 *     copyright notice, this list of conditions and the following
00016 *     disclaimer in the documentation and/or other materials provided
00017 *     with the distribution.
00018 *   * Neither the name of Willow Garage, Inc. nor the names of its
00019 *     contributors may be used to endorse or promote products derived
00020 *     from this software without specific prior written permission.
00021 *
00022 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033 *  POSSIBILITY OF SUCH DAMAGE.
00034 *
00035 * Author: Sachin Chitta
00036 *********************************************************************/
00037 
00038 #ifndef MOVEIT_KINEMATICS_CONSTRAINT_AWARE_
00039 #define MOVEIT_KINEMATICS_CONSTRAINT_AWARE_
00040 
00041 // System
00042 #include <boost/shared_ptr.hpp>
00043 #include <boost/function.hpp>
00044 
00045 // ROS msgs
00046 #include <moveit_msgs/GetConstraintAwarePositionIK.h>
00047 #include <geometry_msgs/PoseStamped.h>
00048 #include <moveit_msgs/MoveItErrorCodes.h>
00049 #include <moveit_msgs/Constraints.h>
00050 #include <moveit_msgs/RobotState.h>
00051 
00052 // Plugin
00053 #include <moveit/kinematics_base/kinematics_base.h>
00054 
00055 // MoveIt!
00056 #include <moveit/robot_model/robot_model.h>
00057 #include <moveit/robot_state/robot_state.h>
00058 #include <moveit/planning_scene/planning_scene.h>
00059 #include <moveit/kinematic_constraints/kinematic_constraint.h>
00060 #include <moveit/kinematics_constraint_aware/kinematics_request_response.h>
00061 
00062 namespace kinematics_constraint_aware
00063 {
00064 class KinematicsConstraintAware;
00065 typedef boost::shared_ptr<KinematicsConstraintAware> KinematicsConstraintAwarePtr;
00066 typedef boost::shared_ptr<const KinematicsConstraintAware> KinematicsConstraintAwareConstPtr;
00067 
00071 class KinematicsConstraintAware
00072 {
00073 public:
00079   KinematicsConstraintAware(const robot_model::RobotModelConstPtr& kinematic_model, const std::string& group_name);
00080 
00087   bool getIK(const planning_scene::PlanningSceneConstPtr& planning_scene,
00088              const kinematics_constraint_aware::KinematicsRequest& request,
00089              kinematics_constraint_aware::KinematicsResponse& response) const;
00090 
00097   bool getIK(const planning_scene::PlanningSceneConstPtr& planning_scene,
00098              const moveit_msgs::GetConstraintAwarePositionIK::Request& request,
00099              moveit_msgs::GetConstraintAwarePositionIK::Response& response) const;
00100 
00101   const std::string& getGroupName() const
00102   {
00103     return group_name_;
00104   }
00105 
00106   const robot_model::RobotModelConstPtr& getRobotModel() const
00107   {
00108     return kinematic_model_;
00109   }
00110 
00111 private:
00112   EigenSTL::vector_Affine3d transformPoses(const planning_scene::PlanningSceneConstPtr& planning_scene,
00113                                            const robot_state::RobotState& kinematic_state,
00114                                            const std::vector<geometry_msgs::PoseStamped>& poses,
00115                                            const std::string& target_frame) const;
00116 
00117   bool convertServiceRequest(const planning_scene::PlanningSceneConstPtr& planning_scene,
00118                              const moveit_msgs::GetConstraintAwarePositionIK::Request& request,
00119                              kinematics_constraint_aware::KinematicsRequest& kinematics_request,
00120                              kinematics_constraint_aware::KinematicsResponse& kinematics_response) const;
00121 
00122   geometry_msgs::Pose getTipFramePose(const planning_scene::PlanningSceneConstPtr& planning_scene,
00123                                       const robot_state::RobotState& kinematic_state, const geometry_msgs::Pose& pose,
00124                                       const std::string& link_name, unsigned int sub_group_index) const;
00125 
00126   bool validityCallbackFn(const planning_scene::PlanningSceneConstPtr& planning_scene,
00127                           const kinematics_constraint_aware::KinematicsRequest& request,
00128                           kinematics_constraint_aware::KinematicsResponse& response,
00129                           robot_state::JointStateGroup* joint_state_group,
00130                           const std::vector<double>& joint_group_variable_values) const;
00131 
00132   std::vector<std::string> sub_groups_names_;
00133 
00134   robot_model::RobotModelConstPtr kinematic_model_;
00135 
00136   const robot_model::JointModelGroup* joint_model_group_;
00137 
00138   std::string group_name_;
00139 
00140   bool has_sub_groups_;
00141 
00142   unsigned int ik_attempts_;
00143 };
00144 }
00145 
00146 #endif


moveit_experimental
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley , Jorge Nicho
autogenerated on Mon Jul 24 2017 02:21:02