load_image_bundle.cpp
Go to the documentation of this file.
00001 
00006 /*****************************************************************************
00007 ** Includes
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 ** Main
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()]; //array to emulate argv.
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 //    if ( broken_layer_probably_isnt_obstacle_costs ) {
00056 //      cost_map::Matrix data = loader.cost_map->get("obstacle_costs");
00057 //      for (int i = 0, number_of_rows = data.rows(), number_of_columns = data.cols(); i < number_of_rows; ++i) {
00058 //        for (int j = 0; j < number_of_columns; ++j) {
00059 //          std::cout << static_cast<int>(data(i,j)) << " ";
00060 //        }
00061 //        std::cout << std::endl;
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 }


cost_map_ros
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 20:27:54