ticksPosUse.cpp
00001
00002
00003
00004
00005
00006
00007 #include "mRunCtrl.h"
00008 #include "mURGCtrl.h"
00009 #include "vutils.h"
00010 #include "drawCaptures.h"
00011 #include "dumpPlotData.h"
00012
00013 using namespace VXV;
00014
00015
00016 int main(int argc, char *argv[]) {
00017 try {
00018 mRunCtrl run;
00019 mURGCtrl urg;
00020 if ((initConnection(&run, argc, argv) < 0) ||
00021 (initConnection(&urg, argc, argv, true) < 0)) {
00022 exit(1);
00023 }
00024 urg.setOwnCrdToObject(&run);
00025 run.adjustSubTreeTicks(0);
00026
00027 vmonitor::show();
00028
00029
00030 TicksPosition ticksPos;
00031
00032 int capture_times = 0;
00033 int add_times = 0;
00034 int pre_times = urg.getCaptureTimes() - 1;
00035
00036 run.getRunPosition();
00037 ticksPos.add(run.crd_position, run.crd_ticks);
00038 ++add_times;
00039 run.rotateToDirection(deg(-90));
00040 while (!run.isStable()) {
00041
00042 run.getRunPosition();
00043 ticksPos.add(run.crd_position, run.crd_ticks);
00044 ++add_times;
00045
00046
00047 int n = urg.capture();
00048 int times = urg.getCaptureTimes();
00049 if ((n > 0) && (times != pre_times)) {
00050 pre_times = times;
00051 urg.convert(ticksPos);
00052 drawCaptures(urg);
00053 outputPlotData(urg, argv[0]);
00054
00055 ticksPos.add(run.crd_position, run.crd_ticks);
00056
00057 ++capture_times;
00058 }
00059 }
00060
00061
00062 printf("captures: %d\n", capture_times);
00063 printf("add_times: %d\n", add_times);
00064
00065
00066 run.rotateToDirection(deg(0));
00067 VXV::waitStable(run, 100);
00068 VXV::Delay(1000);
00069
00070 outputPlotFile(argv[0]);
00071
00072 } catch (std::exception& e) {
00073 printf("exception: %s\n", e.what());
00074 }
00075 return 0;
00076 }
00077