Changeset 158 in flair-src for trunk/demos
- Timestamp:
- Mar 5, 2017, 10:50:56 AM (8 years ago)
- Location:
- trunk/demos
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/CircleFollower/simulator/src/main.cpp
r123 r158 23 23 #endif 24 24 25 26 25 using namespace TCLAP; 27 26 using namespace std; … … 38 37 string address; 39 38 40 void parseOptions(int argc, char** argv) { 41 try { 42 CmdLine cmd("Command description message", ' ', "0.1"); 39 void parseOptions(int argc, char** argv) 40 { 41 try { 42 CmdLine cmd("Command description message", ' ', "0.1"); 43 43 44 ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");45 cmd.add( nameArg);44 ValueArg<string> nameArg("n", "name", "uav name, also used for vrpn", true, "x4", "string"); 45 cmd.add(nameArg); 46 46 47 ValueArg<string> xmlArg("x","xml","xml file",true,"./reglages.xml","string");48 cmd.add( xmlArg);47 ValueArg<string> xmlArg("x", "xml", "xml file", true, "./reglages.xml", "string"); 48 cmd.add(xmlArg); 49 49 50 ValueArg<int> portArg("p","port","ground station port",true,9002,"int");51 cmd.add( portArg);50 ValueArg<int> portArg("p", "port", "ground station port", true, 9002, "int"); 51 cmd.add(portArg); 52 52 53 ValueArg<string> addressArg("a","address","ground station address",true,"127.0.0.1","string");54 cmd.add( addressArg);53 ValueArg<string> addressArg("a", "address", "ground station address", true, "127.0.0.1", "string"); 54 cmd.add(addressArg); 55 55 56 ValueArg<string> typeArg("t","type","uav type, x4 or x8",true,"x4","string");57 cmd.add( typeArg);56 ValueArg<string> typeArg("t", "type", "uav type, x4 or x8", true, "x4", "string"); 57 cmd.add(typeArg); 58 58 59 ValueArg<int> optiArg("o","opti","optitrack time ms",false,0,"int");60 cmd.add( optiArg);59 ValueArg<int> optiArg("o", "opti", "optitrack time ms", false, 0, "int"); 60 cmd.add(optiArg); 61 61 62 62 #ifdef GL 63 ValueArg<string> mediaArg("m","media","path to media files",true,"./","string");64 cmd.add( mediaArg);63 ValueArg<string> mediaArg("m", "media", "path to media files", true, "./", "string"); 64 cmd.add(mediaArg); 65 65 66 ValueArg<string> sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");67 cmd.add( sceneArg);66 ValueArg<string> sceneArg("s", "scene", "path to scene file", true, "./voliere.xml", "string"); 67 cmd.add(sceneArg); 68 68 #endif 69 69 70 cmd.parse( argc, argv);70 cmd.parse(argc, argv); 71 71 72 73 port=portArg.getValue();74 75 76 77 name=nameArg.getValue();78 address=addressArg.getValue();72 // Get the value parsed by each arg. 73 port = portArg.getValue(); 74 xml_file = xmlArg.getValue(); 75 opti_time = optiArg.getValue(); 76 type = typeArg.getValue(); 77 name = nameArg.getValue(); 78 address = addressArg.getValue(); 79 79 #ifdef GL 80 media_path=mediaArg.getValue();81 scene_file=sceneArg.getValue();80 media_path = mediaArg.getValue(); 81 scene_file = sceneArg.getValue(); 82 82 #endif 83 83 84 } catch (ArgException &e){85 86 84 } catch(ArgException& e) { 85 cerr << "error: " << e.error() << " for arg " << e.argId() << endl; 86 } 87 87 } 88 88 89 int main(int argc, char* argv[]) { 90 Simulator *simu; 91 Model *drone; 92 SimuImu* imu; 89 int main(int argc, char* argv[]) 90 { 91 Simulator* simu; 92 Model* drone; 93 SimuImu* imu; 93 94 #ifdef GL 94 95 Parser *gui;96 Man *man;95 SimuUsGL* us_gl; 96 Parser* gui; 97 Man* man; 97 98 #endif 98 parseOptions(argc,argv);99 parseOptions(argc, argv); 99 100 100 simu= new Simulator("simulator",opti_time,90);101 simu->SetupConnection(address,port);102 101 simu = new Simulator("simulator", opti_time, 90); 102 simu->SetupConnection(address, port); 103 simu->SetupUserInterface(xml_file); 103 104 104 105 #ifdef GL 105 gui=new Parser(simu,1024,768,1024,768,media_path,scene_file);106 gui = new Parser(1024, 768, 1024, 768, media_path, scene_file); 106 107 #endif 107 108 108 if(type=="x4") {109 drone=new X4(simu,name,0);110 111 drone=new X8(simu,name,0);112 109 if(type == "x4") { 110 drone = new X4(name, 0); 111 } else { 112 drone = new X8(name, 0); 113 } 113 114 114 imu=new SimuImu(drone,"imu",0);115 imu = new SimuImu(drone, "imu", 0,0); 115 116 116 117 #ifdef GL 117 us_gl=new SimuUsGL(drone,"us",0); 118 118 us_gl = new SimuUsGL(drone, "us", 0,0); 119 119 120 man=new Man(simu,"target");120 man = new Man("target",1); 121 121 #endif 122 122 123 123 simu->RunSimu(); 124 124 125 125 delete simu; 126 126 127 127 return 0; 128 128 } 129 -
trunk/demos/Gps/simulator/src/main.cpp
r123 r158 24 24 #endif 25 25 26 27 26 using namespace TCLAP; 28 27 using namespace std; … … 39 38 string address; 40 39 41 void parseOptions(int argc, char** argv) { 42 try { 43 CmdLine cmd("Command description message", ' ', "0.1"); 40 void parseOptions(int argc, char** argv) 41 { 42 try { 43 CmdLine cmd("Command description message", ' ', "0.1"); 44 44 45 ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");46 cmd.add( nameArg);45 ValueArg<string> nameArg("n", "name", "uav name, also used for vrpn", true, "x4", "string"); 46 cmd.add(nameArg); 47 47 48 ValueArg<string> xmlArg("x","xml","xml file",true,"./reglages.xml","string");49 cmd.add( xmlArg);48 ValueArg<string> xmlArg("x", "xml", "xml file", true, "./reglages.xml", "string"); 49 cmd.add(xmlArg); 50 50 51 ValueArg<int> portArg("p","port","ground station port",true,9002,"int");52 cmd.add( portArg);51 ValueArg<int> portArg("p", "port", "ground station port", true, 9002, "int"); 52 cmd.add(portArg); 53 53 54 ValueArg<string> addressArg("a","address","ground station address",true,"127.0.0.1","string");55 cmd.add( addressArg);54 ValueArg<string> addressArg("a", "address", "ground station address", true, "127.0.0.1", "string"); 55 cmd.add(addressArg); 56 56 57 ValueArg<string> typeArg("t","type","uav type, x4 or x8",true,"x4","string");58 cmd.add( typeArg);57 ValueArg<string> typeArg("t", "type", "uav type, x4 or x8", true, "x4", "string"); 58 cmd.add(typeArg); 59 59 60 ValueArg<int> optiArg("o","opti","optitrack time ms",false,0,"int");61 cmd.add( optiArg);60 ValueArg<int> optiArg("o", "opti", "optitrack time ms", false, 0, "int"); 61 cmd.add(optiArg); 62 62 63 63 #ifdef GL 64 ValueArg<string> mediaArg("m","media","path to media files",true,"./","string");65 cmd.add( mediaArg);64 ValueArg<string> mediaArg("m", "media", "path to media files", true, "./", "string"); 65 cmd.add(mediaArg); 66 66 67 ValueArg<string> sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");68 cmd.add( sceneArg);67 ValueArg<string> sceneArg("s", "scene", "path to scene file", true, "./voliere.xml", "string"); 68 cmd.add(sceneArg); 69 69 #endif 70 70 71 cmd.parse( argc, argv);71 cmd.parse(argc, argv); 72 72 73 74 port=portArg.getValue();75 76 77 78 name=nameArg.getValue();79 address=addressArg.getValue();73 // Get the value parsed by each arg. 74 port = portArg.getValue(); 75 xml_file = xmlArg.getValue(); 76 opti_time = optiArg.getValue(); 77 type = typeArg.getValue(); 78 name = nameArg.getValue(); 79 address = addressArg.getValue(); 80 80 #ifdef GL 81 media_path=mediaArg.getValue();82 scene_file=sceneArg.getValue();81 media_path = mediaArg.getValue(); 82 scene_file = sceneArg.getValue(); 83 83 #endif 84 84 85 } catch (ArgException &e){86 87 85 } catch(ArgException& e) { 86 cerr << "error: " << e.error() << " for arg " << e.argId() << endl; 87 } 88 88 } 89 89 90 int main(int argc, char* argv[]) { 91 Simulator *simu; 92 Model *drone; 93 SimuImu *imu; 94 SimuGps *gps; 90 int main(int argc, char* argv[]) 91 { 92 Simulator* simu; 93 Model* drone; 94 SimuImu* imu; 95 SimuGps* gps; 95 96 #ifdef GL 96 SimuUsGL *us_gl; 97 Parser *gui; 98 Man *man; 97 SimuUsGL* us_gl; 98 Parser* gui; 99 99 #endif 100 parseOptions(argc,argv);100 parseOptions(argc, argv); 101 101 102 simu= new Simulator("simulator",opti_time,0);103 simu->SetupConnection(address,port);104 102 simu = new Simulator("simulator", opti_time, 0); 103 simu->SetupConnection(address, port); 104 simu->SetupUserInterface(xml_file); 105 105 106 106 #ifdef GL 107 gui=new Parser(simu,1024,768,1024,768,media_path,scene_file);107 gui = new Parser(1024, 768, 1024, 768, media_path, scene_file); 108 108 #endif 109 109 110 if(type=="x4") {111 drone=new X4(simu,name,0);112 113 drone=new X8(simu,name,0);114 110 if(type == "x4") { 111 drone = new X4(name, 0); 112 } else { 113 drone = new X8(name, 0); 114 } 115 115 116 imu=new SimuImu(drone,"imu",90);116 imu = new SimuImu(drone, "imu", 0,0); 117 117 118 118 #ifdef GL 119 us_gl=new SimuUsGL(drone,"us",0); 120 man=new Man(simu,"target"); 119 us_gl = new SimuUsGL(drone, "us", 0,0); 121 120 #endif 122 gps=new SimuGps(drone,"gps",0);121 gps = new SimuGps(drone, "gps", 0,0); 123 122 124 123 simu->RunSimu(); 125 124 126 125 delete simu; 127 126 128 127 return 0; 129 128 } 130 -
trunk/demos/OpticalFlow/simulator/src/main.cpp
r122 r158 23 23 #endif 24 24 25 26 25 using namespace TCLAP; 27 26 using namespace std; … … 40 39 void parseOptions(int argc, char** argv) 41 40 { 42 try 43 { 44 CmdLine cmd("Command description message", ' ', "0.1"); 41 try { 42 CmdLine cmd("Command description message", ' ', "0.1"); 45 43 46 ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");47 cmd.add( nameArg);44 ValueArg<string> nameArg("n", "name", "uav name, also used for vrpn", true, "x4", "string"); 45 cmd.add(nameArg); 48 46 49 ValueArg<string> xmlArg("x","xml","xml file",true,"./reglages.xml","string");50 cmd.add( xmlArg);47 ValueArg<string> xmlArg("x", "xml", "xml file", true, "./reglages.xml", "string"); 48 cmd.add(xmlArg); 51 49 52 ValueArg<int> portArg("p","port","ground station port",true,9002,"int");53 cmd.add( portArg);50 ValueArg<int> portArg("p", "port", "ground station port", true, 9002, "int"); 51 cmd.add(portArg); 54 52 55 ValueArg<string> addressArg("a","address","ground station address",true,"127.0.0.1","string");56 cmd.add( addressArg);53 ValueArg<string> addressArg("a", "address", "ground station address", true, "127.0.0.1", "string"); 54 cmd.add(addressArg); 57 55 58 ValueArg<string> typeArg("t","type","uav type, x4 or x8",true,"x4","string");59 cmd.add( typeArg);56 ValueArg<string> typeArg("t", "type", "uav type, x4 or x8", true, "x4", "string"); 57 cmd.add(typeArg); 60 58 61 62 ValueArg<int> optiArg("o","opti","optitrack time ms",false,0,"int"); 63 cmd.add( optiArg ); 59 ValueArg<int> optiArg("o", "opti", "optitrack time ms", false, 0, "int"); 60 cmd.add(optiArg); 64 61 65 62 #ifdef GL 66 ValueArg<string> mediaArg("m","media","path to media files",true,"./","string");67 cmd.add( mediaArg);63 ValueArg<string> mediaArg("m", "media", "path to media files", true, "./", "string"); 64 cmd.add(mediaArg); 68 65 69 ValueArg<string> sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");70 cmd.add( sceneArg);66 ValueArg<string> sceneArg("s", "scene", "path to scene file", true, "./voliere.xml", "string"); 67 cmd.add(sceneArg); 71 68 #endif 72 69 73 cmd.parse( argc, argv);70 cmd.parse(argc, argv); 74 71 75 76 port=portArg.getValue();77 78 79 80 name=nameArg.getValue();81 address=addressArg.getValue();72 // Get the value parsed by each arg. 73 port = portArg.getValue(); 74 xml_file = xmlArg.getValue(); 75 opti_time = optiArg.getValue(); 76 type = typeArg.getValue(); 77 name = nameArg.getValue(); 78 address = addressArg.getValue(); 82 79 #ifdef GL 83 media_path=mediaArg.getValue();84 scene_file=sceneArg.getValue();80 media_path = mediaArg.getValue(); 81 scene_file = sceneArg.getValue(); 85 82 #endif 86 83 87 } catch (ArgException &e) // catch any exceptions 88 { cerr << "error: " << e.error() << " for arg " << e.argId() << endl; } 84 } catch(ArgException& e) // catch any exceptions 85 { 86 cerr << "error: " << e.error() << " for arg " << e.argId() << endl; 87 } 89 88 } 90 91 89 92 90 int main(int argc, char* argv[]) 93 91 { 94 Simulator *simu;95 Model *drone;96 92 Simulator* simu; 93 Model* drone; 94 SimuImu* imu; 97 95 #ifdef GL 98 96 SimuUsGL* us_gl; 99 97 100 SimuCameraGL *cam_bas;101 Parser *gui;98 SimuCameraGL* cam_bas; 99 Parser* gui; 102 100 #endif 103 parseOptions(argc,argv);101 parseOptions(argc, argv); 104 102 105 simu= new Simulator("simulator",opti_time,90);106 simu->SetupConnection(address,port);107 103 simu = new Simulator("simulator", opti_time, 90); 104 simu->SetupConnection(address, port); 105 simu->SetupUserInterface(xml_file); 108 106 109 107 #ifdef GL 110 gui=new Parser(simu,960,480,640,480,media_path,scene_file);108 gui = new Parser(960, 480, 640, 480, media_path, scene_file); 111 109 #endif 112 110 113 if(type=="x4") 114 { 115 drone=new X4(simu,name,0); 116 } 117 else 118 { 119 drone=new X8(simu,name,0); 120 } 121 imu=new SimuImu(drone,"imu",0); 111 if(type == "x4") { 112 drone = new X4(name, 0); 113 } else { 114 drone = new X8(name, 0); 115 } 116 imu = new SimuImu(drone, "imu", 0,0); 122 117 123 118 #ifdef GL 124 us_gl=new SimuUsGL(drone,"us",0);125 cam_bas=new SimuCameraGL(drone,"bottom camera",320,240,640,0,0);119 us_gl = new SimuUsGL(drone, "us", 0,0); 120 cam_bas = new SimuCameraGL(drone, "bottom camera", 320, 240, 640, 0, 0,0); 126 121 #endif 127 122 128 123 simu->RunSimu(); 129 124 130 125 delete simu; 131 126 132 127 return 0; 133 128 } 134 -
trunk/demos/SimpleFleet/simulator/src/main.cpp
r33 r158 84 84 int main(int argc, char* argv[]) 85 85 { 86 86 Simulator *simu; 87 87 88 88 parseOptions(argc,argv); 89 89 90 simu= new Simulator("simulator",opti_time,90); 91 simu->SetupConnection(address,port); 92 simu->SetupUserInterface(xml_file); 90 simu= new Simulator("simulator",opti_time,90); 91 simu->SetupConnection(address,port); 92 simu->SetupUserInterface(xml_file); 93 #ifdef GL 94 Parser *gui=new Parser(1024,768,1024,768,media_path,scene_file); 95 #endif 96 for(int i=0; i<2;i++) { 97 stringstream uavName; 98 uavName << name.c_str() << "_" << i; 99 Model *drone=new X8(uavName.str(),i); 93 100 #ifdef GL 94 Parser *gui=new Parser(simu,640,480,640,480,media_path,scene_file);101 SimuUsGL *us_gl=new SimuUsGL(drone,"us",i,0); 95 102 #endif 96 for(int i=0; i<2;i++) 97 { 98 stringstream s; 99 s << name.c_str() << "_" << i; 100 Model *drone=new X8(simu,s.str(),i); 101 #ifdef GL 102 SimuUsGL *us_gl=new SimuUsGL(drone,"us",i); 103 #endif 104 SimuImu *imu=new SimuImu(drone,"imu",i); 105 } 103 SimuImu *imu=new SimuImu(drone,"imu",i,0); 104 } 106 105 107 106 simu->RunSimu(); 108 107 109 108 delete simu; 110 109 111 110 return 0; -
trunk/demos/SimpleFleet/uav/build_x86_64/bin/setup_x8.xml
r91 r158 135 135 </DataPlot1D> 136 136 </Tab> 137 < /TabWidget>137 <Tab name="Quaternion"><DataPlot1D name="q0" period="100" enabled="0"/><DataPlot1D name="q1" period="100" enabled="0"/><DataPlot1D name="q2" period="100" enabled="0"/><DataPlot1D name="q3" period="100" enabled="0"/></Tab><Tab name="IMU"><DataPlot1D name="acc_x" period="100" enabled="0"/><DataPlot1D name="acc_y" period="100" enabled="0"/><DataPlot1D name="acc_z" period="100" enabled="0"/><DataPlot1D name="gyr_x" period="100" enabled="0"/><DataPlot1D name="gyr_y" period="100" enabled="0"/><DataPlot1D name="gyr_z" period="100" enabled="0"/><DataPlot1D name="mag_x" period="100" enabled="0"/><DataPlot1D name="mag_y" period="100" enabled="0"/><DataPlot1D name="mag_z" period="100" enabled="0"/></Tab></TabWidget> 138 138 </Tab> 139 139 <Tab name="battery"> … … 340 340 </Tab> 341 341 </TabWidget> 342 <TabWidget name="App_TabWidget"><Tab name="x8_0"><PushButton name="save config on target" value="1"/></Tab><Tab name="x8_1"><PushButton name="save config on target" value="1"/></Tab></TabWidget>< /root>342 <TabWidget name="App_TabWidget"><Tab name="x8_0"><PushButton name="save config on target" value="1"/></Tab><Tab name="x8_1"><PushButton name="save config on target" value="1"/></Tab></TabWidget><PushButton name="save config on target (x8_0)" value="1"/></root>
Note:
See TracChangeset
for help on using the changeset viewer.