Go to the documentation of this file.00001 #ifndef _wam_actions_h_
00002 #define _wam_actions_h_
00003
00004 #include "ros/this_node.h"
00005 #include "ros/names.h"
00006 #include "ros/node_handle.h"
00007 #include "ros/rate.h"
00008
00009
00010
00011
00012 #include "iri_wam_common_msgs/bhand_cmd.h"
00013 #include "iri_wam_common_msgs/pose_move.h"
00014 #include "iri_wam_common_msgs/wamaction.h"
00015 #include "iri_wam_common_msgs/compute_obj_grasp_pose.h"
00016
00017 #include <tf/transform_broadcaster.h>
00018 #include <tf/transform_listener.h>
00019 #include "tf/tfMessage.h"
00020
00021
00022 #include "mutex.h"
00023
00024 #define NUMPOSES 3
00025 #define AZONEMSG 1
00026 #define BZONEMSG 2
00027 #define ANYZONEMSG 0
00028 #define AZONE 1000
00029 #define BZONE 2000
00030 #define ANYZONE 0
00031
00032 #define ALLFILTERS 0
00033
00034 #define NOX 0.5
00035 #define NOY 0
00036 #define NOZ 0
00037
00038 enum {
00039
00040 TAKEHIGH,
00041 TAKELOW,
00042 CHANGEPILE,
00043 FOLDLOW,
00044 SPREAD,
00045 FLIP,
00046 SHAKE,
00047 FOLDHIGH,
00048 MOVEAWAY,
00049 SIDEGRASP,
00050 DUMMY
00051 };
00052
00053 enum {
00054 MAXWRINKLE,
00055 MAXHEIGHT
00056 };
00057
00058 enum {
00059 STRAIGHT,
00060 ISOMETRIC,
00061 PEG
00062 };
00063
00087 class WamActions
00088 {
00089 private:
00090 CMutex tf_broadcaster_mutex;
00091 ros::NodeHandle node_handle_;
00092 geometry_msgs::Pose sampleposes[NUMPOSES];
00093 tf::TransformBroadcaster tf_br;
00094 tf::TransformListener tf_grasp;
00095
00096 std::string wam0_;
00097
00098
00099 tf::Transform transform_grasping_point;
00100
00101
00102
00103
00104 ros::ServiceServer wam_action_server;
00105 bool wam_actionCallback(iri_wam_common_msgs::wamaction::Request &req, iri_wam_common_msgs::wamaction::Response &res);
00106
00107
00108 ros::ServiceClient obj_filter_client;
00109 iri_wam_common_msgs::compute_obj_grasp_pose obj_filter_srv;
00110 ros::ServiceClient barrett_hand_cmd_client;
00111 iri_wam_common_msgs::bhand_cmd barrett_hand_cmd_srv;
00112 ros::ServiceClient pose_move_client;
00113 iri_wam_common_msgs::pose_move pose_move_srv;
00114
00115
00116
00117
00118 bool check_box(double x, double y, double z);
00119 bool fit_box(double& x, double& y, double& z);
00120 bool go_to(double x, double y, double z);
00121 bool go_to_kinect();
00122
00123 int destination_counter;
00124 void get_destination(int destination_zone, double& x, double& y, double& z);
00125
00126
00127 public:
00145 WamActions();
00146
00159 void mainLoop(void);
00160
00161
00162 bool requestGraspingPoint(double &x, double &y, double &z, int zone = ANYZONE, int filterID = ALLFILTERS);
00163 bool requestGraspingPointMaxHeight(double &x, double &y, double &z, int zone = ANYZONE, int filterID = ALLFILTERS);
00164 bool take3D(double x, double y, double z);
00165 bool take3Dside(double x, double y, double z);
00166 bool drop();
00167 bool drop(double x, double y, double z);
00168 bool isograsp();
00169 bool peggrasp();
00170
00171
00172 bool stretch();
00173 bool fold();
00174 bool fromAtoB();
00175 bool fromBtoA();
00176 bool flip();
00177 bool shake();
00178
00179
00180 };
00181 #endif