19 #include <boost/program_options.hpp> 34 namespace po = boost::program_options;
37 int main(
int argc,
char **argv)
39 std::string leftname, rightname, dbName,
filename, calibFile, device;
42 po::options_description desc(
"Usage : tracker [options]", 120);
44 (
"help,h",
"show help screen")
45 (
"dbname",po::value<std::string>(&dbName)->default_value(
""),
"database name (on localhost) NOT IMPLEMENTED YET")
46 (
"device",po::value<std::string>(&device)->default_value(
SERIAL_PORT),
"serial device, e.g. /dev/ttyS0")
47 (
"register-as-left",po::value<std::string>(&leftname)->default_value(
LEFT_DEFAULT_NAME),
"<left-tracker-name>" )
48 (
"register-as-right",po::value<std::string>(&rightname)->default_value(
RIGHT_DEFAULT_NAME),
"<right-tracker-name>" )
49 (
"no-left",
"Don't use left tracker" )
50 (
"no-right",
"Don't use right tracker " )
51 (
"calib-file",po::value<std::string>(&calibFile),
" <filename>")
52 (
"debug-level,d",po::value<unsigned int>(&
debugLevel)->default_value(0),
"the more, the higher ;)")
58 po::store(po::parse_command_line(argc, argv, desc), vm);
61 if (vm.count(
"help")) {
66 dbName = vm[
"dbname"].as<std::string>();
67 leftname = vm[
"register-as-left"].as<std::string>();
68 rightname = vm[
"register-as-right"].as<std::string>();
78 if(!vm.count(
"no-left")){
80 if(vm.count(
"calib-file"))
84 if(!vm.count(
"no-right")){
86 if(vm.count(
"calib-file"))
88 righttracker->
start();
91 if(!vm.count(
"no-left")){
92 cout <<
"Published name for left tracker will be " << leftname.c_str() << endl;
94 if(!vm.count(
"no-right")){
95 cout <<
"Published name for right tracker will be " << rightname.c_str() << endl;
102 if (command.find(
"reload") != command.npos) {
103 cout <<
"reloading calibration from file "<< calibFile <<endl;
104 cout <<
"reloading calibration left:";
106 cout << (res?
"Success":
"Failure!") << endl;
107 cout <<
"reloading calibration right:";
109 cout << (res?
"Success":
"Failure!") << endl;
115 if(!vm.count(
"no-left")) {
119 if(!vm.count(
"no-right")) {
120 righttracker->
stop();
static const char * SERIAL_PORT
int main(int argc, char **argv)
bool loadCalibFile(const char *srcFileName)
static const char * LEFT_DEFAULT_NAME
ROSLIB_DECL std::string command(const std::string &cmd)
static const char * RIGHT_DEFAULT_NAME