sr_kinematics.h
Go to the documentation of this file.
00001 
00013 #ifndef _SR_KINEMATICS_H_
00014 #define _SR_KINEMATICS_H_
00015 
00016 #include <ros/ros.h>
00017 #include <kdl_parser/kdl_parser.hpp>
00018 
00019 #include <boost/smart_ptr.hpp>
00020 #include <boost/thread.hpp>
00021 
00022 #include <tf/transform_listener.h>
00023 #include <tf_conversions/tf_kdl.h>
00024 
00025 #include <sensor_msgs/JointState.h>
00026 #include <geometry_msgs/PoseStamped.h>
00027 
00028 #include "kinematics_msgs/GetPositionIK.h"
00029 #include "kinematics_msgs/PositionIKRequest.h"
00030 #include "motion_planning_msgs/RobotState.h"
00031 
00032 namespace shadowrobot
00033 {
00034 class SrKinematics
00035 {
00036 public:
00037     SrKinematics();
00038     ~SrKinematics();
00039 
00040 private:
00041     ros::NodeHandle node, n_tilde;
00042 
00043     //consts used for the topics on which to publish / subscribe
00044     static const std::string hand_joint_states_topic, arm_joint_states_topic, hand_sendupdate_topic, arm_sendupdate_topic;
00045 
00049     std::string arm_kinematics_service, root_name, tip_name, rk_target, fixed_frame;
00050 
00054     KDL::Chain chain;
00055 
00056     typedef std::map<std::string, double> JointsMap;
00060     JointsMap joints_map;
00061 
00068     bool loadModel( const std::string xml );
00069 
00070     boost::mutex mutex;
00071 
00072     //publishes all the targets to the hand and the arm (the target names are then checked internally in the hand/arm)
00073     //it's easier that way than checking if the target is for the hand or for the arm.
00074     ros::Publisher pub_hand, pub_arm;
00075     //we need two different subscribers to joint_states: one for the hand, one for the arm
00076     ros::Subscriber hand_subscriber, arm_subscriber;
00077 
00086     void jointstatesCallback( const sensor_msgs::JointStateConstPtr& msg );
00087 
00094     void reverseKinematicsCallback( const tf::tfMessageConstPtr& msg );
00096     ros::Subscriber tf_sub;
00098     tf::TransformListener tf_listener;
00099 
00101     ros::ServiceClient rk_client;
00102 
00111     geometry_msgs::PoseStamped getPoseFromTransform(tf::StampedTransform transform);
00112 
00118     inline double toDegrees( double rad )
00119     {
00120         return rad * 57.2957795;
00121     }
00122 }; // end class SrKinematics
00123 
00124 }
00125 ; //end namespace
00126 
00127 
00128 #endif
00129 


sr_hand
Author(s): Ugo Cupcic / ugo@shadowrobot.com, contact@shadowrobot.com
autogenerated on Mon Oct 6 2014 07:44:02