00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "Aria.h"
00027
00038 int main(int argc, char **argv)
00039 {
00040 Aria::init();
00041
00042 ArSimpleConnector connector(&argc, argv);
00043 ArRobot robot;
00044 ArSick sick;
00045
00046 if (!Aria::parseArgs() || argc > 1)
00047 {
00048 Aria::logOptions();
00049 Aria::shutdown();
00050 exit(1);
00051 }
00052
00053 ArKeyHandler keyHandler;
00054 Aria::setKeyHandler(&keyHandler);
00055 robot.attachKeyHandler(&keyHandler);
00056
00057
00058 robot.addRangeDevice(&sick);
00059
00060
00061
00062 ArLineFinder lineFinder(&sick);
00063 lineFinder.setVerbose(true);
00064
00065
00066
00067
00068 ArFunctorC<ArLineFinder> findLineCB(&lineFinder,
00069 &ArLineFinder::getLinesAndSaveThem);
00070 keyHandler.addKeyHandler('f', &findLineCB);
00071 keyHandler.addKeyHandler('F', &findLineCB);
00072
00073
00074 ArLog::log(ArLog::Normal, "lineFinderExample: connecting to robot...");
00075 if (!connector.connectRobot(&robot))
00076 {
00077 printf("Could not connect to robot... exiting\n");
00078 Aria::shutdown();
00079 return 1;
00080 }
00081 robot.runAsync(true);
00082
00083
00084 ArLog::log(ArLog::Normal, "lineFinderExample: connecting to SICK laser...");
00085 connector.setupLaser(&sick);
00086 sick.runAsync();
00087 if (!sick.blockingConnect())
00088 {
00089 printf("Could not connect to SICK laser... exiting\n");
00090 Aria::shutdown();
00091 return 1;
00092 }
00093
00094 printf("If you press the 'f' key the points and lines found will be saved\n");
00095 printf("Into the 'points' and 'lines' file in the current working directory\n");
00096
00097 robot.waitForRunExit();
00098 return 0;
00099 }
00100
00101
00102