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 #ifndef COB_PICK_ACTION_H
00019 #define COB_PICK_ACTION_H
00020
00021 #include <iostream>
00022 #include <fstream>
00023 #include <ros/ros.h>
00024 #include <ros/package.h>
00025 #include <actionlib/server/simple_action_server.h>
00026 #include <actionlib/client/simple_action_client.h>
00027 #include <actionlib/client/terminal_state.h>
00028
00029 #include <tf/tf.h>
00030 #include <tf/transform_broadcaster.h>
00031 #include <tf/transform_datatypes.h>
00032
00033
00034 #include <moveit/planning_scene_monitor/planning_scene_monitor.h>
00035 #include <moveit/move_group_interface/move_group.h>
00036 #include <shape_tools/solid_primitive_dims.h>
00037 #include <moveit_msgs/Grasp.h>
00038
00039 #include <cob_pick_place_action/CobPickAction.h>
00040 #include <cob_pick_place_action/CobPlaceAction.h>
00041 #include <cob_grasp_generation/QueryGraspsAction.h>
00042 #include <GraspTable.h>
00043
00044
00045
00046 class CobPickPlaceActionServer
00047 {
00048 private:
00049 ros::NodeHandle nh_;
00050
00051 ros::Publisher pub_co;
00052 ros::Publisher pub_ao;
00053
00054 boost::scoped_ptr<actionlib::SimpleActionServer<cob_pick_place_action::CobPickAction> > as_pick;
00055 boost::scoped_ptr<actionlib::SimpleActionServer<cob_pick_place_action::CobPlaceAction> > as_place;
00056
00057 boost::scoped_ptr<actionlib::SimpleActionClient<cob_grasp_generation::QueryGraspsAction> > ac_grasps_or;
00058
00059 moveit::planning_interface::MoveGroup group;
00060
00061 char* GraspTableIniFile;
00062 GraspTable* m_GraspTable;
00063
00064 bool last_grasp_valid;
00065 std::string last_object_name;
00066 tf::TransformListener tf_listener_;
00067 tf::TransformBroadcaster tf_broadcaster_;
00068
00069 std::map<unsigned int,std::string> map_classid_to_classname;
00070
00071 public:
00072 CobPickPlaceActionServer(std::string group_name) : group(group_name) {}
00073 ~CobPickPlaceActionServer();
00074
00075 void initialize();
00076 void run();
00077
00078 void pick_goal_cb(const cob_pick_place_action::CobPickGoalConstPtr &goal);
00079 void place_goal_cb(const cob_pick_place_action::CobPlaceGoalConstPtr &goal);
00080
00081 void insertObject(std::string object_name, unsigned int object_class, geometry_msgs::PoseStamped object_pose);
00082
00083 void fillAllGraspsKIT(unsigned int objectClassId, std::string gripper_type, geometry_msgs::PoseStamped object_pose, std::vector<moveit_msgs::Grasp> &grasps);
00084 void fillSingleGraspKIT(unsigned int objectClassId, std::string gripper_type, unsigned int grasp_id, geometry_msgs::PoseStamped object_pose, std::vector<moveit_msgs::Grasp> &grasps);
00085 void convertGraspKIT(Grasp* current_grasp, geometry_msgs::PoseStamped object_pose, std::vector<moveit_msgs::Grasp> &grasps);
00086
00087 void fillGraspsOR(unsigned int objectClassId, std::string gripper_type, std::string gripper_side, unsigned int grasp_id, geometry_msgs::PoseStamped object_pose, std::vector<moveit_msgs::Grasp> &grasps);
00088
00089 trajectory_msgs::JointTrajectory MapHandConfiguration(sensor_msgs::JointState table_config);
00090 tf::Transform transformPose(tf::Transform transform_O_from_SDH, tf::Transform transform_HEADER_from_OBJECT, std::string object_frame_id);
00091 moveit_msgs::GripperTranslation calculateApproachDirection(geometry_msgs::Pose msg_pose_grasp_FOOTPRINT_from_ARM7, geometry_msgs::Pose msg_pose_pre_FOOTPRINT_from_ARM7);
00092
00093 };
00094 #endif
00095
00096