00001 00044 #ifndef LJ_COSTMAP_JOCKEY_H 00045 #define LJ_COSTMAP_JOCKEY_H 00046 00047 #include <ros/ros.h> 00048 00049 #include <lama_common/place_profile_conversions.h> 00050 #include <lama_interfaces/ActOnMap.h> 00051 #include <lama_interfaces/AddInterface.h> 00052 #include <lama_msgs/DescriptorLink.h> 00053 #include <lama_jockeys/localizing_jockey.h> 00054 #include <lama_msgs/GetPlaceProfile.h> 00055 #include <lama_msgs/SetPlaceProfile.h> 00056 #include <lama_msgs/SetCrossing.h> 00057 #include <place_matcher_msgs/PolygonDissimilarity.h> 00058 00059 #include <crossing_detector/costmap_crossing_detector.h> 00060 00061 namespace lj_costmap 00062 { 00063 00064 class Jockey : public lama_jockeys::LocalizingJockey 00065 { 00066 public: 00067 00068 Jockey(std::string name, double frontier_width, double max_frontier_angle=0.785); 00069 00070 virtual void onGetVertexDescriptor(); 00071 virtual void onLocalizeInVertex(); 00072 virtual void onGetDissimilarity(); 00073 00074 void setDissimilarityServerName(std::string name) {dissimilarity_server_name_ = name;} 00075 00076 private: 00077 00078 void initMapPlaceProfileInterface(); 00079 void initMapCrossingInterface(); 00080 void getLiveData(); 00081 void handleMap(const nav_msgs::OccupancyGridConstPtr& msg); 00082 00083 lama_msgs::DescriptorLink placeProfileDescriptorLink(int32_t id); 00084 lama_msgs::DescriptorLink crossingDescriptorLink(int32_t id); 00085 00086 // ROS parameters. 00087 double range_cutoff_; 00088 00089 // Internals. 00090 bool data_received_; 00091 bool range_cutoff_set_; 00092 00093 // Reception and storage of OccupancyGrid and PlaceProfile. 00094 nav_msgs::OccupancyGrid map_; 00095 lama_msgs::PlaceProfile profile_; 00096 00097 // Map interface for PlaceProfile and Crossing descriptors. 00098 std::string place_profile_interface_name_; 00099 ros::ServiceClient place_profile_getter_; 00100 ros::ServiceClient place_profile_setter_; 00101 std::string crossing_interface_name_; 00102 ros::ServiceClient crossing_setter_; 00103 00104 // LocalizeInVertex server. 00105 std::string localize_service_; 00106 // Dissimilarity server. 00107 std::string dissimilarity_server_name_; 00108 00109 crossing_detector::CostmapCrossingDetector crossing_detector_; 00110 }; 00111 00112 00113 } // namespace lj_costmap 00114 00115 #endif // LJ_COSTMAP_JOCKEY_H