Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <ros/ros.h>
00009
00010 #include <yocs_msgs/Wall.h>
00011 #include <yocs_msgs/Column.h>
00012 #include <nav_msgs/OccupancyGrid.h>
00013
00014 #include <world_canvas_client_cpp/annotation_collection.hpp>
00015
00016
00017 int main(int argc, char** argv)
00018 {
00019 ros::init(argc, argv, "test_annotation_collection");
00020
00021
00022 ros::NodeHandle nh("~");
00023
00024 std::string world_name;
00025 std::string topic_name;
00026 std::string topic_type;
00027 std::string default_tn("annotations");
00028 std::string default_tt;
00029 std::string default_wn("INVALID_WORLD");
00030 bool pub_as_list;
00031 std::vector<std::string> uuids;
00032 std::vector<std::string> names;
00033 std::vector<std::string> types;
00034 std::vector<std::string> keywords;
00035 std::vector<std::string> relationships;
00036
00037 nh.param("world", world_name, default_wn);
00038 nh.param("topic_name", topic_name, default_tn);
00039 nh.param("topic_type", topic_type, default_tt);
00040 nh.param("pub_as_list", pub_as_list, false);
00041 nh.param("uuids", uuids, uuids);
00042 nh.param("names", names, names);
00043 nh.param("types", types, types);
00044 nh.param("keywords", keywords, keywords);
00045 nh.param("relationships", relationships, relationships);
00046
00047
00048 wcf::FilterCriteria filter(world_name, uuids, names, types, keywords, relationships);
00049 wcf::AnnotationCollection ac(filter);
00050 ac.loadData();
00051 ROS_INFO("Annotation collection ready!");
00052
00053
00054 ac.publishMarkers("annotation_markers");
00055
00056
00057 ac.publish(topic_name, topic_type, true, pub_as_list);
00058
00059 std::vector<yocs_msgs::Wall> walls;
00060 std::vector<yocs_msgs::Column> columns;
00061 std::vector<nav_msgs::OccupancyGrid> maps;
00062
00063 ROS_INFO("Done! got %u walls, %u columns and %u maps",
00064 ac.getData(walls), ac.getData(columns), ac.getData(maps));
00065 ROS_INFO("(for confirmation %lu %lu %lu)", walls.size(), columns.size(), maps.size());
00066 ros::Publisher wp = nh.advertise<yocs_msgs::Wall> ("walls_on_client", 1, true);
00067 ros::Publisher cp = nh.advertise<yocs_msgs::Column> ("columns_on_client", 1, true);
00068 ros::Publisher mp = nh.advertise<nav_msgs::OccupancyGrid> ("maps_on_client", 1, true);
00069
00070 for (unsigned int i = 0; i < walls.size(); i++)
00071 wp.publish(walls[i]);
00072 for (unsigned int i = 0; i < columns.size(); i++)
00073 cp.publish(columns[i]);
00074 for (unsigned int i = 0; i < maps.size(); i++)
00075 mp.publish(maps[i]);
00076
00077 ros::spin();
00078
00079 return 0;
00080 }