19 #include <boost/program_options.hpp> 30 #include "tracker_impl.h" 40 namespace po = boost::program_options;
43 int main(
int argc,
char **argv)
45 std::string leftname, rightname, dbName,
filename, calibFile, device;
48 po::options_description desc(
"Usage : tracker [options]", 120);
50 (
"help,h",
"show help screen")
51 (
"dbname",po::value<std::string>(&dbName)->default_value(
""),
"database name (on localhost) NOT IMPLEMENTED YET")
52 (
"device",po::value<std::string>(&device)->default_value(
SERIAL_PORT),
"serial device, e.g. /dev/ttyS0")
53 (
"register-as-left",po::value<std::string>(&leftname)->default_value(
LEFT_DEFAULT_NAME),
"<left-tracker-name>" )
54 (
"register-as-right",po::value<std::string>(&rightname)->default_value(
RIGHT_DEFAULT_NAME),
"<right-tracker-name>" )
55 (
"no-left",
"Don't use left tracker" )
56 (
"no-right",
"Don't use right tracker " )
57 (
"calib-file",po::value<std::string>(&calibFile),
" <filename>")
58 (
"debug-level,d",po::value<unsigned int>(&
debugLevel)->default_value(0),
"the more, the higher ;)")
64 po::store(po::parse_command_line(argc, argv, desc), vm);
67 if (vm.count(
"help")) {
72 dbName = vm[
"dbname"].as<std::string>();
73 leftname = vm[
"register-as-left"].as<std::string>();
74 rightname = vm[
"register-as-right"].as<std::string>();
77 printf(
"creating ROS interface...\n");
78 ros::init(argc, argv,
"flock_of_birds_tracker_server");
90 if(!vm.count(
"no-left")){
92 if(vm.count(
"calib-file"))
96 if(!vm.count(
"no-right")){
98 if(vm.count(
"calib-file"))
100 righttracker->
start();
103 if(!vm.count(
"no-left")){
104 cout <<
"Published name for left tracker will be " << leftname.c_str() << endl;
106 if(!vm.count(
"no-right")){
107 cout <<
"Published name for right tracker will be " << rightname.c_str() << endl;
115 if (command.find(
"reload") != command.npos) {
116 cout <<
"reloading calibration from file "<< calibFile <<endl;
117 cout <<
"reloading calibration left:";
119 cout << (res?
"Success":
"Failure!") << endl;
120 cout <<
"reloading calibration right:";
122 cout << (res?
"Success":
"Failure!") << endl;
128 if(!vm.count(
"no-left")) {
132 if(!vm.count(
"no-right")) {
133 righttracker->
stop();
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool loadCalibFile(const char *srcFileName)
static const char * RIGHT_DEFAULT_NAME
ROSLIB_DECL std::string command(const std::string &cmd)
static const char * LEFT_DEFAULT_NAME
int main(int argc, char **argv)
static const char * SERIAL_PORT