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 static const int NO_IK_SOLUTION = -1;
54 static const int TIMED_OUT = -2;
55 
57 {
58 public:
65  PR2ArmIKSolver(const urdf::Model& robot_model, const std::string& root_frame_name, const std::string& tip_frame_name,
66  const double& search_discretization_angle, const int& free_angle);
67 
69  {
70  delete pr2_arm_ik_;
71  };
72 
73  virtual void updateInternalDataStructures();
74 
79 
83  bool active_;
84 
97  int CartToJnt(const KDL::JntArray& q_init, const KDL::Frame& p_in, KDL::JntArray& q_out);
98 
113  int CartToJnt(const KDL::JntArray& q_init, const KDL::Frame& p_in, std::vector<KDL::JntArray>& q_out);
114 
126  int CartToJntSearch(const KDL::JntArray& q_in, const KDL::Frame& p_in, std::vector<KDL::JntArray>& q_out,
127  const double& timeout);
128 
141  int CartToJntSearch(const KDL::JntArray& q_in, const KDL::Frame& p_in, KDL::JntArray& q_out, const double& timeout);
142 
157  int CartToJntSearch(const KDL::JntArray& q_in, const KDL::Frame& p_in, KDL::JntArray& q_out, const double& timeout,
158  const double& consistency_limit);
159 
173  int CartToJntSearch(const KDL::JntArray& q_in, const KDL::Frame& p_in, KDL::JntArray& q_out, const double& timeout,
174  moveit_msgs::MoveItErrorCodes& error_code,
175  const kinematics::KinematicsBase::IKCallbackFn& solution_callback);
176 
191  int CartToJntSearch(const KDL::JntArray& q_in, const KDL::Frame& p_in, KDL::JntArray& q_out, const double& timeout,
192  const double& consistency_limit, moveit_msgs::MoveItErrorCodes& error_code,
193  const kinematics::KinematicsBase::IKCallbackFn& solution_callback);
194 
200  void getSolverInfo(moveit_msgs::KinematicSolverInfo& response);
201 
202  std::string getFrameId();
203 
204  unsigned int getFreeAngle() const
205  {
206  return free_angle_;
207  }
208 
209  void setFreeAngle(const unsigned int& free_angle)
210  {
211  free_angle_ = free_angle;
212  }
213 
214 private:
230  int CartToJntSearch(const KDL::JntArray& q_in, const KDL::Frame& p_in, KDL::JntArray& q_out, const double& timeout,
231  bool use_consistency_limit, const double& consistency_limit,
232  moveit_msgs::MoveItErrorCodes& error_code,
233  const kinematics::KinematicsBase::IKCallbackFn& solution_callback);
234 
235  bool getCount(int& count, const int& max_count, const int& min_count);
236 
238 
239  int free_angle_;
240 
241  std::string root_frame_name_;
242 };
243 }
244 #endif // PR2_ARM_IK_SOLVER_H
Namespace for the PR2ArmKinematics.
bool getCount(int &count, const int &max_count, const int &min_count)
static const int NO_IK_SOLUTION
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
int CartToJnt(const KDL::JntArray &q_init, const KDL::Frame &p_in, KDL::JntArray &q_out) override
const std::string response


pr2_moveit_plugins
Author(s): Ioan Sucan , Sachin Chitta
autogenerated on Mon Feb 28 2022 22:51:25