00001 00025 #ifndef _OBSERVATION_LAYER_H_ 00026 #define _OBSERVATION_LAYER_H_ 00027 00028 #include <string> 00029 00030 #include <ros/ros.h> 00031 00032 #include <predicate_manager/predicate_manager.h> 00033 #include <predicate_manager/EventInfoMap.h> 00034 #include <predicate_manager/EventUpdate.h> 00035 #include <mdm_library/FactoredSymbolMetadata.h> 00036 #include <mdm_library/observation_dep.h> 00037 00038 00039 00040 namespace mdm_library 00041 { 00042 class ObservationLayer 00043 { 00044 public: 00045 typedef std::pair< size_t, uint32_t > ObsValuePair; 00046 00047 ObservationLayer(); 00048 00049 void eventUpdatesCallback ( const predicate_manager::EventUpdateConstPtr& msg ); 00050 00051 void eventMapCallback ( const predicate_manager::EventInfoMapConstPtr& msg ); 00052 00053 void observationMetadataCallback ( const mdm_library::FactoredSymbolMetadataConstPtr& msg ); 00054 00055 void addObservationFactor ( ObservationDep deps ); 00056 00057 private: 00058 00059 void publishJointObservation(); 00060 00061 void updateWorldSymbol ( const uint32_t& factor ); 00062 00063 ros::NodeHandle nh_; 00064 00065 ros::Subscriber event_map_sub_; 00066 ros::Subscriber event_update_sub_; 00067 00068 ros::Subscriber observation_metadata_sub_; 00069 ros::Publisher observation_pub_; 00070 00072 boost::unordered_map< predicate_manager::NameID, ObsValuePair > event_named_local_observer_; 00074 std::map< std::string, ObsValuePair > event_named_global_observer_; 00075 00076 boost::unordered_map< predicate_manager::NrID, 00077 ObsValuePair, 00078 predicate_manager::cantor_pair_hash > event_nr_observer_; 00079 00080 std::vector< ObservationDep > factored_observations_deps_; 00081 std::vector< uint32_t > factored_observations_; 00082 }; 00083 } 00084 00085 #endif