pr2_arm_ik_solver.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2008, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Sachin Chitta */
36 
37 #ifndef MOVEIT_PR2_ARM_IK_SOLVER_
38 #define MOVEIT_PR2_ARM_IK_SOLVER_
39 
40 #include <urdf/model.h>
41 #include <Eigen/Core>
42 #include <kdl/chainiksolver.hpp>
46 #include <moveit_msgs/KinematicSolverInfo.h>
47 #include <moveit_msgs/PositionIKRequest.h>
48 #include <geometry_msgs/PoseStamped.h>
49 #include <tf_conversions/tf_kdl.h>
50 
51 namespace pr2_arm_kinematics
52 {
53 
54 static const int NO_IK_SOLUTION = -1;
55 static const int TIMED_OUT = -2;
56 
58  {
59  public:
60 
66  PR2ArmIKSolver(const urdf::Model &robot_model,
67  const std::string &root_frame_name,
68  const std::string &tip_frame_name,
69  const double &search_discretization_angle,
70  const int &free_angle);
71 
72  ~PR2ArmIKSolver(){ delete pr2_arm_ik_; };
73 
78 
82  bool active_;
83 
96  int CartToJnt(const KDL::JntArray& q_init,
97  const KDL::Frame& p_in,
98  KDL::JntArray& q_out);
99 
112  int CartToJnt(const KDL::JntArray& q_init,
113  const KDL::Frame& p_in,
114  std::vector<KDL::JntArray> &q_out);
115 
127  int CartToJntSearch(const KDL::JntArray& q_in,
128  const KDL::Frame& p_in,
129  std::vector<KDL::JntArray> &q_out,
130  const double &timeout);
131 
143  int CartToJntSearch(const KDL::JntArray& q_in,
144  const KDL::Frame& p_in,
145  KDL::JntArray &q_out,
146  const double &timeout);
147 
162  int CartToJntSearch(const KDL::JntArray& q_in,
163  const KDL::Frame& p_in,
164  KDL::JntArray &q_out,
165  const double &timeout,
166  const double& consistency_limit);
167 
181  int CartToJntSearch(const KDL::JntArray& q_in,
182  const KDL::Frame& p_in,
183  KDL::JntArray &q_out,
184  const double &timeout,
185  moveit_msgs::MoveItErrorCodes &error_code,
186  const kinematics::KinematicsBase::IKCallbackFn &solution_callback);
187 
202  int CartToJntSearch(const KDL::JntArray& q_in,
203  const KDL::Frame& p_in,
204  KDL::JntArray &q_out,
205  const double &timeout,
206  const double& consistency_limit,
207  moveit_msgs::MoveItErrorCodes &error_code,
208  const kinematics::KinematicsBase::IKCallbackFn &solution_callback);
209 
215  void getSolverInfo(moveit_msgs::KinematicSolverInfo &response);
216 
217  std::string getFrameId();
218 
219  unsigned int getFreeAngle() const {
220  return free_angle_;
221  }
222 
223  void setFreeAngle(const unsigned int& free_angle) {
224  free_angle_ = free_angle;
225  }
226 
227  private:
228 
244  int CartToJntSearch(const KDL::JntArray& q_in,
245  const KDL::Frame& p_in,
246  KDL::JntArray &q_out,
247  const double &timeout,
248  bool use_consistency_limit,
249  const double& consistency_limit,
250  moveit_msgs::MoveItErrorCodes &error_code,
251  const kinematics::KinematicsBase::IKCallbackFn &solution_callback);
252 
253  bool getCount(int &count, const int &max_count, const int &min_count);
254 
256 
257  int free_angle_;
258 
259  std::string root_frame_name_;
260  };
261 }
262 #endif// PR2_ARM_IK_SOLVER_H
Namespace for the PR2ArmKinematics.
bool getCount(int &count, const int &max_count, const int &min_count)
int CartToJntSearch(const KDL::JntArray &q_in, const KDL::Frame &p_in, KDL::JntArray &q_out, const double &timeout)
static const int NO_IK_SOLUTION
int CartToJnt(const KDL::JntArray &q_init, const KDL::Frame &p_in, KDL::JntArray &q_out)
bool active_
Indicates whether the solver has been successfully initialized.
boost::function< void(const geometry_msgs::Pose &ik_pose, const std::vector< double > &ik_solution, moveit_msgs::MoveItErrorCodes &error_code)> IKCallbackFn
PR2ArmIKSolver(const urdf::ModelInterface &robot_model, const std::string &root_frame_name, const std::string &tip_frame_name, const double &search_discretization_angle, const int &free_angle)
void getSolverInfo(moveit_msgs::KinematicSolverInfo &response)
static const int TIMED_OUT


pr2_moveit_plugins
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Sun Nov 17 2019 03:24:45