Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <ros/ros.h>
00020
00021 #include <place_matcher_msgs/GetCapability.h>
00022
00023 #include <place_matcher_mcc/dissimilarity_getter.h>
00024
00025 bool callback_getCapability(place_matcher_msgs::GetCapabilityRequest& req, place_matcher_msgs::GetCapabilityResponse& res)
00026 {
00027 res.scale_invariance = place_matcher_msgs::GetCapabilityResponse::TRUE;
00028 res.translation_invariance = place_matcher_msgs::GetCapabilityResponse::TRUE;
00029 res.rotation_invariance = place_matcher_msgs::GetCapabilityResponse::OPTIONAL;
00030 res.provides_dissimilarity = true;
00031 res.provides_pose = false;
00032 return true;
00033 }
00034
00035 int main(int argc, char **argv)
00036 {
00037 int max_thread;
00038 ros::init(argc, argv, "polygon_dissimilarity_server_mcc");
00039 ros::NodeHandle nh("~");
00040
00041 nh.param<int>("max_thread", max_thread, 1);
00042
00043 place_matcher_mcc::DissimilarityGetter dissimilarity_getter;
00044
00045
00046 if (nh.hasParam("sample_count"))
00047 {
00048 int sample_count;
00049 nh.getParam("sample_count", sample_count);
00050 if (sample_count > 0)
00051 {
00052 dissimilarity_getter.sample_count = sample_count;
00053 }
00054 else
00055 {
00056 ROS_WARN_STREAM(nh.getNamespace() <<
00057 "/sample_count must be positive, setting to default (" <<
00058 dissimilarity_getter.sample_count << ")");
00059 }
00060 }
00061
00062
00063 if (nh.hasParam("scale_count"))
00064 {
00065 int scale_count;
00066 nh.getParam("scale_count", scale_count);
00067 if (scale_count > 0)
00068 {
00069 dissimilarity_getter.scale_count = scale_count;
00070 }
00071 else
00072 {
00073 ROS_WARN_STREAM(nh.getNamespace() <<
00074 "/scale_count must be positive, setting to default (" <<
00075 dissimilarity_getter.scale_count << ")");
00076 }
00077 }
00078
00079
00080 nh.getParam("rotation_invariance", dissimilarity_getter.rotation_invariance);
00081
00082 ros::ServiceServer get_capability_server = nh.advertiseService("get_capability", callback_getCapability);
00083 ros::ServiceServer compute_dissimilarity_server = nh.advertiseService("compute_dissimilarity",
00084 &place_matcher_mcc::DissimilarityGetter::getDissimilarity, &dissimilarity_getter);
00085
00086 ROS_INFO("Ready to work (with %i threads)", max_thread);
00087
00088 ros::MultiThreadedSpinner spinner(max_thread);
00089 spinner.spin();
00090
00091 return 0;
00092 }