ObjectMessageGenerator.h
Go to the documentation of this file.
00001 #ifndef MOVEIT_OBJECTS_OBJECTMESSAGEGENERATOR_H
00002 #define MOVEIT_OBJECTS_OBJECTMESSAGEGENERATOR_H
00003 
00004 #include <ros/ros.h>
00005 
00006 #include <object_msgs/Object.h>
00007 #include <object_msgs/ObjectInfo.h>
00008 #include <object_msgs/ObjectInfoRequest.h>
00009 #include <object_msgs/ObjectInfoResponse.h>
00010 
00011 #include <geometry_msgs/Pose.h>
00012 #include <moveit_msgs/CollisionObject.h>
00013 #include <moveit_msgs/GetPlanningScene.h>
00014 #include <moveit_msgs/PlanningScene.h>
00015 #include <boost/thread/mutex.hpp>
00016 
00017 #include <moveit_object_handling/MoveItCollisionMatrixManipulator.h>
00018 
00019 namespace moveit_object_handling
00020 {
00021 
00045 class ObjectMessageGenerator
00046 {
00047 private:
00048 
00049     typedef object_msgs::Object ObjectMsg;
00050     typedef object_msgs::ObjectInfo ObjectInfoMsg;
00051     typedef std::map<std::string, moveit_msgs::CollisionObject> ObjToPublishMap;
00052 
00053 public:
00054 
00055     ObjectMessageGenerator(ros::NodeHandle& _node_priv, ros::NodeHandle& _node);
00056     virtual ~ObjectMessageGenerator();
00057 
00058     bool isConnected() const;
00059 
00060 private:
00061 
00062 
00063     void connectPub(const ros::SingleSubscriberPublisher& p);
00064 
00065     void disconnectPub(const ros::SingleSubscriberPublisher& p);
00066 
00067     void publishCollisionsEvent(const ros::TimerEvent& e);
00068 
00072     void receiveObject(const ObjectMsg& msg);
00073 
00074     moveit_msgs::CollisionObject getCollisionGeometry(const std::string& name);
00075 
00079     void updatePose(const ObjectMsg& newObj, moveit_msgs::CollisionObject& obj);
00080 
00084     moveit_msgs::CollisionObject transferContent(const ObjectMsg& msg, bool skipGeometry);
00085 
00086     std::vector<moveit_msgs::CollisionObject> getCurrentCollisionObjects(bool only_names = true);
00087     std::set<std::string> getCurrentCollisionObjectNames();
00088 
00089     std::vector<moveit_msgs::AttachedCollisionObject> getCurrentAttachedCollisionObjects();
00090     std::set<std::string> getCurrentAttachedCollisionObjectNames();
00091 
00092     ros::NodeHandle node_priv, node;
00093     std::string OBJECTS_TOPIC;
00094     std::string REQUEST_OBJECTS_TOPIC;
00095     std::string COLLISION_OBJECT_TOPIC;
00096     std::string GET_PLANNING_SCENE_SERVICE;
00097     std::string SET_PLANNING_SCENE_TOPIC;
00098     float PUBLISH_COLLISION_RATE;
00099     bool USE_PLANNING_SCENE_DIFF;
00100 
00101     ros::Publisher collision_pub;
00102     ros::Publisher planning_scene_pub;
00103 
00104     ros::Subscriber object_sub;
00105 
00106     ros::ServiceClient object_info_client;
00107 
00108     ros::ServiceClient planning_scene_client;
00109 
00110 
00111     // all objects which were already added
00112     std::set<std::string> addedObjects;
00113 
00114     // objects to skip as collision objects:
00115     // whenever an Object.msg message arrives to
00116     // add this object name, skip it.
00117     std::set<std::string> skipObjects;
00118 
00119     // links of the robot to always be allowed to
00120     // collide with *any* new collision object arriving.
00121     // Technically can be used for any objects (not only
00122     // robot links), but it's intended to disable collisions
00123     // with parts of the robot only.
00124     std::vector<std::string> allowedCollisionLinks;
00125 
00126     MoveItCollisionMatrixManipulator acmManip;
00127 
00128     ObjToPublishMap objsToPublish;
00129 
00130     boost::mutex mutex; //mutex for addedObjects and objsToPublish
00131 
00132     ros::Timer publishCollisionsTimer;
00133 
00134     //is set to false until addedObjects is initialized
00135     bool initExistingObj;
00136 };
00137 
00138 }  // namespace moveit_object_handling
00139 
00140 #endif  // MOVEIT_OBJECTS_OBJECTMESSAGEGENERATOR_H


moveit_object_handling
Author(s): Jennifer Buehler
autogenerated on Sat Mar 2 2019 03:50:51