source: flair-src/trunk/demos/CircleFollower/uav/src/main.cpp@ 286

Last change on this file since 286 was 263, checked in by Sanahuja Guillaume, 6 years ago

CircleFollower: remove depdency to cameras

File size: 2.7 KB
RevLine 
[21]1// created: 2011/05/01
2// filename: main.cpp
3//
4// author: Guillaume Sanahuja
5// Copyright Heudiasyc UMR UTC/CNRS 7253
6//
7// version: $Id: $
8//
9// purpose: exemple de code uav
10//
11//
12/*********************************************************************/
13
14#include "CircleFollower.h"
15#include <UavFactory.h>
16#include <FrameworkManager.h>
17#include <stdio.h>
18#include <tclap/CmdLine.h>
[38]19#include <TargetEthController.h>
[263]20//#include <VisionFilter.h>
[21]21
22using namespace TCLAP;
23using namespace std;
[23]24using namespace flair::core;
25using namespace flair::meta;
[38]26using namespace flair::sensor;
[21]27
28string uav_type;
29string log_path;
30int port;
[38]31int ds3port;
[21]32string xml_file;
33string name;
34string address;
35
36void parseOptions(int argc, char** argv);
37
38
39int main(int argc, char* argv[]) {
40 parseOptions(argc,argv);
41
42 FrameworkManager *manager;
43 manager= new FrameworkManager(name);
44 manager->SetupConnection(address,port);
45 manager->SetupUserInterface(xml_file);
46 manager->SetupLogger(log_path);
47
[122]48 Uav* drone=CreateUav(name,uav_type);
[137]49 TargetEthController *controller=new TargetEthController("Dualshock3",ds3port);
[122]50 CircleFollower* demo=new CircleFollower(controller);
[21]51
52 demo->Start();
53 demo->Join();
54
55 delete manager;
56}
57
58void parseOptions(int argc, char** argv) {
59 try {
60
61 CmdLine cmd("Command description message", ' ', "0.1");
62
63 ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
64 cmd.add( nameArg );
65
66 ValueArg<string> typeArg("t","type","uav type: ardrone2, hds_x4, hds_x8, hds_xufo, x4_simu, x8_simu or x4_simux (with x the number of the simulated uav)",true,"hds_x4","string");
67 cmd.add( typeArg );
68
69 ValueArg<string> xmlArg("x","xml","fichier xml",true,"./reglages.xml","string");
70 cmd.add( xmlArg );
71
72 ValueArg<string> logsArg("l","logs","repertoire des logs",true,"/media/ram","string");
73 cmd.add( logsArg );
74
75 ValueArg<int> portArg("p","port","port pour station sol",true,9000,"int");
76 cmd.add( portArg );
77
[232]78 ValueArg<string> addressArg("a","address","adresse station sol",true,"127.0.0.1","string");
[21]79 cmd.add( addressArg );
80
[38]81 ValueArg<int> ds3portArg("d","ds3_port","port pour ds3",false,20000,"int");
82 cmd.add( ds3portArg );
83
[21]84 cmd.parse( argc, argv );
85
86 // Get the value parsed by each arg.
87 log_path = logsArg.getValue();
88 port=portArg.getValue();
[38]89 ds3port=ds3portArg.getValue();
[21]90 xml_file = xmlArg.getValue();
91 name=nameArg.getValue();
92 uav_type=typeArg.getValue();
93 address=addressArg.getValue();
94
95 } catch (ArgException &e) { // catch any exceptions
96 cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
97 }
98}
Note: See TracBrowser for help on using the repository browser.