-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.cpp
67 lines (63 loc) · 1.73 KB
/
client.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <tagloc/tagloc.h>
int main(int argc, char** argv){
printf("Tagloc Client...\n");
tagloc::parseArgs(argc,argv);
if (!ros::isInitialized()){
ros::init(argc,argv,"tagloc_client");
}
ros::NodeHandle nh("tagloc_client");
if (argc<2){
printf("enter command!\n get <f>\n set <f>\n start <f>\n stop\n test <f> <Z> <x,y>\n step <f>\n init<f>\n");
return -1;
}else if (strcmp(argv[1],"get")==0 && argc>2){
int f = atoi(argv[2]);
tagloc::printH(nh,f);
} else if (strcmp(argv[1],"set")==0 && argc>2){
int f = atoi(argv[2]);
printf("setting: %d---\n\n",f);
if (argc!=9){
printf("need: \"set <f> <x> <y> <cxx> <cxy> <cyx> <cyy>\"");
} else {
float p[2];
p[0] = atof(argv[3]);
p[1] = atof(argv[4]);
float c[4];
c[0] = atof(argv[5]);
c[1] = atof(argv[6]);
c[2] = atof(argv[7]);
c[3] = atof(argv[8]);
tagloc::addH(nh,f,p,c);
}
} else if (strcmp(argv[1],"start")==0 && argc>2){
std::vector<int> todo;
for (int i=2;i<argc;i++){
todo.push_back(atoi(argv[i]));
}
tagloc::start(nh,todo);
} else if (strcmp(argv[1],"stop")==0){
tagloc::stop(nh);
} else if (strcmp(argv[1],"test")==0 && argc>3){
int f = atoi(argv[2]);
double zz = atof(argv[3]);
double rth = 0;
if (argc>4){
rth = atof(argv[4]);
}
tagloc::testZ(nh,f,zz,rth);
} else if (strcmp(argv[1],"step")==0 && argc>2){
int f = atoi(argv[2]);
tagloc::step(nh,f);
} else if (strcmp(argv[1],"measure")==0 && argc>2){
int f = atoi(argv[2]);
tagloc::measure(nh,f);
} else if (strcmp(argv[1],"init")==0 && argc>2){
int f = atoi(argv[2]);
tagloc::init(nh,f);
} else if (strcmp(argv[1],"check")==0 && argc>2){
int f = atoi(argv[2]);
tagloc::check(nh,f);
} else if (strcmp(argv[1],"wait")==0){
tagloc::wait(nh);
}
return 0;
}