Go to the documentation of this file.00001
00006
00007
00008
00009
00010 #include <cost_map_ros/image_bundles.hpp>
00011 #include <ecl/command_line.hpp>
00012 #include <ecl/console.hpp>
00013 #include <exception>
00014
00015 #include <ros/init.h>
00016 #include <ros/ros.h>
00017 #include <string>
00018
00019 #include "../../include/cost_map_ros/utilities.hpp"
00020
00021
00022
00023
00024
00025 int main(int argc, char **argv) {
00026 ecl::CmdLine cmd("Load an image bundle into a costmap and publish");
00027 ecl::ValueArg<std::string> topicNameArg(
00028 "t",
00029 "topic_name",
00030 "Where to publish [default: ~cost_map]",
00031 false,
00032 "cost_map",
00033 "string");
00034 ecl::UnlabeledValueArg<std::string> imageBundleArg(
00035 "image_bundle_location",
00036 "A yaml file with meta-data about the costmap to be built",
00037 true,
00038 "cost_map_ros/example",
00039 "string (package/name OR yaml filename)");
00040 cmd.add(topicNameArg);
00041 cmd.add(imageBundleArg);
00042 std::vector<std::string> myargs;
00043 ros::removeROSArgs(argc, argv, myargs);
00044 char** myargv = new char*[myargs.size()];
00045 for(int i = 0, ie = myargs.size(); i < ie; ++i)
00046 {
00047 myargv[i] = const_cast<char*>(myargs[i].data());
00048 }
00049 cmd.parse(myargs.size(), myargv);
00050
00051
00052 ros::init(argc, argv, "image_bundle");
00053 try {
00054 cost_map::LoadImageBundle loader(imageBundleArg.getValue(), topicNameArg.getValue());
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 ros::spin();
00065 } catch (const std::exception& e) {
00066 std::cout << ecl::red << "[ERROR] " << e.what() << ecl::reset << std::endl;
00067 return EXIT_FAILURE;
00068 }
00069 return EXIT_SUCCESS;
00070 }