crdUpdate.cpp

00001 /*
00002   座標系の位置更新の影響について
00003   Satofumi KAMIMURA
00004   $Id$
00005 */
00006 
00007 #if !MONITOR
00008 #include <runCtrl.h>
00009 #else
00010 #include <mRunCtrl.h>
00011 #endif
00012 #include <typePrint.h>
00013 #include <stdio.h>
00014 #include <stdlib.h>
00015 
00016 using namespace VXV;
00017 
00018 
00019 static void waitStable(RunInterface& run, unsigned long poll_time) {
00020   while (!run.isStable()) {
00021     VXV::Delay(100);
00022   }
00023 }
00024 
00025 
00026 int main(int argc, char *argv[]) {
00027   try {
00028 #if !MONITOR
00029     RunCtrl run;
00030 #else
00031     mRunCtrl run;
00032     vmonitor::show();
00033 #endif
00034     if (run.connect(argc, argv) < 0) {
00035       printf("RunCtrl::connect: %s\n", run.what());
00036       exit(1);
00037     }
00038 
00039     for (int i = 0; i < 2; ++i) {
00040       run.coordinateUpdateDetect(i);
00041 
00042       run.followLine(Position(0, 0, deg(0)));
00043       VXV::Delay(2000);
00044 
00045       // 座標系の更新
00046       run.adjustCrdPosition(Position(0, 250, deg(0)));
00047       std::cout << "crd adjust: y = " << run.getRunPosition().y << std::endl;
00048       waitStable(run, 100);
00049       std::cout << "    stable: y = " << run.getRunPosition().y << std::endl;
00050 
00051       // 自己位置の更新
00052       run.adjustRunPosition(Position(0, 250, deg(0)));
00053       std::cout << "run adjust: y = " << run.getRunPosition().y << std::endl;
00054       waitStable(run, 100);
00055       std::cout << "    stable: y = " << run.getRunPosition().y << std::endl;
00056 
00057       putchar('\n');
00058     }
00059     VXV::Delay(3000);
00060 
00061     run.stop();
00062     VXV::Delay(1000);
00063 
00064   } catch (std::exception& e) {
00065     printf("exception: %s\n", e.what());
00066   }
00067   return 0;
00068 }
00069 
00070 

Generated on Mon Apr 13 22:52:04 2009 by  doxygen 1.5.7.1