- Timestamp:
- Mar 5, 2017, 10:50:56 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 49 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> -
trunk/lib/FlairFilter/src/SimuAhrs.cpp
r157 r158 27 27 namespace filter { 28 28 29 SimuAhrs::SimuAhrs(string name, uint32_t dev_id,29 SimuAhrs::SimuAhrs(string name, uint32_t modelId,uint32_t deviceId, 30 30 uint8_t priority) 31 : Ahrs(new SimuImu(name, dev_id, priority), name) {31 : Ahrs(new SimuImu(name, modelId,deviceId, priority), name) { 32 32 SetIsReady(true); 33 33 } -
trunk/lib/FlairFilter/src/SimuAhrs.h
r157 r158 33 33 * 34 34 * \param name name 35 * \param dev_id number id of the simulated Ahrs 35 * \param modelId Model id 36 * \param deviceId Ahrs id of the Model 36 37 * \param priority priority of the SimuImu Thread 37 38 */ 38 39 SimuAhrs(std::string name, 39 uint32_t dev_id, uint8_t priority);40 uint32_t modelId,uint32_t deviceId, uint8_t priority); 40 41 41 42 /*! -
trunk/lib/FlairMeta/src/SimuX4.cpp
r157 r158 38 38 namespace meta { 39 39 40 SimuX4::SimuX4(string name, int simu_id,string options,40 SimuX4::SimuX4(string name, uint32_t simu_id,string options, 41 41 filter::UavMultiplex *multiplex) 42 42 : Uav(name, multiplex) { … … 46 46 47 47 SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(), 48 "motors", GetUavMultiplex()->MotorsCount(), simu_id ));49 SetUsRangeFinder(new SimuUs("us", simu_id, 60));50 SetAhrs(new SimuAhrs("imu", simu_id, 70));48 "motors", GetUavMultiplex()->MotorsCount(), simu_id,0)); 49 SetUsRangeFinder(new SimuUs("us", simu_id,0, 60)); 50 SetAhrs(new SimuAhrs("imu", simu_id, 0,70)); 51 51 Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery"); 52 52 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery")); … … 59 59 } 60 60 61 SetVerticalCamera( 62 new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id, 10));61 SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10)); 62 //SetHorizontalCamera(new SimuCamera("simu_cam_h", 320, 240, 3, simu_id,1, 10)); 63 63 } 64 64 -
trunk/lib/FlairMeta/src/SimuX4.h
r157 r158 26 26 // simu_id: 0 if simulating only one UAV 27 27 //>0 otherwise 28 SimuX4(std::string name, int simu_id = 0,std::string options="",28 SimuX4(std::string name, uint32_t simu_id = 0,std::string options="", 29 29 filter::UavMultiplex *multiplex = NULL); 30 30 ~SimuX4(); -
trunk/lib/FlairMeta/src/SimuX8.cpp
r157 r158 37 37 namespace meta { 38 38 39 SimuX8::SimuX8(string name, int simu_id,string options,39 SimuX8::SimuX8(string name, uint32_t simu_id,string options, 40 40 filter::UavMultiplex *multiplex) 41 41 : Uav(name, multiplex) { … … 45 45 46 46 SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(), 47 "motors", GetUavMultiplex()->MotorsCount(), simu_id ));48 SetUsRangeFinder(new SimuUs("us", simu_id, 60));49 SetAhrs(new SimuAhrs("imu", simu_id, 70));47 "motors", GetUavMultiplex()->MotorsCount(), simu_id,0)); 48 SetUsRangeFinder(new SimuUs("us", simu_id,0, 60)); 49 SetAhrs(new SimuAhrs("imu", simu_id, 0,70)); 50 50 Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery"); 51 51 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery")); 52 52 GetBatteryMonitor()->SetBatteryValue(12); 53 SetVerticalCamera( 54 new SimuCamera("simu_cam_v", 320, 240, 3, simu_id, 10));53 SetVerticalCamera(new SimuCamera("simu_cam_v", 320, 240, 3, simu_id,0, 10)); 54 //SetHorizontalCamera(new SimuCamera("simu_cam_h", 320, 240, 3, simu_id,1, 10)); 55 55 } 56 56 -
trunk/lib/FlairMeta/src/SimuX8.h
r157 r158 26 26 // simu_id: 0 if simulating only one UAV 27 27 //>0 otherwise 28 SimuX8(std::string name, int simu_id = 0,std::string options="",28 SimuX8(std::string name, uint32_t simu_id = 0,std::string options="", 29 29 filter::UavMultiplex *multiplex = NULL); 30 30 ~SimuX8(); -
trunk/lib/FlairSensorActuator/src/SimuBldc.cpp
r157 r158 33 33 34 34 SimuBldc::SimuBldc(const IODevice *parent, Layout *layout, string name, 35 uint8_t motors_count, uint32_t dev_id)35 uint8_t motors_count, uint32_t modelId,uint32_t deviceId) 36 36 : Bldc(parent, layout, name, motors_count) { 37 ostringstream dev_name;38 dev_name << "simu_bldc_" << dev_id;39 37 shmem = 40 new SharedMem(this, dev_name.str().c_str(), motors_count * sizeof(float));38 new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)); 41 39 42 40 GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc"); … … 47 45 48 46 SimuBldc::SimuBldc(const Object *parent, string name, uint8_t motors_count, 49 uint32_t dev_id)47 uint32_t modelId,uint32_t deviceId) 50 48 : Bldc(parent, name, motors_count) { 51 ostringstream dev_name;52 dev_name << "simu_bldc_" << dev_id;53 49 shmem = 54 new SharedMem(this, dev_name.str().c_str(), motors_count * sizeof(float));50 new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float)); 55 51 56 52 // reset values … … 65 61 66 62 SimuBldc::~SimuBldc() {} 63 64 string SimuBldc::ShMemName(uint32_t modelId,uint32_t deviceId) { 65 ostringstream dev_name; 66 dev_name << "simu" << modelId << "_bldc_" << deviceId; 67 return dev_name.str().c_str(); 68 } 67 69 68 70 void SimuBldc::SetMotors(float *value) { -
trunk/lib/FlairSensorActuator/src/SimuBldc.h
r15 r158 46 46 * \param name name 47 47 * \param motors_count number of motors 48 * \param dev_id device id 48 * \param modelId Model id 49 * \param deviceId Bldc id of the Model 49 50 */ 50 51 SimuBldc(const core::IODevice *parent, gui::Layout *layout, std::string name, 51 uint8_t motors_count, uint32_t dev_id);52 uint8_t motors_count, uint32_t modelId,uint32_t deviceId); 52 53 53 54 /*! … … 59 60 * \param name name 60 61 * \param motors_count number of motors 61 * \param dev_id device id 62 * \param modelId Model id 63 * \param deviceId Bldc id of the Model 62 64 */ 63 65 SimuBldc(const core::Object *parent, std::string name, uint8_t motors_count, 64 uint32_t dev_id);66 uint32_t modelId,uint32_t deviceId); 65 67 66 68 /*! … … 107 109 */ 108 110 void SetMotors(float *value); 109 111 112 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 110 113 core::SharedMem *shmem; 111 114 gui::DoubleSpinBox *k; -
trunk/lib/FlairSensorActuator/src/SimuCamera.cpp
r157 r158 33 33 SimuCamera::SimuCamera(string name, 34 34 uint16_t width, uint16_t height, uint8_t channels, 35 uint32_t dev_id, uint8_t priority)35 uint32_t modelId,uint32_t deviceId, uint8_t priority) 36 36 : Thread(getFrameworkManager(), name, priority), 37 37 Camera(name, width, height, cvimage::Type::Format::BGR) { … … 43 43 44 44 ostringstream dev_name; 45 dev_name << "simu _cam_" << dev_id;46 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), buf_size, SharedMem::Type::producerConsumer);45 dev_name << "simu" << modelId << "_cam_" << deviceId; 46 shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), buf_size, SharedMem::Type::producerConsumer); 47 47 48 48 SetIsReady(true); … … 51 51 //simulation part 52 52 SimuCamera::SimuCamera(const IODevice *parent, string name, uint16_t width, 53 uint16_t height, uint8_t channels, uint32_t dev_id)53 uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId) 54 54 : Thread(parent, name, 0), Camera(parent,name) { 55 55 56 56 buf_size = width * height * channels+sizeof(Time); 57 57 58 ostringstream dev_name; 59 dev_name << "simu_cam_" << dev_id; 60 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 58 shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), 61 59 buf_size, SharedMem::Type::producerConsumer); 62 60 shmemReadBuf=NULL; … … 69 67 Join(); 70 68 if(shmemReadBuf!=NULL) delete shmemReadBuf; 69 } 70 71 string SimuCamera::ShMemName(uint32_t modelId,uint32_t deviceId) { 72 ostringstream dev_name; 73 dev_name << "simu" << modelId << "_cam_" << deviceId; 74 return dev_name.str().c_str(); 71 75 } 72 76 -
trunk/lib/FlairSensorActuator/src/SimuCamera.h
r151 r158 42 42 * \param height height 43 43 * \param channels number of channels 44 * \param dev_id device id 44 * \param modelId Model id 45 * \param deviceId Camera id of the Model 45 46 * \param priority priority of the Thread 46 47 */ 47 48 SimuCamera(std::string name, 48 uint16_t width, uint16_t height, uint8_t channels, uint32_t dev_id,49 uint16_t width, uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId, 49 50 uint8_t priority); 50 51 … … 60 61 * \param height height 61 62 * \param channels number of channels 62 * \param dev_id device id 63 * \param modelId Model id 64 * \param deviceId Camera id of the Model 63 65 */ 64 66 SimuCamera(const core::IODevice *parent, std::string name, uint16_t width, 65 uint16_t height, uint8_t channels, uint32_t dev_id);67 uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId); 66 68 67 69 /*! … … 95 97 */ 96 98 void UpdateFrom(const core::io_data *data){}; 99 100 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 97 101 98 102 size_t buf_size; -
trunk/lib/FlairSensorActuator/src/SimuGps.cpp
r157 r158 39 39 40 40 SimuGps::SimuGps(string name, 41 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t deviceId,uint8_t priority)41 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority) 42 42 : NmeaGps(name, NMEAFlags),Thread(getFrameworkManager(), name, priority) { 43 43 … … 49 49 numberOfSatellites = new SpinBox(GetGroupBox()->NewRow(), "number of satellites", 1, 15, 1, 5); 50 50 51 ostringstream dev_name; 52 dev_name << "simu_gps_" << deviceId; 53 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 51 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 54 52 sizeof(gps_states_t)); 55 53 … … 58 56 59 57 60 SimuGps::SimuGps(const IODevice *parent, string name, uint32_t deviceId)58 SimuGps::SimuGps(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId) 61 59 : NmeaGps(parent, name), Thread(parent, name, 0) { 62 60 dataRate = NULL; 63 61 64 ostringstream dev_name; 65 dev_name << "simu_gps_" << deviceId; 66 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 62 shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), 67 63 sizeof(gps_states_t)); 68 64 … … 73 69 SafeStop(); 74 70 Join(); 71 } 72 73 string SimuGps::ShMemName(uint32_t modelId,uint32_t deviceId) { 74 ostringstream dev_name; 75 dev_name << "simu" << modelId << "_gps_" << deviceId; 76 return dev_name.str().c_str(); 75 77 } 76 78 -
trunk/lib/FlairSensorActuator/src/SimuGps.h
r137 r158 43 43 * \param name name 44 44 * \param NMEAFlags NMEA sentances to enable 45 * \param deviceId device id 45 * \param modelId Model id 46 * \param deviceId Gps id of the Model 46 47 * \param priority priority of the Thread 47 48 */ 48 49 SimuGps(std::string name, 49 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t deviceId,uint8_t priority);50 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority); 50 51 51 52 /*! … … 57 58 * \param parent parent 58 59 * \param name name 59 * \param deviceId device id 60 * \param modelId Model id 61 * \param deviceId Gps id of the Model 60 62 */ 61 SimuGps(const core::IODevice *parent, std::string name, uint32_t deviceId);63 SimuGps(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId); 62 64 63 65 /*! … … 92 94 float vn; 93 95 } gps_states_t; 96 97 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 94 98 95 99 core::SharedMem *shmem; -
trunk/lib/FlairSensorActuator/src/SimuImu.cpp
r157 r158 34 34 namespace sensor { 35 35 36 SimuImu::SimuImu(string name, uint32_t dev_id,36 SimuImu::SimuImu(string name, uint32_t modelId,uint32_t deviceId, 37 37 uint8_t priority) 38 38 : Imu(name), Thread(getFrameworkManager(), name, priority) { … … 40 40 new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200); 41 41 ahrsData = new AhrsData((Imu *)this); 42 43 ostringstream dev_name; 44 dev_name << "simu_imu_" << dev_id; 45 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 42 43 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 46 44 sizeof(imu_states_t)); 47 45 SetIsReady(true); 48 46 } 49 47 50 SimuImu::SimuImu(const IODevice *parent, string name, uint32_t dev_id)48 SimuImu::SimuImu(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId) 51 49 : Imu(parent,name), Thread(parent, name, 0) { 52 50 dataRate = NULL; 53 51 54 ostringstream dev_name; 55 dev_name << "simu_imu_" << dev_id; 56 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 52 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 57 53 sizeof(imu_states_t)); 58 54 SetIsReady(true); … … 62 58 SafeStop(); 63 59 Join(); 60 } 61 62 string SimuImu::ShMemName(uint32_t modelId,uint32_t deviceId) { 63 ostringstream dev_name; 64 dev_name << "simu" << modelId << "_imu_" << deviceId; 65 return dev_name.str().c_str(); 64 66 } 65 67 -
trunk/lib/FlairSensorActuator/src/SimuImu.h
r137 r158 42 42 * 43 43 * \param name name 44 * \param dev_id device id 44 * \param modelId Model id 45 * \param deviceId Imu id of the Model 45 46 * \param priority priority of the Thread 46 47 */ 47 48 SimuImu(std::string name, 48 uint32_t dev_id, uint8_t priority);49 uint32_t modelId,uint32_t deviceId, uint8_t priority); 49 50 50 51 /*! … … 56 57 * \param parent parent 57 58 * \param name name 58 * \param dev_id device id 59 * \param modelId Model id 60 * \param deviceId Imu id of the Model 59 61 */ 60 SimuImu(const core::IODevice *parent, std::string name, uint32_t dev_id);62 SimuImu(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId); 61 63 62 64 /*! … … 93 95 float wz; 94 96 } imu_states_t; 97 98 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 95 99 96 100 gui::SpinBox *dataRate; -
trunk/lib/FlairSensorActuator/src/SimuLaser.cpp
r157 r158 33 33 34 34 SimuLaser::SimuLaser(string name, 35 uint32_t dev_id, uint8_t priority)35 uint32_t modelId,uint32_t deviceId, uint8_t priority) 36 36 : Thread(getFrameworkManager(), name, priority), LaserRangeFinder(name) { 37 37 data_rate = 38 38 new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50); 39 39 40 ostringstream dev_name; 41 dev_name << "simu_Laser_" << dev_id; 42 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 40 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 43 41 360 * sizeof(float)); 44 42 SetIsReady(true); 45 43 } 46 44 47 SimuLaser::SimuLaser(const IODevice *parent, string name, uint32_t dev_id)45 SimuLaser::SimuLaser(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId) 48 46 : Thread(parent, name, 0), LaserRangeFinder(parent, name) { 49 47 data_rate = NULL; 50 48 51 ostringstream dev_name; 52 dev_name << "simu_Laser_" << dev_id; 53 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), 49 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), 54 50 360 * sizeof(float)); 55 51 SetIsReady(true); … … 59 55 SafeStop(); 60 56 Join(); 57 } 58 59 string SimuLaser::ShMemName(uint32_t modelId,uint32_t deviceId) { 60 ostringstream dev_name; 61 dev_name << "simu" << modelId << "_laser_" << deviceId; 62 return dev_name.str().c_str(); 61 63 } 62 64 -
trunk/lib/FlairSensorActuator/src/SimuLaser.h
r137 r158 41 41 * 42 42 * \param name name 43 * \param dev_id device id 43 * \param modelId Model id 44 * \param deviceId LaserRangeFinder id of the Model 44 45 * \param priority priority of the Thread 45 46 */ 46 47 SimuLaser(std::string name, 47 uint32_t dev_id, uint8_t priority);48 uint32_t modelId,uint32_t deviceId, uint8_t priority); 48 49 49 50 /*! … … 55 56 * \param parent parent 56 57 * \param name name 57 * \param dev_id device id 58 * \param modelId Model id 59 * \param deviceId LaserRangeFinder id of the Model 58 60 */ 59 SimuLaser(const core::IODevice *parent, std::string name, uint32_t dev_id);61 SimuLaser(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId); 60 62 61 63 /*! … … 89 91 */ 90 92 void Run(void); 91 93 94 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 92 95 gui::SpinBox *data_rate; 93 96 }; -
trunk/lib/FlairSensorActuator/src/SimuUs.cpp
r157 r158 32 32 namespace sensor { 33 33 34 SimuUs::SimuUs(string name, uint32_t dev_id,34 SimuUs::SimuUs(string name, uint32_t modelId,uint32_t deviceId, 35 35 uint8_t priority) 36 36 : Thread(getFrameworkManager(), name, priority), UsRangeFinder( name) { … … 38 38 new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50); 39 39 40 ostringstream dev_name; 41 dev_name << "simu_us_" << dev_id; 42 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), sizeof(float)); 40 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float)); 43 41 44 42 SetIsReady(true); 45 43 } 46 44 47 SimuUs::SimuUs(const IODevice *parent, string name, uint32_t dev_id)45 SimuUs::SimuUs(const IODevice *parent, string name,uint32_t modelId,uint32_t deviceId) 48 46 : Thread(parent, name, 0), UsRangeFinder(parent,name) { 49 47 data_rate = NULL; 50 48 51 ostringstream dev_name; 52 dev_name << "simu_us_" << dev_id; 53 shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), sizeof(float)); 49 shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float)); 54 50 55 51 SetIsReady(true); … … 59 55 SafeStop(); 60 56 Join(); 57 } 58 59 string SimuUs::ShMemName(uint32_t modelId,uint32_t deviceId) { 60 ostringstream dev_name; 61 dev_name << "simu" << modelId << "_us_" << deviceId; 62 return dev_name.str().c_str(); 61 63 } 62 64 -
trunk/lib/FlairSensorActuator/src/SimuUs.h
r137 r158 41 41 * 42 42 * \param name name 43 * \param dev_id device id 43 * \param modelId Model id 44 * \param deviceId UsRangeFinder id of the Model 44 45 * \param priority priority of the Thread 45 46 */ 46 47 SimuUs(std::string name, 47 uint32_t dev_id, uint8_t priority);48 uint32_t modelId,uint32_t deviceId, uint8_t priority); 48 49 49 50 /*! … … 55 56 * \param parent parent 56 57 * \param name name 57 * \param dev_id device id 58 * \param modelId Model id 59 * \param deviceId UsRangeFinder id of the Model 58 60 */ 59 SimuUs(const core::IODevice *parent, std::string name, uint32_t dev_id);61 SimuUs(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId); 60 62 61 63 /*! … … 89 91 */ 90 92 void Run(void); 91 93 94 std::string ShMemName(uint32_t modelId,uint32_t deviceId); 92 95 gui::SpinBox *data_rate; 93 96 }; -
trunk/lib/FlairSimulator/src/Castle.cpp
r15 r158 17 17 18 18 #include "Castle.h" 19 #include "Simulator.h"20 19 #include <IrrlichtDevice.h> 21 20 #include <IFileSystem.h> … … 27 26 namespace simulator { 28 27 29 Castle::Castle( const Simulator *parent,int app_width, int app_height,28 Castle::Castle(int app_width, int app_height, 30 29 int scene_width, int scene_height, std::string media_path) 31 : Gui( parent,"Castle", app_width, app_height, scene_width, scene_height,30 : Gui("Castle", app_width, app_height, scene_width, scene_height, 32 31 media_path) { 33 32 // carte -
trunk/lib/FlairSimulator/src/Castle.h
r15 r158 23 23 class Castle : public Gui { 24 24 public: 25 Castle( const flair::simulator::Simulator *parent,int app_width,25 Castle(int app_width, 26 26 int app_height, int scene_width, int scene_height, 27 27 std::string media_path); -
trunk/lib/FlairSimulator/src/GenericObject.cpp
r134 r158 37 37 namespace simulator { 38 38 39 GenericObject::GenericObject( Simulator *parent,IMesh *mesh)39 GenericObject::GenericObject(IMesh *mesh) 40 40 { 41 41 meshSceneNode=getGui()->getSceneManager()->addMeshSceneNode(mesh); … … 46 46 meshSceneNode->setMaterialFlag(EMF_LIGHTING, false); 47 47 48 parent->pimpl_->objects.push_back(this);48 getSimulator()->pimpl_->objects.push_back(this); 49 49 } 50 50 -
trunk/lib/FlairSimulator/src/Gui.cpp
r69 r158 133 133 } 134 134 135 Gui::Gui( const Simulator *parent,std::string name, int app_width,135 Gui::Gui(std::string name, int app_width, 136 136 int app_height, int scene_width, int scene_height, 137 137 std::string media_path, E_DRIVER_TYPE driver_type) 138 : Object( parent, name, "Gui") {138 : Object(getSimulator(), name, "Gui") { 139 139 if (gui_ != NULL) 140 140 Err("Gui should be instanced only one time\n"); -
trunk/lib/FlairSimulator/src/Gui.h
r145 r158 48 48 namespace flair { 49 49 namespace simulator { 50 class Simulator;51 50 52 51 class Gui: public core::Object { … … 55 54 56 55 public: 57 Gui( const Simulator *parent,std::string name, int app_width, int app_height,56 Gui(std::string name, int app_width, int app_height, 58 57 int scene_width, int scene_height, std::string media_path, 59 58 irr::video::E_DRIVER_TYPE driver_type = irr::video::EDT_OPENGL); -
trunk/lib/FlairSimulator/src/Man.cpp
r157 r158 18 18 #include "Man.h" 19 19 #include "Gui.h" 20 #include "Simulator.h"21 #include "Simulator_impl.h"22 20 #include "Euler.h" 23 21 #include <ISceneManager.h> … … 38 36 namespace simulator { 39 37 40 Man::Man( const Simulator *parent, std::string name) : Model(parent, name) {38 Man::Man(std::string name,uint32_t modelId) : Model(name,modelId) { 41 39 node = getGui()->getSceneManager()->addAnimatedMeshSceneNode( 42 40 getGui()->getMesh("ninja.b3d"), getSceneNode(), -1, vector3df(0, 0, 0), -
trunk/lib/FlairSimulator/src/Man.h
r15 r158 34 34 namespace flair { 35 35 namespace simulator { 36 class Simulator;37 36 38 37 class Man : private Model { 39 38 public: 40 Man( const Simulator *parent, std::string name);39 Man(std::string name,uint32_t modelId); 41 40 ~Man(); 42 41 -
trunk/lib/FlairSimulator/src/Model.cpp
r70 r158 18 18 #include "Model_impl.h" 19 19 #include "Simulator.h" 20 #include "Simulator_impl.h"21 20 #include <DoubleSpinBox.h> 22 21 23 22 #ifdef GL 24 23 #include "FollowMeCamera.h" 25 #include "Gui.h"26 24 #include <ICameraSceneNode.h> 27 25 using namespace irr; … … 36 34 namespace simulator { 37 35 38 Model::Model(const Simulator *parent, std::string name) 39 : IODevice(parent, name) { 40 #ifdef GL 41 pimpl_ = 42 new Model_impl(this, name, getGui()->getSceneManager(), parent->pimpl_); 43 #else 44 pimpl_ = new Model_impl(this, name, parent->pimpl_); 45 #endif 46 parent->pimpl_->models.push_back(this); 36 Model::Model(std::string name,uint32_t modelId) 37 : IODevice(getSimulator(), name) { 38 pimpl_ = new Model_impl(this, name,modelId); 47 39 } 48 40 … … 79 71 float Model::dT(void) const { return pimpl_->dT->Value(); } 80 72 73 int Model::GetId(void) const { 74 return pimpl_->modelId; 75 } 76 81 77 } // end namespace simulator 82 78 } // end namespace flair -
trunk/lib/FlairSimulator/src/Model.h
r69 r158 51 51 namespace flair { 52 52 namespace simulator { 53 class Simulator;54 53 class FollowMeCamera; 55 54 … … 65 64 66 65 public: 67 Model( const Simulator *parent, std::string name);66 Model(std::string name,uint32_t modelId); 68 67 virtual ~Model(); 69 68 … … 93 92 #endif 94 93 gui::TabWidget *GetTabWidget(void) const; 94 int GetId(void) const; 95 95 96 96 protected: -
trunk/lib/FlairSimulator/src/Model_impl.cpp
r151 r158 18 18 #include "Model_impl.h" 19 19 #include "Simulator.h" 20 #include "Simulator_impl.h" 20 21 #include "TabWidget.h" 21 22 #include "Tab.h" … … 51 52 52 53 #ifdef GL 53 Model_impl::Model_impl(Model *self, std::string name, 54 ISceneManager *scenemanager, vrpn_Connection_IP *vrpn) 55 : ISceneNode(scenemanager->getRootSceneNode(), scenemanager, -1), 56 Thread(self, name, 50), vrpn_Tracker(name.c_str(), vrpn) 54 Model_impl::Model_impl(Model *self, std::string name,uint32_t modelId) 55 : ISceneNode(getGui()->getSceneManager()->getRootSceneNode(), getGui()->getSceneManager(), -1), 56 Thread(self, name, 50), vrpn_Tracker(name.c_str(), getSimulator()->pimpl_) 57 57 58 58 #else 59 Model_impl::Model_impl(Model *self, std::string name, vrpn_Connection_IP *vrpn)60 : Thread(self, name, 50), vrpn_Tracker(name.c_str(), vrpn)59 Model_impl::Model_impl(Model *self, std::string name,uint32_t modelId) 60 : Thread(self, name, 50), vrpn_Tracker(name.c_str(), getSimulator()->pimpl_) 61 61 #endif 62 62 { 63 63 this->self = self; 64 this->modelId=modelId; 64 65 65 66 #ifdef GL … … 131 132 132 133 self->AddDataToLog(output); 134 135 getSimulator()->pimpl_->models.push_back(self); 133 136 } 134 137 -
trunk/lib/FlairSimulator/src/Parser.cpp
r138 r158 40 40 namespace flair { 41 41 namespace simulator { 42 Parser::Parser( Simulator *parent,int app_width, int app_height,42 Parser::Parser(int app_width, int app_height, 43 43 int scene_width, int scene_height, std::string media_path, 44 44 std::string xmlFile) 45 : Gui( parent,"Parser", app_width, app_height, scene_width, scene_height,45 : Gui("Parser", app_width, app_height, scene_width, scene_height, 46 46 media_path) { 47 47 this->media_path = media_path; 48 this->parent = parent;49 48 xmlNode *root_element = NULL; 50 49 doc = xmlReadFile(xmlFile.c_str(), NULL, 0); … … 121 120 if (fp != NULL) { 122 121 GenericObject *object = 123 new GenericObject( parent,getGui()->getMesh((char *)xmlGetProp(cur_node, (xmlChar *)"model")));122 new GenericObject(getGui()->getMesh((char *)xmlGetProp(cur_node, (xmlChar *)"model"))); 124 123 object->setPosition( 125 124 getMeshVect(cur_node->children, (xmlChar *)"position")); … … 140 139 getScolor(cur_node->children)); 141 140 //SColor(100, 255, 100, 100)); 142 GenericObject *object = new GenericObject( parent,mesh);141 GenericObject *object = new GenericObject(mesh); 143 142 object->setPosition(getMeshVect(cur_node->children, (xmlChar *)"position")); 144 143 object->setRotation(getMeshVect(cur_node->children, (xmlChar *)"rotation")); … … 152 151 atof((char *)xmlGetProp(cur_node, (xmlChar *)"eight")))); 153 152 154 GenericObject *object = 155 new GenericObject(parent, mesh); 153 GenericObject *object =new GenericObject(mesh); 156 154 object->setPosition( 157 155 getMeshVect(cur_node->children, (xmlChar *)"position")); -
trunk/lib/FlairSimulator/src/Parser.h
r138 r158 39 39 */ 40 40 public: 41 Parser( Simulator *parent,int app_width, int app_height, int scene_width,41 Parser(int app_width, int app_height, int scene_width, 42 42 int scene_height, std::string media_path, std::string xmlFile); 43 43 ~Parser(); … … 46 46 xmlDoc *doc; 47 47 std::string media_path; 48 Simulator *parent;49 48 void processElements(xmlNode *a_node); 50 49 void processObjects(xmlNode *a_node); -
trunk/lib/FlairSimulator/src/SimuCameraGL.cpp
r151 r158 45 45 46 46 SimuCameraGL::SimuCameraGL(const Model *parent, std::string name, int width, 47 int height, int x, int y, int dev_id)48 : SimuCamera(parent, name, width, height, 3, dev_id), SensorGL(parent) {47 int height, int x, int y, uint32_t modelId,uint32_t deviceId) 48 : SimuCamera(parent, name, width, height, 3, modelId,deviceId), SensorGL(parent) { 49 49 smgr = getGui()->getSceneManager(); 50 50 camera = smgr->addCameraSceneNode(); 51 51 camera->addAnimator(this); 52 camera->setAspectRatio( 4.0f / 3.0f); // on force a cause du view port52 camera->setAspectRatio((float)width /(float)height); // on force a cause du view port 53 53 54 54 this->width = width; -
trunk/lib/FlairSimulator/src/SimuCameraGL.h
r151 r158 51 51 // top left origin 52 52 SimuCameraGL(const simulator::Model *parent, std::string name, int width, 53 int height, int x, int y, int dev_id);53 int height, int x, int y, uint32_t modelId,uint32_t deviceId); 54 54 ~SimuCameraGL(); 55 55 //! Sets the value of the near clipping plane. (default: 1.0f) -
trunk/lib/FlairSimulator/src/SimuLaserGL.cpp
r15 r158 38 38 namespace flair { 39 39 namespace sensor { 40 SimuLaserGL::SimuLaserGL(const Model *parent, std::string name, int dev_id)41 : SimuLaser(parent, name, dev_id), SensorGL(parent) {40 SimuLaserGL::SimuLaserGL(const Model *parent, std::string name, uint32_t modelId,uint32_t deviceId) 41 : SimuLaser(parent, name, modelId,deviceId), SensorGL(parent) { 42 42 Tab *setup_tab = new Tab(parent->GetTabWidget(), name); 43 43 position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01); -
trunk/lib/FlairSimulator/src/SimuLaserGL.h
r15 r158 38 38 class SimuLaserGL : public SimuLaser, public SensorGL { 39 39 public: 40 SimuLaserGL(const simulator::Model *parent, std::string name, int dev_id);40 SimuLaserGL(const simulator::Model *parent, std::string name, uint32_t modelId,uint32_t deviceId); 41 41 ~SimuLaserGL(); 42 42 -
trunk/lib/FlairSimulator/src/SimuUsGL.cpp
r15 r158 38 38 namespace flair { 39 39 namespace sensor { 40 SimuUsGL::SimuUsGL(const Model *parent, std::string name, int dev_id)41 : SimuUs(parent, name, dev_id), SensorGL(parent) {40 SimuUsGL::SimuUsGL(const Model *parent, std::string name, uint32_t modelId,uint32_t deviceId) 41 : SimuUs(parent, name, modelId,deviceId), SensorGL(parent) { 42 42 Tab *setup_tab = new Tab(parent->GetTabWidget(), name); 43 43 position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01); -
trunk/lib/FlairSimulator/src/SimuUsGL.h
r15 r158 38 38 class SimuUsGL : public SimuUs, public SensorGL { 39 39 public: 40 SimuUsGL(const simulator::Model *parent, std::string name, int dev_id);40 SimuUsGL(const simulator::Model *parent, std::string name, uint32_t modelId,uint32_t deviceId); 41 41 ~SimuUsGL(); 42 42 -
trunk/lib/FlairSimulator/src/Simulator.h
r15 r158 22 22 23 23 class Simulator_impl; 24 class Model_impl; 24 25 25 26 namespace flair { … … 36 37 37 38 class Simulator : public core::FrameworkManager { 38 friend class Model;39 friend class ::Model_impl; 39 40 friend class Gui; 40 41 friend class GenericObject; -
trunk/lib/FlairSimulator/src/X4.cpp
r157 r158 16 16 17 17 #include "X4.h" 18 #include "Simulator.h"19 18 #include <SimuBldc.h> 20 19 #include <TabWidget.h> … … 46 45 namespace simulator { 47 46 48 X4::X4( const Simulator *parent, std::string name, int dev_id)49 : Model( parent, name) {47 X4::X4(std::string name, uint32_t modelId) 48 : Model(name,modelId) { 50 49 Tab *setup_tab = new Tab(GetTabWidget(), "model"); 51 50 m = new DoubleSpinBox(setup_tab->NewRow(), "mass (kg):", 0, 20, 0.1); … … 75 74 5); // moment d'inertie d'un axe (N.m.s²/rad) 76 75 77 motors = new SimuBldc(this, name, 4, dev_id);76 motors = new SimuBldc(this, name, 4, modelId,0); 78 77 79 78 SetIsReady(true); … … 96 95 97 96 // cylinders are aligned with y axis 98 red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));99 black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));100 motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));97 IMesh *red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0)); 98 IMesh *black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128)); 99 IMesh *motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128)); 101 100 // geo->drop(); 102 101 103 102 ITexture *texture = getGui()->getTexture("carbone.jpg"); 104 fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),103 MeshSceneNode *fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0), 105 104 vector3df(0, 0, -135)); 106 fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),105 MeshSceneNode *fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0), 107 106 vector3df(0, 0, -45)); 108 rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),107 MeshSceneNode *rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0), 109 108 vector3df(0, 0, 135), texture); 110 rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),109 MeshSceneNode *rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0), 111 110 vector3df(0, 0, 45), texture); 112 111 113 112 texture = getGui()->getTexture("metal047.jpg"); 114 fl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),113 MeshSceneNode *fl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5), 115 114 vector3df(90, 0, 0), texture); 116 fr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),115 MeshSceneNode *fr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5), 117 116 vector3df(90, 0, 0), texture); 118 rl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),117 MeshSceneNode *rl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5), 119 118 vector3df(90, 0, 0), texture); 120 rr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),119 MeshSceneNode *rr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5), 121 120 vector3df(90, 0, 0), texture); 122 121 -
trunk/lib/FlairSimulator/src/X4.h
r157 r158 32 32 } 33 33 34 #ifdef GL35 namespace irr {36 namespace scene {37 class IMesh;38 }39 }40 #endif41 42 34 namespace flair { 43 35 namespace simulator { 44 class Simulator;45 36 class Blade; 46 class MeshSceneNode;47 37 48 38 class X4 : public Model { 49 39 public: 50 X4( const Simulator *parent, std::string name, int dev_id);40 X4(std::string name, uint32_t modelId); 51 41 ~X4(); 52 42 #ifdef GL … … 55 45 56 46 protected: 57 irr::scene::IMesh *red_arm, *black_arm, *motor;58 MeshSceneNode *fl_arm, *fr_arm, *rl_arm, *rr_arm;59 MeshSceneNode *fl_motor, *fr_motor, *rl_motor, *rr_motor;60 47 Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade; 61 48 core::Mutex *motor_speed_mutex; -
trunk/lib/FlairSimulator/src/X8.cpp
r157 r158 16 16 17 17 #include "X8.h" 18 #include "Simulator.h"19 18 #include <SimuBldc.h> 20 19 #include <TabWidget.h> … … 46 45 namespace simulator { 47 46 48 X8::X8(const Simulator *parent, std::string name, int dev_id) 49 : Model(parent, name) { 47 X8::X8(std::string name, uint32_t modelId): Model( name,modelId) { 50 48 Tab *setup_tab = new Tab(GetTabWidget(), "model"); 51 49 m = new DoubleSpinBox(setup_tab->NewRow(), "mass (kg):", 0, 20, 0.1); … … 84 82 0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite) 85 83 86 motors = new SimuBldc(this, name, 8, dev_id);84 motors = new SimuBldc(this, name, 8, modelId,0); 87 85 88 86 SetIsReady(true); … … 101 99 102 100 // cylinders are aligned with y axis 103 red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));104 black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));105 motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));101 IMesh *red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0)); 102 IMesh *black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128)); 103 IMesh *motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128)); 106 104 // geo->drop(); 107 105 108 106 ITexture *texture = getGui()->getTexture("carbone.jpg"); 109 fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),107 MeshSceneNode *fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0), 110 108 vector3df(0, 0, -135)); 111 fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),109 MeshSceneNode *fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0), 112 110 vector3df(0, 0, -45)); 113 rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),111 MeshSceneNode *rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0), 114 112 vector3df(0, 0, 135), texture); 115 rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),113 MeshSceneNode *rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0), 116 114 vector3df(0, 0, 45), texture); 117 115 118 116 texture = getGui()->getTexture("metal047.jpg"); 119 tfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),120 vector3df(90, 0, 0), texture); 121 tfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),122 vector3df(90, 0, 0), texture); 123 trl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),124 vector3df(90, 0, 0), texture); 125 trr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),126 vector3df(90, 0, 0), texture); 127 128 bfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, -17.5),129 vector3df(90, 0, 0), texture); 130 bfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, -17.5),131 vector3df(90, 0, 0), texture); 132 brl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, -17.5),133 vector3df(90, 0, 0), texture); 134 brr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, -17.5),117 MeshSceneNode *tfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5), 118 vector3df(90, 0, 0), texture); 119 MeshSceneNode *tfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5), 120 vector3df(90, 0, 0), texture); 121 MeshSceneNode *trl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5), 122 vector3df(90, 0, 0), texture); 123 MeshSceneNode *trr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5), 124 vector3df(90, 0, 0), texture); 125 126 MeshSceneNode *bfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, -17.5), 127 vector3df(90, 0, 0), texture); 128 MeshSceneNode *bfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, -17.5), 129 vector3df(90, 0, 0), texture); 130 MeshSceneNode *brl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, -17.5), 131 vector3df(90, 0, 0), texture); 132 MeshSceneNode *brr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, -17.5), 135 133 vector3df(90, 0, 0), texture); 136 134 -
trunk/lib/FlairSimulator/src/X8.h
r157 r158 32 32 } 33 33 34 #ifdef GL35 namespace irr {36 namespace scene {37 class IMesh;38 }39 }40 #endif41 42 34 namespace flair { 43 35 namespace simulator { 44 class Simulator;45 36 class Blade; 46 class MeshSceneNode;47 37 48 38 class X8 : public Model { 49 39 public: 50 X8( const Simulator *parent, std::string name, int dev_id);40 X8(std::string name, uint32_t modelId); 51 41 ~X8(); 52 42 virtual void Draw(void); … … 55 45 protected: 56 46 #ifdef GL 57 irr::scene::IMesh *red_arm, *black_arm, *motor;58 MeshSceneNode *fl_arm, *fr_arm, *rl_arm, *rr_arm;59 MeshSceneNode *tfl_motor, *tfr_motor, *trl_motor, *trr_motor;60 MeshSceneNode *bfl_motor, *bfr_motor, *brl_motor, *brr_motor;61 47 Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade; 62 48 Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade; -
trunk/lib/FlairSimulator/src/unexported/GenericObject.h
r134 r158 34 34 namespace flair { 35 35 namespace simulator { 36 class Simulator;37 36 38 37 class GenericObject { … … 40 39 41 40 public: 42 GenericObject( Simulator *parent,irr::scene::IMesh *mesh);41 GenericObject(irr::scene::IMesh *mesh); 43 42 virtual ~GenericObject(); 44 43 -
trunk/lib/FlairSimulator/src/unexported/Model_impl.h
r69 r158 66 66 { 67 67 public: 68 #ifdef GL 69 Model_impl(flair::simulator::Model *self, std::string name, 70 irr::scene::ISceneManager *scenemanager, vrpn_Connection_IP *vrpn); 71 #else 72 Model_impl(flair::simulator::Model *self, std::string name, 73 vrpn_Connection_IP *vrpn); 74 #endif 68 Model_impl(flair::simulator::Model *self, std::string name,uint32_t modelId); 75 69 ~Model_impl(); 76 70 … … 100 94 flair::gui::TabWidget *tabwidget; 101 95 flair::gui::DoubleSpinBox *dT; 96 int modelId; 102 97 103 98 private: -
trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h
r15 r158 29 29 } 30 30 31 class Model_impl; 32 31 33 class Simulator_impl : public vrpn_Connection_IP, private flair::core::Thread { 32 friend class flair::simulator::Model;34 friend class ::Model_impl; 33 35 friend class flair::simulator::GenericObject; 34 36
Note:
See TracChangeset
for help on using the changeset viewer.