19 #include <qi/applicationsession.hpp> 20 #include <qi/anymodule.hpp> 23 #include <boost/program_options.hpp> 28 int main(
int argc,
char** argv)
31 qi::ApplicationSession
app(argc, argv);
33 std::vector<std::string> args_out;
36 namespace po = boost::program_options;
37 po::options_description desc(
"Options");
39 (
"help,h",
"print help message")
40 (
"roscore_ip,r", po::value<std::string>(),
"set the ip of the roscore to use")
41 (
"network_interface,i", po::value<std::string>()->default_value(
"eth0"),
"set the network interface over which to connect")
42 (
"namespace,n", po::value<std::string>()->default_value(
"naoqi_driver_node"),
"set an explicit namespace in case ROS namespace variables cannot be used");
47 po::store( po::parse_command_line(argc, argv, desc), vm );
49 catch (boost::program_options::invalid_command_line_syntax& e)
51 std::cout <<
"error " << e.what() << std::endl;
54 catch (boost::program_options::unknown_option& e)
56 std::cout <<
"error 2 " << e.what() << std::endl;
60 if( vm.count(
"help") )
62 std::cout <<
"This is the help message for the ROS-Driver C++ bridge" << std::endl << desc << std::endl;
75 app.session()->registerService(
"ROS-Driver", bs);
78 if ( vm.count(
"roscore_ip") )
80 std::string roscore_ip = vm[
"roscore_ip"].as<std::string>();
81 std::string network_interface = vm[
"network_interface"].as<std::string>();
83 std::cout <<
BOLDYELLOW <<
"using ip address: " 86 bs->setMasterURINet(
"http://"+roscore_ip+
":11311", network_interface);
90 std::cout <<
BOLDRED <<
"No ip address given. Run qicli call to set the master uri" <<
RESETCOLOR << std::endl;
97 app.session()->close();
int main(int argc, char **argv)
ROSCPP_DECL void removeROSArgs(int argc, const char *const *argv, V_string &args_out)