lines.cpp

00001 /*
00002   連続直線への追従
00003   Satofumi KAMIMURA
00004   $Id$
00005 */
00006 
00007 #include "vutils.h"
00008 #include "mRunCtrl.h"
00009 #include <stdio.h>
00010 #include <stdlib.h>
00011 
00012 
00013 int main(int argc, char *argv[]) {
00014   try {
00015     mRunCtrl run;
00016     if (initConnection(&run, argc, argv) < 0) {
00017       exit(1);
00018     }
00019     vmonitor::show();
00020     vmonitor::setTimeMagnify(1.0);
00021 
00022     // 走行経路
00023     std::deque<VXV::Position> lines;
00024     lines.push_back(VXV::Position(0, 0, deg(-45)));
00025     lines.push_back(VXV::Position(1000, -1000, deg(90)));
00026     lines.push_back(VXV::Position(1000, 1000, deg(45)));
00027     lines.push_back(VXV::Position(2000, 2000, deg(-90)));
00028     lines.push_back(VXV::Position(2000, 0, deg(180)));
00029     lines.push_back(VXV::Position(0, 0, deg(180)));
00030 
00031     // 走行経路の表示
00032     std::deque<VXV::Grid3D> draw_lines;
00033     draw_lines.assign(lines.begin(), lines.end());
00034     vmonitor::drawContLine(draw_lines, White);
00035 
00036     // 実際の走行処理
00037     int follow_r = run.getCurveRadius();
00038     run.followLine(lines.front());
00039     while (lines.size() > 0) {
00040       VXV::followLinesUpdate(run, lines, follow_r);
00041       VXV::Delay(100);          // Do something
00042     }
00043     run.stop();
00044     VXV::Delay(1000);
00045 
00046   } catch (std::exception& e) {
00047     printf("exception: %s\n", e.what());
00048   }
00049   return 0;
00050 }
00051 

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