Go to the documentation of this file.00001
00010 #ifndef phalange_h___
00011 #define phalange_h___
00012
00013 #include "ros/ros.h"
00014 #include "icr_msgs/SetPose.h"
00015 #include "icr_msgs/StampedContactPose.h"
00016 #include <icr_msgs/ContactState.h>
00017 #include <tf/transform_listener.h>
00018 #include <tf/message_filter.h>
00019 #include <geometry_msgs/PoseStamped.h>
00020 #include <tf/tf.h>
00021 #include <string>
00022 #include "model_server.h"
00023 #include <boost/thread/mutex.hpp>
00024 #include <boost/shared_ptr.hpp>
00025
00026
00027 namespace ICR
00028 {
00029
00043 class Phalange
00044 {
00045 public:
00046
00047
00048 Phalange(tf::Transform const & L_T_Cref,std::string const & phl_name,std::string const & phl_frame_id,std::string const & sensor_topic);
00049 ~Phalange();
00050
00051 icr_msgs::StampedContactPose::ConstPtr getStampedContactPose();
00052 void setTargetObjFrameId(std::string const & obj_frame_id);
00053 std::string getPhalangeName();
00054 std::string getPhalangeFrameId();
00055
00056 private:
00057
00062 Phalange();
00063
00064 ros::NodeHandle nh_, nh_private_;
00068 ros::Publisher ct_pose_pub_;
00072 ros::Subscriber contacts_subs_;
00076 ros::ServiceServer set_pose_srv_;
00080 tf::Transform L_T_Cref_;
00084 boost::shared_ptr<icr_msgs::StampedContactPose> C_T_O_;
00085
00086 std::string phl_name_;
00087 std::string phl_frame_id_;
00088
00092 std::string obj_frame_id_;
00093
00094 boost::mutex lock_;
00095 tf::TransformListener tf_list_;
00096
00100 tf::MessageFilter<icr_msgs::StampedContactPose>* tf_filter_;
00101
00102 std::string tf_prefix_;
00103
00112 tf::Quaternion projectPose(tf::Vector3 const & z);
00113
00115
00117
00122 void listenContacts(const icr_msgs::ContactState::ConstPtr& cts_st);
00126 bool setPose(icr_msgs::SetPose::Request &req, icr_msgs::SetPose::Response &res);
00131 void transformContactPose(const boost::shared_ptr<const icr_msgs::StampedContactPose>& C_T_L);
00132 };
00133 }
00134 #endif