Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef MOVEIT_PR2_ARM_IK_SOLVER_
00038 #define MOVEIT_PR2_ARM_IK_SOLVER_
00039
00040 #include <urdf/model.h>
00041 #include <Eigen/Core>
00042 #include <kdl/chainiksolver.hpp>
00043 #include <pr2_arm_kinematics/pr2_arm_ik.h>
00044 #include <moveit/kinematics_base/kinematics_base.h>
00045 #include <pr2_arm_kinematics/pr2_arm_kinematics_utils.h>
00046 #include <moveit_msgs/GetKinematicSolverInfo.h>
00047 #include <moveit_msgs/PositionIKRequest.h>
00048 #include <geometry_msgs/PoseStamped.h>
00049 #include <tf_conversions/tf_kdl.h>
00050
00051 namespace pr2_arm_kinematics
00052 {
00053
00054 static const int NO_IK_SOLUTION = -1;
00055 static const int TIMED_OUT = -2;
00056
00057 class PR2ArmIKSolver : public KDL::ChainIkSolverPos
00058 {
00059 public:
00060
00066 PR2ArmIKSolver(const urdf::Model &robot_model,
00067 const std::string &root_frame_name,
00068 const std::string &tip_frame_name,
00069 const double &search_discretization_angle,
00070 const int &free_angle);
00071
00072 ~PR2ArmIKSolver(){ delete pr2_arm_ik_; };
00073
00077 PR2ArmIK *pr2_arm_ik_;
00078
00082 bool active_;
00083
00096 int CartToJnt(const KDL::JntArray& q_init,
00097 const KDL::Frame& p_in,
00098 KDL::JntArray& q_out);
00099
00112 int CartToJnt(const KDL::JntArray& q_init,
00113 const KDL::Frame& p_in,
00114 std::vector<KDL::JntArray> &q_out);
00115
00127 int CartToJntSearch(const KDL::JntArray& q_in,
00128 const KDL::Frame& p_in,
00129 std::vector<KDL::JntArray> &q_out,
00130 const double &timeout);
00131
00144
00145
00146
00147
00148
00149
00150
00165 int CartToJntSearch(const KDL::JntArray& q_in,
00166 const KDL::Frame& p_in,
00167 KDL::JntArray &q_out,
00168 const double &timeout,
00169 const double& consistency_limit);
00170
00184 int CartToJntSearch(const KDL::JntArray& q_in,
00185 const KDL::Frame& p_in,
00186 KDL::JntArray &q_out,
00187 const double &timeout,
00188 moveit_msgs::MoveItErrorCodes &error_code,
00189 const kinematics::KinematicsBase::IKCallbackFn &solution_callback);
00190
00205 int CartToJntSearch(const KDL::JntArray& q_in,
00206 const KDL::Frame& p_in,
00207 KDL::JntArray &q_out,
00208 const double &timeout,
00209 const double& consistency_limit,
00210 moveit_msgs::MoveItErrorCodes &error_code,
00211 const kinematics::KinematicsBase::IKCallbackFn &solution_callback);
00212
00218 void getSolverInfo(moveit_msgs::KinematicSolverInfo &response);
00219
00220 std::string getFrameId();
00221
00222 unsigned int getFreeAngle() const {
00223 return free_angle_;
00224 }
00225
00226 void setFreeAngle(const unsigned int& free_angle) {
00227 free_angle_ = free_angle;
00228 }
00229
00230 private:
00231
00247 int CartToJntSearch(const KDL::JntArray& q_in,
00248 const KDL::Frame& p_in,
00249 KDL::JntArray &q_out,
00250 const double &timeout,
00251 bool use_consistency_limit,
00252 const double& consistency_limit,
00253 moveit_msgs::MoveItErrorCodes &error_code,
00254 const kinematics::KinematicsBase::IKCallbackFn &solution_callback);
00255
00256 bool getCount(int &count, const int &max_count, const int &min_count);
00257
00258 double search_discretization_angle_;
00259
00260 int free_angle_;
00261
00262 std::string root_frame_name_;
00263 };
00264 }
00265 #endif// PR2_ARM_IK_SOLVER_H