followCircle.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 <pathUtils.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     run.followCircleOnTangent(Position(500, 0, deg(0)), -250);
00033     Position pos;
00034     do {
00035       VXV::Delay(100);
00036     } while (abs(run.getAngleToDirection(deg(-90)).to_deg()) > 10);
00037 
00038     run.followLine(Position(800, 0, deg(0)));
00039     while (run.getLengthToLine(Position(800, 0, deg(0))) < 0) {
00040       VXV::Delay(100);
00041     }
00042     run.followCircle(Grid(1000, 0), +250);
00043     VXV::Delay(10000);
00044 
00045     run.stop();
00046     VXV::Delay(1000);
00047 
00048   } catch (std::exception& e) {
00049     printf("exception: %s\n", e.what());
00050   }
00051   return 0;
00052 }
00053 

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