turnLeft.cpp
00001
00002
00003
00004
00005
00006
00007 #if !MONITOR
00008 #include <runCtrl.h>
00009 #else
00010 #include <mRunCtrl.h>
00011 #endif
00012 #include <vutils.h>
00013 #include <stdio.h>
00014 #include <stdlib.h>
00015
00016 using namespace VXV;
00017
00018
00019 int main(int argc, char *argv[]) {
00020 try {
00021 #if !MONITOR
00022 RunCtrl run;
00023 #else
00024 mRunCtrl run;
00025 vmonitor::show();
00026 #endif
00027 if (run.connect(argc, argv) < 0) {
00028 printf("RunCtrl::connect: %s\n", run.what());
00029 exit(1);
00030 }
00031
00032
00033 VXV::Position target(1000, 0, deg(0));
00034 run.followLine(target);
00035 while (run.getLengthToLine(target) < -300) {
00036 VXV::Delay(100);
00037 }
00038 run.stopToLine(target);
00039 waitStable(run, 100);
00040
00041
00042 run.rotateToDirection(deg(90));
00043 waitStable(run, 100);
00044
00045
00046 target = VXV::Position(1000, 1000, deg(90));
00047 run.followLine(target);
00048 while (run.getLengthToLine(target) < -300) {
00049 VXV::Delay(100);
00050 }
00051 run.stopToLine(target);
00052 waitStable(run, 100);
00053
00054 VXV::Delay(1000);
00055 } catch (std::exception& e) {
00056 printf("exception: %s\n", e.what());
00057 }
00058 return 0;
00059 }
00060