Go to the documentation of this file.00001
00022 #include <ros/node_handle.h>
00023 #include <ros/time.h>
00024 #include <sstream>
00025
00026 #include <vision_msgs/partial_lo.h>
00027 #include <vision_srvs/srvjlo.h>
00028 #include <vision_srvs/register_jlo_callback.h>
00029 #include <lo/ServiceInterface.h>
00030
00031 #include "tf/tfMessage.h"
00032 #include "tf/tf.h"
00033
00034 #include <set>
00035 #include <queue>
00036 #include <string>
00037
00042 class RosLoService : public jlo::ServiceInterface
00043 {
00044 public:
00048 RosLoService (const char* nodename, ros::NodeHandle &n, std::string configFile);
00052 ~RosLoService ();
00053
00054
00055 class PubParentFilterStruct
00056 {
00057 public:
00058 PubParentFilterStruct()
00059 : parent_id(0), last_value_set(false) {}
00060 PubParentFilterStruct( std::vector<ros::Publisher*> pub, unsigned long parent, std::vector<double> filt)
00061 : publisher(pub), parent_id(parent), filter(filt), last_value_set(false) {}
00062 std::vector<ros::Publisher*> publisher;
00063 unsigned long parent_id;
00064 std::vector<double> filter;
00065 std::vector<double> last_val;
00066 bool last_value_set;
00067
00068 };
00069
00075 bool ServiceCallback(vision_srvs::srvjlo::Request& request, vision_srvs::srvjlo::Response& answer);
00076
00082 bool CallbackRegisterService(vision_srvs::register_jlo_callback::Request& request, vision_srvs::register_jlo_callback::Response& answer);
00087 void UpdateEventHandler();
00088
00096 bool PublishUpdate(unsigned long id, PubParentFilterStruct& obj_to_pub);
00101 static void UpdateEventNotifier(unsigned long object_id);
00102 private:
00106 ros::Subscriber tf_subscription;
00107 ros::ServiceServer located_object_service;
00108 std::set<std::string> tf_blacklist;
00109
00113
00114
00115 std::map<unsigned long, PubParentFilterStruct > m_jlotopicMap;
00116 std::map<unsigned long, unsigned long> m_parentToRegisteredJlo;
00117 std::map<std::string, ros::Publisher> m_topicPublisherMap;
00118 static std::queue<unsigned long> m_queueOfLosToPublish;
00119
00123 void tf_subscription_callback(const tf::tfMessage::ConstPtr &msg_in_);
00124 };