Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _ROS_GRASPIT_INTERFACE_H_
00036 #define _ROS_GRASPIT_INTERFACE_H_
00037
00038 #include <map>
00039
00040
00041 #include <include/plugin.h>
00042 namespace db_planner
00043 {
00044 class DatabaseManager;
00045 }
00046 class GraspitDBModel;
00047 class Pr2Gripper2010;
00048 class Body;
00049 class transf;
00050 class GraspableBody;
00051
00052 #include <ros/ros.h>
00053
00054 #include <manipulation_msgs/Grasp.h>
00055 #include <manipulation_msgs/GraspPlanning.h>
00056
00057 #include "graspit_ros_planning_msgs/LoadDatabaseModel.h"
00058 #include "graspit_ros_planning_msgs/LoadObstacle.h"
00059 #include "graspit_ros_planning_msgs/ClearBodies.h"
00060 #include "graspit_ros_planning_msgs/SimulateScan.h"
00061 #include "graspit_ros_planning_msgs/TestGrasp.h"
00062 #include "graspit_ros_planning_msgs/GenerateGrasp.h"
00063 #include "graspit_ros_planning_msgs/VerifyGrasp.h"
00064
00065 namespace graspit_ros_planning
00066 {
00067
00069
00077 class RosGraspitInterface : public Plugin
00078 {
00079 private:
00081 ros::NodeHandle *root_nh_;
00082
00084 ros::NodeHandle *priv_nh_;
00085
00087
00089 db_planner::DatabaseManager *db_mgr_;
00090
00092 ros::ServiceServer load_model_srv_;
00093
00095 ros::ServiceServer load_obstacle_srv_;
00096
00098 ros::ServiceServer clear_bodies_srv_;
00099
00101 ros::ServiceServer simulate_scan_srv_;
00102
00104 ros::ServiceServer test_grasp_srv_;
00105
00107 ros::ServiceServer grasp_planning_srv_;
00108
00110 ros::ServiceServer generate_grasp_srv_;
00111
00113 ros::ServiceServer verify_grasp_srv_;
00114
00116 ros::Publisher scan_publisher_;
00117
00119 std::map<int, GraspitDBModel*> models_;
00120
00122 Pr2Gripper2010 *gripper_;
00123
00125 int default_grasp_test_type_;
00126
00128 double default_energy_threshold_;
00129
00131
00133 GraspitDBModel* getModel(int model_id);
00134
00136 bool loadGripper();
00137
00138
00139
00141 void gripperCollisionCheck(const Body *object, graspit_ros_planning_msgs::TestGrasp::Response &response);
00142
00144 void computeEnergy(Body *object, graspit_ros_planning_msgs::TestGrasp::Response &response);
00145
00146
00147
00149 void testGraspDirect(const manipulation_msgs::Grasp &grasp, GraspableBody *object,
00150 graspit_ros_planning_msgs::TestGrasp::Response &response);
00151
00153 void testGraspCompliant(const manipulation_msgs::Grasp &grasp, GraspableBody *object,
00154 graspit_ros_planning_msgs::TestGrasp::Response &response);
00155
00157 void testGraspReactive(const manipulation_msgs::Grasp &grasp, GraspableBody *object,
00158 graspit_ros_planning_msgs::TestGrasp::Response &response);
00159
00161 void testGraspRobustReactive(const manipulation_msgs::Grasp &grasp, GraspableBody *object,
00162 graspit_ros_planning_msgs::TestGrasp::Response &response);
00163
00164
00165
00167 bool loadModelCB(graspit_ros_planning_msgs::LoadDatabaseModel::Request &request,
00168 graspit_ros_planning_msgs::LoadDatabaseModel::Response &response);
00169
00171 bool loadObstacleCB(graspit_ros_planning_msgs::LoadObstacle::Request &request,
00172 graspit_ros_planning_msgs::LoadObstacle::Response &response);
00173
00175 bool clearBodiesCB(graspit_ros_planning_msgs::ClearBodies::Request &request,
00176 graspit_ros_planning_msgs::ClearBodies::Response &response);
00177
00179 bool simulateScanCB(graspit_ros_planning_msgs::SimulateScan::Request &request,
00180 graspit_ros_planning_msgs::SimulateScan::Response &response);
00181
00183 bool testGraspCB(graspit_ros_planning_msgs::TestGrasp::Request &request,
00184 graspit_ros_planning_msgs::TestGrasp::Response &response);
00185
00187 bool graspPlanningCB(manipulation_msgs::GraspPlanning::Request &request,
00188 manipulation_msgs::GraspPlanning::Response &response);
00189
00191 bool generateGraspCB(graspit_ros_planning_msgs::GenerateGrasp::Request &request,
00192 graspit_ros_planning_msgs::GenerateGrasp::Response &response);
00193
00195 bool verifyGraspCB(graspit_ros_planning_msgs::VerifyGrasp::Request &request,
00196 graspit_ros_planning_msgs::VerifyGrasp::Response &response);
00197
00198
00199 public:
00201 RosGraspitInterface();
00203 ~RosGraspitInterface();
00205 virtual int init(int argc, char **argv);
00207 virtual int mainLoop();
00208 };
00209
00210 }
00211
00212 #endif