source: flair-src/trunk/tools/VrpnLite/src/main.cpp@ 358

Last change on this file since 358 was 330, checked in by Sanahuja Guillaume, 5 years ago

use less bandwidth in vprnlite

File size: 2.0 KB
RevLine 
[308]1// created: 2019/03/12
2// filename: main.cpp
3//
4// author: Guillaume Sanahuja
5// Copyright Heudiasyc UMR UTC/CNRS 7253
6//
7// version: $Id: $
8//
9// purpose: vrpnlite, to forward it to bth for exemple
10// usefull to reduce vrpn frame size
11//
12/*********************************************************************/
13
14#include "FrameworkManager.h"
15#include "VrpnLite.h"
16#include <stdio.h>
17#include <tclap/CmdLine.h>
18
19using namespace TCLAP;
20using namespace std;
21using namespace flair::core;
22
23string xml_file;
[330]24string vrpnServerAddress;
25int gcsPort,vrpnLitePort;
[308]26
27void parseOptions(int argc, char **argv);
28
29int main (int argc, char ** argv) {
30 parseOptions(argc,argv);
31
32 FrameworkManager *manager;
33 manager = new FrameworkManager("vrpnforwarder");
[330]34 manager->SetupConnection("127.0.0.1", gcsPort);
[308]35 manager->SetupUserInterface(xml_file);
36
[330]37 VrpnLite* vrpnlite=new VrpnLite(vrpnLitePort,vrpnServerAddress);
[308]38
39 vrpnlite->Start();
40 vrpnlite->Join();
41
42 delete manager;
43}
44
45void parseOptions(int argc, char **argv) {
46 try {
47 CmdLine cmd("Command description message", ' ', "0.1");
48
[330]49 ValueArg<int> vrpnLitePortArg("v", "vport","vrpn lite port", true,
50 3884, "int");
51 cmd.add(vrpnLitePortArg);
[308]52
53 ValueArg<string> serveraddressArg("s", "saddress","server address", true,
54 "127.0.0.1:3883", "string");
55 cmd.add(serveraddressArg);
56
[330]57 ValueArg<int> gcsPortArg("p", "port","local port used to connect to the ground station",
[308]58 false, 9000, "int");
[330]59 cmd.add(gcsPortArg);
[308]60
61
62 ValueArg<string> xmlArg("x", "xml", "xml file", true, "./settings.xml",
63 "string");
64 cmd.add(xmlArg);
65
66 cmd.parse(argc, argv);
67
[330]68 vrpnLitePort = vrpnLitePortArg.getValue();
69 vrpnServerAddress = serveraddressArg.getValue();
70 gcsPort = gcsPortArg.getValue();
[308]71 xml_file = xmlArg.getValue();
72
73 } catch (ArgException &e) { // catch any exceptions
74 cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
75 }
76}
Note: See TracBrowser for help on using the repository browser.