trac_ik_kinematics_plugin.hpp
Go to the documentation of this file.
00001 /********************************************************************************
00002 Copyright (c) 2015, TRACLabs, Inc.
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification,
00006  are permitted provided that the following conditions are met:
00007 
00008     1. Redistributions of source code must retain the above copyright notice,
00009        this list of conditions and the following disclaimer.
00010 
00011     2. Redistributions in binary form must reproduce the above copyright notice,
00012        this list of conditions and the following disclaimer in the documentation
00013        and/or other materials provided with the distribution.
00014 
00015     3. Neither the name of the copyright holder nor the names of its contributors
00016        may be used to endorse or promote products derived from this software
00017        without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00024 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00025 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00026 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00027 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00028 OF THE POSSIBILITY OF SUCH DAMAGE.
00029 ********************************************************************************/
00030 
00031 #ifndef TRAC_IK_KINEMATICS_PLUGIN_
00032 #define TRAC_IK_KINEMATICS_PLUGIN_
00033 
00034 #include <moveit/kinematics_base/kinematics_base.h>
00035 #include <kdl/chain.hpp>
00036 
00037 namespace trac_ik_kinematics_plugin
00038 {
00039 
00040 class TRAC_IKKinematicsPlugin : public kinematics::KinematicsBase
00041 {
00042   std::vector<std::string> joint_names_;
00043   std::vector<std::string> link_names_;
00044 
00045   uint num_joints_;
00046   bool active_; // Internal variable that indicates whether solvers are configured and ready
00047 
00048   KDL::Chain chain;
00049   bool position_ik_;
00050 
00051   KDL::JntArray joint_min, joint_max;
00052 
00053   std::string solve_type;
00054 
00055 public:
00056   const std::vector<std::string>& getJointNames() const
00057   {
00058     return joint_names_;
00059   }
00060   const std::vector<std::string>& getLinkNames() const
00061   {
00062     return link_names_;
00063   }
00064 
00065 
00069   TRAC_IKKinematicsPlugin(): active_(false), position_ik_(false) {}
00070 
00071   ~TRAC_IKKinematicsPlugin()
00072   {
00073   }
00074 
00084   // Returns the first IK solution that is within joint limits, this is called by get_ik() service
00085   bool getPositionIK(const geometry_msgs::Pose &ik_pose,
00086                      const std::vector<double> &ik_seed_state,
00087                      std::vector<double> &solution,
00088                      moveit_msgs::MoveItErrorCodes &error_code,
00089                      const kinematics::KinematicsQueryOptions &options = kinematics::KinematicsQueryOptions()) const;
00090 
00099   bool searchPositionIK(const geometry_msgs::Pose &ik_pose,
00100                         const std::vector<double> &ik_seed_state,
00101                         double timeout,
00102                         std::vector<double> &solution,
00103                         moveit_msgs::MoveItErrorCodes &error_code,
00104                         const kinematics::KinematicsQueryOptions &options = kinematics::KinematicsQueryOptions()) const;
00105 
00115   bool searchPositionIK(const geometry_msgs::Pose &ik_pose,
00116                         const std::vector<double> &ik_seed_state,
00117                         double timeout,
00118                         const std::vector<double> &consistency_limits,
00119                         std::vector<double> &solution,
00120                         moveit_msgs::MoveItErrorCodes &error_code,
00121                         const kinematics::KinematicsQueryOptions &options = kinematics::KinematicsQueryOptions()) const;
00122 
00131   bool searchPositionIK(const geometry_msgs::Pose &ik_pose,
00132                         const std::vector<double> &ik_seed_state,
00133                         double timeout,
00134                         std::vector<double> &solution,
00135                         const IKCallbackFn &solution_callback,
00136                         moveit_msgs::MoveItErrorCodes &error_code,
00137                         const kinematics::KinematicsQueryOptions &options = kinematics::KinematicsQueryOptions()) const;
00138 
00149   bool searchPositionIK(const geometry_msgs::Pose &ik_pose,
00150                         const std::vector<double> &ik_seed_state,
00151                         double timeout,
00152                         const std::vector<double> &consistency_limits,
00153                         std::vector<double> &solution,
00154                         const IKCallbackFn &solution_callback,
00155                         moveit_msgs::MoveItErrorCodes &error_code,
00156                         const kinematics::KinematicsQueryOptions &options = kinematics::KinematicsQueryOptions()) const;
00157 
00158   bool searchPositionIK(const geometry_msgs::Pose &ik_pose,
00159                         const std::vector<double> &ik_seed_state,
00160                         double timeout,
00161                         std::vector<double> &solution,
00162                         const IKCallbackFn &solution_callback,
00163                         moveit_msgs::MoveItErrorCodes &error_code,
00164                         const std::vector<double> &consistency_limits,
00165                         const kinematics::KinematicsQueryOptions &options) const;
00166 
00167 
00179   bool getPositionFK(const std::vector<std::string> &link_names,
00180                      const std::vector<double> &joint_angles,
00181                      std::vector<geometry_msgs::Pose> &poses) const;
00182 
00183 
00184   bool initialize(const std::string &robot_description,
00185                   const std::string& group_name,
00186                   const std::string& base_name,
00187                   const std::string& tip_name,
00188                   double search_discretization);
00189 
00190 private:
00191 
00192   int getKDLSegmentIndex(const std::string &name) const;
00193 
00194 }; // end class
00195 }
00196 
00197 #endif


trac_ik_kinematics_plugin
Author(s): Patrick Beeson
autogenerated on Thu Apr 25 2019 03:39:28