arm_kinematics_solver_constraint_aware.h
Go to the documentation of this file.
00001 //Software License Agreement (BSD License)
00002 
00003 //Copyright (c) 2011, Willow Garage, Inc.
00004 //All rights reserved.
00005 
00006 //Redistribution and use in source and binary forms, with or without
00007 //modification, are permitted provided that the following conditions
00008 //are met:
00009 
00010 // * Redistributions of source code must retain the above copyright
00011 //   notice, this list of conditions and the following disclaimer.
00012 // * Redistributions in binary form must reproduce the above
00013 //   copyright notice, this list of conditions and the following
00014 //   disclaimer in the documentation and/or other materials provided
00015 //   with the distribution.
00016 // * Neither the name of Willow Garage, Inc. nor the names of its
00017 //   contributors may be used to endorse or promote products derived
00018 //   from this software without specific prior written permission.
00019 
00020 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00021 //"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023 //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00024 //COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025 //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026 //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00027 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00028 //CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00029 //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00030 //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00031 //POSSIBILITY OF SUCH DAMAGE.
00032 
00033 #ifndef ARM_KINEMATICS_SOLVER_CONSTRAINT_AWARE_
00034 #define ARM_KINEMATICS_SOLVER_CONSTRAINT_AWARE_
00035 
00036 #include <kinematics_base/kinematics_base.h>
00037 #include <planning_environment/models/collision_models.h>
00038 
00039 namespace arm_kinematics_constraint_aware 
00040 {
00041 
00042 class ArmKinematicsSolverConstraintAware 
00043 {
00044 public:
00045   
00046   ArmKinematicsSolverConstraintAware(kinematics::KinematicsBase* solver,
00047                                      planning_environment::CollisionModels* cm,
00048                                      const std::string& group_name);
00049 
00050   ~ArmKinematicsSolverConstraintAware() {
00051     delete kinematics_solver_;
00052   }
00053   
00054   bool isActive() const {
00055     return active_;
00056   }
00057 
00058   bool getPositionFK(const planning_models::KinematicState* robot_state,
00059                      const std::vector<std::string>& link_names,
00060                      std::vector<geometry_msgs::Pose> &poses);
00061 
00062   bool getPositionIK(const geometry_msgs::Pose &ik_pose,
00063                      const planning_models::KinematicState* robot_state,
00064                      sensor_msgs::JointState& solution,
00065                      arm_navigation_msgs::ArmNavigationErrorCodes& error_code);
00066   
00067   bool findConstraintAwareSolution(const geometry_msgs::Pose& pose,
00068                                    const arm_navigation_msgs::Constraints& constraints,
00069                                    planning_models::KinematicState* robot_state,
00070                                    sensor_msgs::JointState& solution,
00071                                    arm_navigation_msgs::ArmNavigationErrorCodes& error_code,
00072                                    const bool& do_initial_pose_check = true);
00073   
00074   bool findConsistentConstraintAwareSolution(const geometry_msgs::Pose& pose,
00075                                              const arm_navigation_msgs::Constraints& constraints,
00076                                              planning_models::KinematicState* robot_state,
00077                                              sensor_msgs::JointState& solution,
00078                                              arm_navigation_msgs::ArmNavigationErrorCodes& error_code,
00079                                              const unsigned int& redundancy,
00080                                              const double& max_consistency,
00081                                              const bool& do_initial_pose_check = true);
00082 
00083   bool interpolateIKDirectional(const geometry_msgs::Pose& start_pose,
00084                                 const tf::Vector3& direction,
00085                                 const double& distance,
00086                                 const arm_navigation_msgs::Constraints& constraints,
00087                                 planning_models::KinematicState* robot_state,
00088                                 arm_navigation_msgs::ArmNavigationErrorCodes& error_code, 
00089                                 trajectory_msgs::JointTrajectory& traj,
00090                                 const unsigned int& redundancy,
00091                                 const double& max_consistency,
00092                                 const bool& reverse, 
00093                                 const bool& premultiply,
00094                                 const unsigned int& num_points,
00095                                 const ros::Duration& total_dur,
00096                                 const bool& do_initial_pose_check);
00097 
00098   void checkForWraparound(const trajectory_msgs::JointTrajectory& joint_trajectory);
00099 
00100   //pass-throughs to solver
00101 
00102   double getSearchDiscretization() const {
00103     return kinematics_solver_->getSearchDiscretization();
00104   }
00105 
00106   void setSearchDiscretization(const double& sd) {
00107     kinematics_solver_->setSearchDiscretization(sd);
00108   }
00109 
00110   const std::string& getGroupName() const {
00111     return kinematics_solver_->getGroupName();
00112   }
00113 
00114   virtual const std::string& getBaseName() const {
00115     return kinematics_solver_->getBaseName();
00116   }
00117 
00118   const std::string& getTipName() const {
00119     return kinematics_solver_->getTipName();
00120   }
00121 
00122   const std::vector<std::string>& getJointNames() const {
00123     return kinematics_solver_->getJointNames();
00124   }
00125 
00126   const std::vector<std::string>& getLinkNames() const {
00127     return kinematics_solver_->getLinkNames();
00128   }
00129 
00130   const std::vector<std::string>& getEndEffectorLinks() const {
00131     return end_effector_collision_links_;
00132   }
00133 
00134 protected:
00135 
00136   planning_environment::CollisionModels* cm_;
00137   bool active_;
00138 
00139   kinematics::KinematicsBase* kinematics_solver_;
00140 
00141   std::string group_name_;
00142   std::string base_name_;
00143   std::string tip_name_;
00144 
00145   std::vector<std::string> end_effector_collision_links_;
00146 
00147   //for caching in a particular check
00148   bool do_initial_pose_check_;
00149   planning_models::KinematicState* state_;
00150   arm_navigation_msgs::Constraints constraints_;
00151 
00152   void collisionCheck(const geometry_msgs::Pose &ik_pose,
00153                       const std::vector<double> &ik_solution,
00154                       int &error_code);
00155   void initialPoseCheck(const geometry_msgs::Pose &ik_pose,
00156                         const std::vector<double> &ik_solution,
00157                         int &error_code);
00158 };
00159 }
00160 #endif


arm_kinematics_constraint_aware
Author(s): Sachin Chitta
autogenerated on Mon Dec 2 2013 12:38:08