Go to the documentation of this file.00001 #ifndef GRIPPING_H
00002 #define GRIPPING_H
00003 #include "ros/ros.h"
00004 #include <geometry_msgs/PoseStamped.h>
00005 #include <actionlib/client/simple_action_client.h>
00006 #include <message_filters/synchronizer.h>
00007 #include <message_filters/sync_policies/approximate_time.h>
00008
00009 #include <message_filters/subscriber.h>
00010 #include <pr2_controllers_msgs/Pr2GripperCommandAction.h>
00011
00012 #include <ee_cart_imped_msgs/EECartImpedGoal.h>
00013 #include <geometry_msgs/Twist.h>
00014
00015 #include <tf/transform_listener.h>
00016 #include <std_srvs/Empty.h>
00017
00018 class EECartImpedArm;
00019 typedef actionlib::SimpleActionClient<pr2_controllers_msgs::Pr2GripperCommandAction> gripActClient;
00020
00021 typedef message_filters::sync_policies::ApproximateTime<geometry_msgs::PoseStamped,
00022 geometry_msgs::PoseStamped,
00023 geometry_msgs::PoseStamped> MySyncPolicy;
00024
00025 class DoorOpener{
00026 public:
00027 DoorOpener(unsigned char side = 'r');
00028 ~DoorOpener();
00029 void grasp_handle(const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > > a_pregrasp,
00030 const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > > a_grasp,
00031 const boost::shared_ptr<const geometry_msgs::PoseStamped_<std::allocator<void> > > a_postgrasp) ;
00032
00033 bool swing_door(geometry_msgs::PoseStamped);
00034 bool listen(std_srvs::Empty::Request&, std_srvs::Empty::Response&);
00035 void addTrajectoryPoint(ee_cart_imped_msgs::EECartImpedGoal& msg, tf::Transform pose, float fx, float fy, float fz, float tx, float ty, float tz, float time, std::string frame_id);
00036
00038 void drive_base(const ros::TimerEvent& event);
00040 void home_position();
00042 void use_gripper(float position, float effort);
00043 bool wait_for_gripper();
00044
00045 private:
00046 gripActClient* gripperClient;
00047 ros::NodeHandle n;
00048 ros::ServiceServer serviceServer;
00049 message_filters::Subscriber<geometry_msgs::PoseStamped> pregrasp_sub;
00050 message_filters::Subscriber<geometry_msgs::PoseStamped> grasp_sub;
00051 message_filters::Subscriber<geometry_msgs::PoseStamped> postgrasp_sub;
00052 message_filters::Synchronizer<MySyncPolicy> sync;
00053 ros::Publisher cmd_vel_pub_;
00054 geometry_msgs::Twist base_cmd;
00055 unsigned char side_;
00056 EECartImpedArm *arm_;
00057 tf::TransformListener* tflistener_;
00058 std::string tool_frame_name_;
00059 std::string fixed_frame_name_;
00060 void push_door();
00063 void withdraw(float meters);
00064 tf::StampedTransform getTransform(const std::string& from, const std::string& to);
00065 bool listening_;
00066 bool started_;
00067 bool success_;
00068
00069 };
00070 void printTransform(const tf::Transform& t, const std::string& name);
00071 #endif