pr2_arm_kinematics.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 *
00003 * Software License Agreement (BSD License)
00004 *
00005 *  Copyright (c) 2008, Willow Garage, Inc.
00006 *  All rights reserved.
00007 *
00008 *  Redistribution and use in source and binary forms, with or without
00009 *  modification, are permitted provided that the following conditions
00010 *  are met:
00011 *
00012 *   * Redistributions of source code must retain the above copyright
00013 *     notice, this list of conditions and the following disclaimer.
00014 *   * Redistributions in binary form must reproduce the above
00015 *     copyright notice, this list of conditions and the following
00016 *     disclaimer in the documentation and/or other materials provided
00017 *     with the distribution.
00018 *   * Neither the name of the Willow Garage nor the names of its
00019 *     contributors may be used to endorse or promote products derived
00020 *     from this software without specific prior written permission.
00021 *
00022 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033 *  POSSIBILITY OF SUCH DAMAGE.
00034 *
00035 * Author: Sachin Chitta
00036 *********************************************************************/
00037 
00038 #ifndef PR2_ARM_IK_NODE_H
00039 #define PR2_ARM_IK_NODE_H
00040 
00041 #include <ros/ros.h>
00042 #include <tf/tf.h>
00043 #include <tf/transform_listener.h>
00044 
00045 #include <angles/angles.h>
00046 #include <pr2_arm_kinematics/pr2_arm_ik_solver.h>
00047 #include <tf_conversions/tf_kdl.h>
00048 
00049 #include <kinematics_msgs/GetPositionFK.h>
00050 #include <kinematics_msgs/GetPositionIK.h>
00051 #include <kinematics_msgs/GetKinematicSolverInfo.h>
00052 #include <arm_navigation_msgs/ArmNavigationErrorCodes.h>
00053 
00054 #include <kdl/chainfksolverpos_recursive.hpp>
00055 
00056 #include <boost/shared_ptr.hpp>
00057 
00058 namespace pr2_arm_kinematics
00059 {
00060   class PR2ArmKinematics
00061   {
00062     public:
00063 
00074     PR2ArmKinematics(bool create_transform_listener = true);
00075 
00076     virtual ~PR2ArmKinematics();
00077 
00082     bool isActive();
00083 
00089     virtual bool getPositionIK(kinematics_msgs::GetPositionIK::Request &request, 
00090                                kinematics_msgs::GetPositionIK::Response &response);
00091 
00097     bool getIKSolverInfo(kinematics_msgs::GetKinematicSolverInfo::Request &request, 
00098                          kinematics_msgs::GetKinematicSolverInfo::Response &response);
00099 
00105     bool getFKSolverInfo(kinematics_msgs::GetKinematicSolverInfo::Request &request, 
00106                          kinematics_msgs::GetKinematicSolverInfo::Response &response);
00107 
00113     bool getPositionFK(kinematics_msgs::GetPositionFK::Request &request, 
00114                        kinematics_msgs::GetPositionFK::Response &response);
00115 
00116     protected:
00117 
00118     // Helper function that assumes that everything is in the correct frame
00119     bool getPositionIKHelper(kinematics_msgs::GetPositionIK::Request &request, 
00120                              kinematics_msgs::GetPositionIK::Response &response);
00121     
00122     virtual bool transformPose(const std::string& des_frame,
00123                                const geometry_msgs::PoseStamped& pose_in,
00124                                geometry_msgs::PoseStamped& pose_out);
00125     
00126     bool active_;
00127     int free_angle_;
00128     urdf::Model robot_model_;
00129     double search_discretization_;
00130     ros::NodeHandle node_handle_, root_handle_;
00131     boost::shared_ptr<pr2_arm_kinematics::PR2ArmIKSolver> pr2_arm_ik_solver_;
00132     ros::ServiceServer ik_service_,fk_service_,ik_solver_info_service_,fk_solver_info_service_;
00133     tf::TransformListener* tf_;
00134     std::string root_name_;
00135     int dimension_;
00136     boost::shared_ptr<KDL::ChainFkSolverPos_recursive> jnt_to_pose_solver_;
00137     KDL::Chain kdl_chain_;
00138     kinematics_msgs::KinematicSolverInfo ik_solver_info_, fk_solver_info_;
00139   };
00140 }
00141 
00142 #endif


pr2_arm_kinematics
Author(s): Sachin Chitta
autogenerated on Thu Jan 2 2014 11:40:43