WorldModelROS.h
Go to the documentation of this file.
1 #ifndef WORLDMODELROS_H_
2 #define WORLDMODELROS_H_
3 
4 #include "wire/core/datatypes.h"
5 
6 // ros
7 #include "ros/ros.h"
8 
9 #include "wire_msgs/WorldEvidence.h"
10 #include "wire_msgs/ObjectEvidence.h"
11 
12 #include "wire_msgs/WorldState.h"
13 #include "wire_msgs/ObjectState.h"
14 
15 // services
16 #include "std_srvs/Empty.h" // for reset 'button'
17 
18 #include "problib/conversions.h"
19 
20 // transform listener
21 #include "tf/transform_listener.h"
22 
24 
25 namespace mhf {
26 
27 class HypothesisTree;
28 class Hypothesis;
29 class KnowledgeProbModel;
30 class PropertySet;
31 class ClassModel;
32 class SemanticObject;
33 
35 
36 public:
37 
38  WorldModelROS(tf::TransformListener* tf_listener = 0);
39 
40  virtual ~WorldModelROS();
41 
42  void registerEvidenceTopic(const std::string& topic_name);
43 
44  void publish() const;
45 
46  void showStatistics() const;
47 
48  void processEvidence(const ros::Duration max_duration);
49 
50  void processEvidence(const wire_msgs::WorldEvidence& world_evidence_msg);
51 
52  void start();
53 
54  void startThreaded();
55 
56  const std::list<SemanticObject*>& getMAPObjects() const;
57 
58 protected:
59 
60  boost::thread processing_thread_;
61 
62  double loop_rate_;
63 
64  // evidence buffer
65  std::list<wire_msgs::WorldEvidence> evidence_buffer_;
66 
67  // multiple hypothesis filter_
69 
70  // transform listener
73 
74  // world model publishers
76 
77  // evidence subscriber
78  std::list<ros::Subscriber> subs_evidence_;
79 
81 
82  // computation time needed for last tree update
85 
86  // frame in which objects are tracked and stored in world model
87  std::string world_model_frame_id_;
88 
89  // frame in which objects are published
90  std::string output_frame_id_;
91 
92  std::stringstream warnings_;
93 
95 
97 
99 
100  bool initialize();
101 
102  void initializeMHF();
103 
104  bool objectToMsg(const SemanticObject& obj, wire_msgs::ObjectState& msg) const;
105 
106  bool hypothesisToMsg(const mhf::Hypothesis& hyp, wire_msgs::WorldState& msg) const;
107 
108  void printWorldObjects(const mhf::Hypothesis& hyp) const;
109 
110  bool transformPosition(const pbl::PDF& pdf_in, const std::string& frame_in, pbl::Gaussian& pdf_out) const;
111 
112  bool transformOrientation(const pbl::PDF& pdf_in, const std::string& frame_in, pbl::Gaussian& pdf_out) const;
113 
114  void evidenceCallback(const wire_msgs::WorldEvidence::ConstPtr& world_evidence_msg);
115 
116  bool resetWorldModel(std_srvs::Empty::Request& req, std_srvs::Empty::Response& res);
117 
118  void shutdown();
119 
120 };
121 
122 }
123 
124 #endif /* WORLDMODELROS_H_ */
ros::Time last_update_
Definition: WorldModelROS.h:98
void registerEvidenceTopic(const std::string &topic_name)
void publish() const
bool objectToMsg(const SemanticObject &obj, wire_msgs::ObjectState &msg) const
double max_update_duration
Definition: WorldModelROS.h:84
mhf::HypothesisTree * world_model_
Definition: WorldModelROS.h:68
void processEvidence(const ros::Duration max_duration)
std::list< ros::Subscriber > subs_evidence_
Definition: WorldModelROS.h:78
bool resetWorldModel(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
void showStatistics() const
std::string output_frame_id_
Definition: WorldModelROS.h:90
bool transformOrientation(const pbl::PDF &pdf_in, const std::string &frame_in, pbl::Gaussian &pdf_out) const
const std::list< SemanticObject * > & getMAPObjects() const
std::list< wire_msgs::WorldEvidence > evidence_buffer_
Definition: WorldModelROS.h:65
bool hypothesisToMsg(const mhf::Hypothesis &hyp, wire_msgs::WorldState &msg) const
WorldModelROS(tf::TransformListener *tf_listener=0)
ros::ServiceServer srv_reset_
Definition: WorldModelROS.h:80
boost::thread processing_thread_
Definition: WorldModelROS.h:60
ros::Publisher pub_wm_
Definition: WorldModelROS.h:75
void evidenceCallback(const wire_msgs::WorldEvidence::ConstPtr &world_evidence_msg)
void printWorldObjects(const mhf::Hypothesis &hyp) const
tf::TransformListener * tf_listener_
Definition: WorldModelROS.h:71
double last_update_duration
Definition: WorldModelROS.h:83
std::string world_model_frame_id_
Definition: WorldModelROS.h:87
virtual ~WorldModelROS()
Definition: ClassModel.h:44
std::stringstream warnings_
Definition: WorldModelROS.h:92
bool transformPosition(const pbl::PDF &pdf_in, const std::string &frame_in, pbl::Gaussian &pdf_out) const


wire_core
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Fri Apr 16 2021 02:32:27