Index: /trunk/demos/CircleFollower/simulator/src/main.cpp
===================================================================
--- /trunk/demos/CircleFollower/simulator/src/main.cpp	(revision 157)
+++ /trunk/demos/CircleFollower/simulator/src/main.cpp	(revision 158)
@@ -23,5 +23,4 @@
 #endif
 
-
 using namespace TCLAP;
 using namespace std;
@@ -38,92 +37,92 @@
 string address;
 
-void parseOptions(int argc, char** argv) {
-	try {
-        CmdLine cmd("Command description message", ' ', "0.1");
+void parseOptions(int argc, char** argv)
+{
+  try {
+    CmdLine cmd("Command description message", ' ', "0.1");
 
-        ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
-        cmd.add( nameArg );
+    ValueArg<string> nameArg("n", "name", "uav name, also used for vrpn", true, "x4", "string");
+    cmd.add(nameArg);
 
-        ValueArg<string> xmlArg("x","xml","xml file",true,"./reglages.xml","string");
-        cmd.add( xmlArg );
+    ValueArg<string> xmlArg("x", "xml", "xml file", true, "./reglages.xml", "string");
+    cmd.add(xmlArg);
 
-        ValueArg<int> portArg("p","port","ground station port",true,9002,"int");
-        cmd.add( portArg );
+    ValueArg<int> portArg("p", "port", "ground station port", true, 9002, "int");
+    cmd.add(portArg);
 
-        ValueArg<string> addressArg("a","address","ground station address",true,"127.0.0.1","string");
-        cmd.add( addressArg );
+    ValueArg<string> addressArg("a", "address", "ground station address", true, "127.0.0.1", "string");
+    cmd.add(addressArg);
 
-        ValueArg<string> typeArg("t","type","uav type, x4 or x8",true,"x4","string");
-        cmd.add( typeArg );
+    ValueArg<string> typeArg("t", "type", "uav type, x4 or x8", true, "x4", "string");
+    cmd.add(typeArg);
 
-        ValueArg<int> optiArg("o","opti","optitrack time ms",false,0,"int");
-        cmd.add( optiArg );
+    ValueArg<int> optiArg("o", "opti", "optitrack time ms", false, 0, "int");
+    cmd.add(optiArg);
 
 #ifdef GL
-        ValueArg<string> mediaArg("m","media","path to media files",true,"./","string");
-        cmd.add( mediaArg );
+    ValueArg<string> mediaArg("m", "media", "path to media files", true, "./", "string");
+    cmd.add(mediaArg);
 
-        ValueArg<string> sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");
-        cmd.add( sceneArg );
+    ValueArg<string> sceneArg("s", "scene", "path to scene file", true, "./voliere.xml", "string");
+    cmd.add(sceneArg);
 #endif
 
-        cmd.parse( argc, argv );
+    cmd.parse(argc, argv);
 
-        // Get the value parsed by each arg.
-        port=portArg.getValue();
-        xml_file = xmlArg.getValue();
-        opti_time = optiArg.getValue();
-        type = typeArg.getValue();
-        name=nameArg.getValue();
-        address=addressArg.getValue();
+    // Get the value parsed by each arg.
+    port = portArg.getValue();
+    xml_file = xmlArg.getValue();
+    opti_time = optiArg.getValue();
+    type = typeArg.getValue();
+    name = nameArg.getValue();
+    address = addressArg.getValue();
 #ifdef GL
-        media_path=mediaArg.getValue();
-        scene_file=sceneArg.getValue();
+    media_path = mediaArg.getValue();
+    scene_file = sceneArg.getValue();
 #endif
 
-	} catch (ArgException &e)  {
-	    cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
-    }
+  } catch(ArgException& e) {
+    cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+  }
 }
 
-int main(int argc, char* argv[]) {
-    Simulator *simu;
-    Model *drone;
-    SimuImu* imu;
+int main(int argc, char* argv[])
+{
+  Simulator* simu;
+  Model* drone;
+  SimuImu* imu;
 #ifdef GL
-    SimuUsGL* us_gl;
-    Parser *gui;
-    Man *man;
+  SimuUsGL* us_gl;
+  Parser* gui;
+  Man* man;
 #endif
-    parseOptions(argc,argv);
+  parseOptions(argc, argv);
 
-    simu= new Simulator("simulator",opti_time,90);
-    simu->SetupConnection(address,port);
-    simu->SetupUserInterface(xml_file);
+  simu = new Simulator("simulator", opti_time, 90);
+  simu->SetupConnection(address, port);
+  simu->SetupUserInterface(xml_file);
 
 #ifdef GL
-    gui=new Parser(simu,1024,768,1024,768,media_path,scene_file);
+  gui = new Parser(1024, 768, 1024, 768, media_path, scene_file);
 #endif
 
-    if(type=="x4") {
-        drone=new X4(simu,name,0);
-    } else {
-        drone=new X8(simu,name,0);
-    }
+  if(type == "x4") {
+    drone = new X4(name, 0);
+  } else {
+    drone = new X8(name, 0);
+  }
 
-    imu=new SimuImu(drone,"imu",0);
+  imu = new SimuImu(drone, "imu", 0,0);
 
 #ifdef GL
-    us_gl=new SimuUsGL(drone,"us",0);
-    
+  us_gl = new SimuUsGL(drone, "us", 0,0);
 
-    man=new Man(simu,"target");
+  man = new Man("target",1);
 #endif
 
-    simu->RunSimu();
+  simu->RunSimu();
 
-    delete simu;
+  delete simu;
 
-	return 0;
+  return 0;
 }
-
Index: /trunk/demos/Gps/simulator/src/main.cpp
===================================================================
--- /trunk/demos/Gps/simulator/src/main.cpp	(revision 157)
+++ /trunk/demos/Gps/simulator/src/main.cpp	(revision 158)
@@ -24,5 +24,4 @@
 #endif
 
-
 using namespace TCLAP;
 using namespace std;
@@ -39,92 +38,91 @@
 string address;
 
-void parseOptions(int argc, char** argv) {
-	try {
-        CmdLine cmd("Command description message", ' ', "0.1");
+void parseOptions(int argc, char** argv)
+{
+  try {
+    CmdLine cmd("Command description message", ' ', "0.1");
 
-        ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
-        cmd.add( nameArg );
+    ValueArg<string> nameArg("n", "name", "uav name, also used for vrpn", true, "x4", "string");
+    cmd.add(nameArg);
 
-        ValueArg<string> xmlArg("x","xml","xml file",true,"./reglages.xml","string");
-        cmd.add( xmlArg );
+    ValueArg<string> xmlArg("x", "xml", "xml file", true, "./reglages.xml", "string");
+    cmd.add(xmlArg);
 
-        ValueArg<int> portArg("p","port","ground station port",true,9002,"int");
-        cmd.add( portArg );
+    ValueArg<int> portArg("p", "port", "ground station port", true, 9002, "int");
+    cmd.add(portArg);
 
-        ValueArg<string> addressArg("a","address","ground station address",true,"127.0.0.1","string");
-        cmd.add( addressArg );
+    ValueArg<string> addressArg("a", "address", "ground station address", true, "127.0.0.1", "string");
+    cmd.add(addressArg);
 
-        ValueArg<string> typeArg("t","type","uav type, x4 or x8",true,"x4","string");
-        cmd.add( typeArg );
+    ValueArg<string> typeArg("t", "type", "uav type, x4 or x8", true, "x4", "string");
+    cmd.add(typeArg);
 
-        ValueArg<int> optiArg("o","opti","optitrack time ms",false,0,"int");
-        cmd.add( optiArg );
+    ValueArg<int> optiArg("o", "opti", "optitrack time ms", false, 0, "int");
+    cmd.add(optiArg);
 
 #ifdef GL
-        ValueArg<string> mediaArg("m","media","path to media files",true,"./","string");
-        cmd.add( mediaArg );
+    ValueArg<string> mediaArg("m", "media", "path to media files", true, "./", "string");
+    cmd.add(mediaArg);
 
-        ValueArg<string> sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");
-        cmd.add( sceneArg );
+    ValueArg<string> sceneArg("s", "scene", "path to scene file", true, "./voliere.xml", "string");
+    cmd.add(sceneArg);
 #endif
 
-        cmd.parse( argc, argv );
+    cmd.parse(argc, argv);
 
-        // Get the value parsed by each arg.
-        port=portArg.getValue();
-        xml_file = xmlArg.getValue();
-        opti_time = optiArg.getValue();
-        type = typeArg.getValue();
-        name=nameArg.getValue();
-        address=addressArg.getValue();
+    // Get the value parsed by each arg.
+    port = portArg.getValue();
+    xml_file = xmlArg.getValue();
+    opti_time = optiArg.getValue();
+    type = typeArg.getValue();
+    name = nameArg.getValue();
+    address = addressArg.getValue();
 #ifdef GL
-        media_path=mediaArg.getValue();
-        scene_file=sceneArg.getValue();
+    media_path = mediaArg.getValue();
+    scene_file = sceneArg.getValue();
 #endif
 
-	} catch (ArgException &e)  {
-	    cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
-    }
+  } catch(ArgException& e) {
+    cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+  }
 }
 
-int main(int argc, char* argv[]) {
-    Simulator *simu;
-    Model *drone;
-    SimuImu *imu;
-    SimuGps *gps;
+int main(int argc, char* argv[])
+{
+  Simulator* simu;
+  Model* drone;
+  SimuImu* imu;
+  SimuGps* gps;
 #ifdef GL
-    SimuUsGL *us_gl;
-    Parser *gui;
-    Man *man;
+  SimuUsGL* us_gl;
+  Parser* gui;
 #endif
-    parseOptions(argc,argv);
+  parseOptions(argc, argv);
 
-    simu= new Simulator("simulator",opti_time,0);
-    simu->SetupConnection(address,port);
-    simu->SetupUserInterface(xml_file);
+  simu = new Simulator("simulator", opti_time, 0);
+  simu->SetupConnection(address, port);
+  simu->SetupUserInterface(xml_file);
 
 #ifdef GL
-    gui=new Parser(simu,1024,768,1024,768,media_path,scene_file);
+  gui = new Parser(1024, 768, 1024, 768, media_path, scene_file);
 #endif
 
-    if(type=="x4") {
-        drone=new X4(simu,name,0);
-    } else {
-        drone=new X8(simu,name,0);
-    }
+  if(type == "x4") {
+    drone = new X4(name, 0);
+  } else {
+    drone = new X8(name, 0);
+  }
 
-    imu=new SimuImu(drone,"imu",90);
+  imu = new SimuImu(drone, "imu", 0,0);
 
 #ifdef GL
-    us_gl=new SimuUsGL(drone,"us",0);
-    man=new Man(simu,"target");
+  us_gl = new SimuUsGL(drone, "us", 0,0);
 #endif
-    gps=new SimuGps(drone,"gps",0);
+  gps = new SimuGps(drone, "gps", 0,0);
 
-    simu->RunSimu();
+  simu->RunSimu();
 
-    delete simu;
+  delete simu;
 
-	return 0;
+  return 0;
 }
-
Index: /trunk/demos/OpticalFlow/simulator/src/main.cpp
===================================================================
--- /trunk/demos/OpticalFlow/simulator/src/main.cpp	(revision 157)
+++ /trunk/demos/OpticalFlow/simulator/src/main.cpp	(revision 158)
@@ -23,5 +23,4 @@
 #endif
 
-
 using namespace TCLAP;
 using namespace std;
@@ -40,95 +39,90 @@
 void parseOptions(int argc, char** argv)
 {
-	try
-	{
-        CmdLine cmd("Command description message", ' ', "0.1");
+  try {
+    CmdLine cmd("Command description message", ' ', "0.1");
 
-        ValueArg<string> nameArg("n","name","uav name, also used for vrpn",true,"x4","string");
-        cmd.add( nameArg );
+    ValueArg<string> nameArg("n", "name", "uav name, also used for vrpn", true, "x4", "string");
+    cmd.add(nameArg);
 
-        ValueArg<string> xmlArg("x","xml","xml file",true,"./reglages.xml","string");
-        cmd.add( xmlArg );
+    ValueArg<string> xmlArg("x", "xml", "xml file", true, "./reglages.xml", "string");
+    cmd.add(xmlArg);
 
-        ValueArg<int> portArg("p","port","ground station port",true,9002,"int");
-        cmd.add( portArg );
+    ValueArg<int> portArg("p", "port", "ground station port", true, 9002, "int");
+    cmd.add(portArg);
 
-        ValueArg<string> addressArg("a","address","ground station address",true,"127.0.0.1","string");
-        cmd.add( addressArg );
+    ValueArg<string> addressArg("a", "address", "ground station address", true, "127.0.0.1", "string");
+    cmd.add(addressArg);
 
-        ValueArg<string> typeArg("t","type","uav type, x4 or x8",true,"x4","string");
-        cmd.add( typeArg );
+    ValueArg<string> typeArg("t", "type", "uav type, x4 or x8", true, "x4", "string");
+    cmd.add(typeArg);
 
-
-        ValueArg<int> optiArg("o","opti","optitrack time ms",false,0,"int");
-        cmd.add( optiArg );
+    ValueArg<int> optiArg("o", "opti", "optitrack time ms", false, 0, "int");
+    cmd.add(optiArg);
 
 #ifdef GL
-        ValueArg<string> mediaArg("m","media","path to media files",true,"./","string");
-        cmd.add( mediaArg );
+    ValueArg<string> mediaArg("m", "media", "path to media files", true, "./", "string");
+    cmd.add(mediaArg);
 
-        ValueArg<string> sceneArg("s","scene","path to scene file",true,"./voliere.xml","string");
-        cmd.add( sceneArg );
+    ValueArg<string> sceneArg("s", "scene", "path to scene file", true, "./voliere.xml", "string");
+    cmd.add(sceneArg);
 #endif
 
-        cmd.parse( argc, argv );
+    cmd.parse(argc, argv);
 
-        // Get the value parsed by each arg.
-        port=portArg.getValue();
-        xml_file = xmlArg.getValue();
-        opti_time = optiArg.getValue();
-        type = typeArg.getValue();
-        name=nameArg.getValue();
-        address=addressArg.getValue();
+    // Get the value parsed by each arg.
+    port = portArg.getValue();
+    xml_file = xmlArg.getValue();
+    opti_time = optiArg.getValue();
+    type = typeArg.getValue();
+    name = nameArg.getValue();
+    address = addressArg.getValue();
 #ifdef GL
-        media_path=mediaArg.getValue();
-        scene_file=sceneArg.getValue();
+    media_path = mediaArg.getValue();
+    scene_file = sceneArg.getValue();
 #endif
 
-	} catch (ArgException &e)  // catch any exceptions
-	{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
+  } catch(ArgException& e) // catch any exceptions
+  {
+    cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
+  }
 }
-
 
 int main(int argc, char* argv[])
 {
-    Simulator *simu;
-    Model *drone;
-    SimuImu* imu;
+  Simulator* simu;
+  Model* drone;
+  SimuImu* imu;
 #ifdef GL
-    SimuUsGL* us_gl;
+  SimuUsGL* us_gl;
 
-    SimuCameraGL *cam_bas;
-    Parser *gui;
+  SimuCameraGL* cam_bas;
+  Parser* gui;
 #endif
-    parseOptions(argc,argv);
+  parseOptions(argc, argv);
 
-    simu= new Simulator("simulator",opti_time,90);
-    simu->SetupConnection(address,port);
-    simu->SetupUserInterface(xml_file);
+  simu = new Simulator("simulator", opti_time, 90);
+  simu->SetupConnection(address, port);
+  simu->SetupUserInterface(xml_file);
 
 #ifdef GL
-    gui=new Parser(simu,960,480,640,480,media_path,scene_file);
+  gui = new Parser(960, 480, 640, 480, media_path, scene_file);
 #endif
 
-    if(type=="x4")
-    {
-        drone=new X4(simu,name,0);
-    }
-    else
-    {
-        drone=new X8(simu,name,0);
-    }
-    imu=new SimuImu(drone,"imu",0);
+  if(type == "x4") {
+    drone = new X4(name, 0);
+  } else {
+    drone = new X8(name, 0);
+  }
+  imu = new SimuImu(drone, "imu", 0,0);
 
 #ifdef GL
-    us_gl=new SimuUsGL(drone,"us",0);
-    cam_bas=new SimuCameraGL(drone,"bottom camera",320,240,640,0,0);
+  us_gl = new SimuUsGL(drone, "us", 0,0);
+  cam_bas = new SimuCameraGL(drone, "bottom camera", 320, 240, 640, 0, 0,0);
 #endif
 
-    simu->RunSimu();
+  simu->RunSimu();
 
-    delete simu;
+  delete simu;
 
-	return 0;
+  return 0;
 }
-
Index: /trunk/demos/SimpleFleet/simulator/src/main.cpp
===================================================================
--- /trunk/demos/SimpleFleet/simulator/src/main.cpp	(revision 157)
+++ /trunk/demos/SimpleFleet/simulator/src/main.cpp	(revision 158)
@@ -84,28 +84,27 @@
 int main(int argc, char* argv[])
 {
-    Simulator *simu;
+  Simulator *simu;
 
-    parseOptions(argc,argv);
+  parseOptions(argc,argv);
 
-    simu= new Simulator("simulator",opti_time,90);
-    simu->SetupConnection(address,port);
-    simu->SetupUserInterface(xml_file);
+  simu= new Simulator("simulator",opti_time,90);
+  simu->SetupConnection(address,port);
+  simu->SetupUserInterface(xml_file);
+  #ifdef GL
+  Parser *gui=new Parser(1024,768,1024,768,media_path,scene_file);
+  #endif
+  for(int i=0; i<2;i++) {
+    stringstream uavName;
+    uavName << name.c_str() << "_" << i;
+    Model *drone=new X8(uavName.str(),i);
 #ifdef GL
-    Parser *gui=new Parser(simu,640,480,640,480,media_path,scene_file);
+    SimuUsGL *us_gl=new SimuUsGL(drone,"us",i,0);
 #endif
-    for(int i=0; i<2;i++)
-	{
-		stringstream s;
-		s << name.c_str() << "_" << i;
-        Model *drone=new X8(simu,s.str(),i);
-#ifdef GL
-        SimuUsGL *us_gl=new SimuUsGL(drone,"us",i);
-#endif
-        SimuImu *imu=new SimuImu(drone,"imu",i);
-	}
+    SimuImu *imu=new SimuImu(drone,"imu",i,0);
+  }
 
-    simu->RunSimu();
+  simu->RunSimu();
 
-    delete simu;
+  delete simu;
 
 	return 0;
Index: /trunk/demos/SimpleFleet/uav/build_x86_64/bin/setup_x8.xml
===================================================================
--- /trunk/demos/SimpleFleet/uav/build_x86_64/bin/setup_x8.xml	(revision 157)
+++ /trunk/demos/SimpleFleet/uav/build_x86_64/bin/setup_x8.xml	(revision 158)
@@ -135,5 +135,5 @@
     </DataPlot1D>
    </Tab>
-  </TabWidget>
+  <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>
  </Tab>
  <Tab name="battery">
@@ -340,3 +340,3 @@
  </Tab>
 </TabWidget>
-<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>
+<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>
Index: /trunk/lib/FlairFilter/src/SimuAhrs.cpp
===================================================================
--- /trunk/lib/FlairFilter/src/SimuAhrs.cpp	(revision 157)
+++ /trunk/lib/FlairFilter/src/SimuAhrs.cpp	(revision 158)
@@ -27,7 +27,7 @@
 namespace filter {
 
-SimuAhrs::SimuAhrs(string name, uint32_t dev_id,
+SimuAhrs::SimuAhrs(string name, uint32_t modelId,uint32_t deviceId,
                    uint8_t priority)
-    : Ahrs(new SimuImu(name, dev_id, priority), name) {
+    : Ahrs(new SimuImu(name, modelId,deviceId, priority), name) {
   SetIsReady(true);
 }
Index: /trunk/lib/FlairFilter/src/SimuAhrs.h
===================================================================
--- /trunk/lib/FlairFilter/src/SimuAhrs.h	(revision 157)
+++ /trunk/lib/FlairFilter/src/SimuAhrs.h	(revision 158)
@@ -33,9 +33,10 @@
   *
   * \param name name
-  * \param dev_id number id of the simulated Ahrs
+  * \param modelId Model id
+  * \param deviceId Ahrs id of the Model
   * \param priority priority of the SimuImu Thread
   */
   SimuAhrs(std::string name,
-           uint32_t dev_id, uint8_t priority);
+           uint32_t modelId,uint32_t deviceId, uint8_t priority);
 
   /*!
Index: /trunk/lib/FlairMeta/src/SimuX4.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 157)
+++ /trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 158)
@@ -38,5 +38,5 @@
 namespace meta {
 
-SimuX4::SimuX4(string name, int simu_id,string options,
+SimuX4::SimuX4(string name, uint32_t simu_id,string options,
                filter::UavMultiplex *multiplex)
     : Uav(name, multiplex) {
@@ -46,7 +46,7 @@
 
   SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
-                       "motors", GetUavMultiplex()->MotorsCount(), simu_id));
-  SetUsRangeFinder(new SimuUs("us", simu_id, 60));
-  SetAhrs(new SimuAhrs("imu", simu_id, 70));
+                       "motors", GetUavMultiplex()->MotorsCount(), simu_id,0));
+  SetUsRangeFinder(new SimuUs("us", simu_id,0, 60));
+  SetAhrs(new SimuAhrs("imu", simu_id, 0,70));
   Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
   SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
@@ -59,6 +59,6 @@
 	}
   
-  SetVerticalCamera(
-      new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id, 10));
+  SetVerticalCamera(new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id,0, 10));
+  //SetHorizontalCamera(new SimuCamera("simu_cam_h", 320, 240, 3, simu_id,1, 10));
 }
 
Index: /trunk/lib/FlairMeta/src/SimuX4.h
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX4.h	(revision 157)
+++ /trunk/lib/FlairMeta/src/SimuX4.h	(revision 158)
@@ -26,5 +26,5 @@
   // simu_id: 0 if simulating only one UAV
   //>0 otherwise
-  SimuX4(std::string name, int simu_id = 0,std::string options="",
+  SimuX4(std::string name, uint32_t simu_id = 0,std::string options="",
          filter::UavMultiplex *multiplex = NULL);
   ~SimuX4();
Index: /trunk/lib/FlairMeta/src/SimuX8.cpp
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 157)
+++ /trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 158)
@@ -37,5 +37,5 @@
 namespace meta {
 
-SimuX8::SimuX8(string name, int simu_id,string options,
+SimuX8::SimuX8(string name, uint32_t simu_id,string options,
                filter::UavMultiplex *multiplex)
     : Uav(name, multiplex) {
@@ -45,12 +45,12 @@
 
   SetBldc(new SimuBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
-                       "motors", GetUavMultiplex()->MotorsCount(), simu_id));
-  SetUsRangeFinder(new SimuUs("us", simu_id, 60));
-  SetAhrs(new SimuAhrs("imu", simu_id, 70));
+                       "motors", GetUavMultiplex()->MotorsCount(), simu_id,0));
+  SetUsRangeFinder(new SimuUs("us", simu_id,0, 60));
+  SetAhrs(new SimuAhrs("imu", simu_id, 0,70));
   Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
   SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
   GetBatteryMonitor()->SetBatteryValue(12);
-  SetVerticalCamera(
-      new SimuCamera("simu_cam_v", 320, 240, 3, simu_id, 10));
+  SetVerticalCamera(new SimuCamera("simu_cam_v", 320, 240, 3, simu_id,0, 10));
+  //SetHorizontalCamera(new SimuCamera("simu_cam_h", 320, 240, 3, simu_id,1, 10));
 }
 
Index: /trunk/lib/FlairMeta/src/SimuX8.h
===================================================================
--- /trunk/lib/FlairMeta/src/SimuX8.h	(revision 157)
+++ /trunk/lib/FlairMeta/src/SimuX8.h	(revision 158)
@@ -26,5 +26,5 @@
   // simu_id: 0 if simulating only one UAV
   //>0 otherwise
-  SimuX8(std::string name, int simu_id = 0,std::string options="",
+  SimuX8(std::string name, uint32_t simu_id = 0,std::string options="",
          filter::UavMultiplex *multiplex = NULL);
   ~SimuX8();
Index: /trunk/lib/FlairSensorActuator/src/SimuBldc.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuBldc.cpp	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuBldc.cpp	(revision 158)
@@ -33,10 +33,8 @@
 
 SimuBldc::SimuBldc(const IODevice *parent, Layout *layout, string name,
-                   uint8_t motors_count, uint32_t dev_id)
+                   uint8_t motors_count, uint32_t modelId,uint32_t deviceId)
     : Bldc(parent, layout, name, motors_count) {
-  ostringstream dev_name;
-  dev_name << "simu_bldc_" << dev_id;
   shmem =
-      new SharedMem(this, dev_name.str().c_str(), motors_count * sizeof(float));
+      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float));
 
   GroupBox *groupbox = new GroupBox(layout->NewRow(), "simubldc");
@@ -47,10 +45,8 @@
 
 SimuBldc::SimuBldc(const Object *parent, string name, uint8_t motors_count,
-                   uint32_t dev_id)
+                   uint32_t modelId,uint32_t deviceId)
     : Bldc(parent, name, motors_count) {
-  ostringstream dev_name;
-  dev_name << "simu_bldc_" << dev_id;
   shmem =
-      new SharedMem(this, dev_name.str().c_str(), motors_count * sizeof(float));
+      new SharedMem(this, ShMemName(modelId, deviceId), motors_count * sizeof(float));
 
   // reset values
@@ -65,4 +61,10 @@
 
 SimuBldc::~SimuBldc() {}
+
+string SimuBldc::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_bldc_" << deviceId;
+  return dev_name.str().c_str();
+}
 
 void SimuBldc::SetMotors(float *value) {
Index: /trunk/lib/FlairSensorActuator/src/SimuBldc.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuBldc.h	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuBldc.h	(revision 158)
@@ -46,8 +46,9 @@
   * \param name name
   * \param motors_count number of motors
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId Bldc id of the Model
   */
   SimuBldc(const core::IODevice *parent, gui::Layout *layout, std::string name,
-           uint8_t motors_count, uint32_t dev_id);
+           uint8_t motors_count, uint32_t modelId,uint32_t deviceId);
 
   /*!
@@ -59,8 +60,9 @@
   * \param name name
   * \param motors_count number of motors
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId Bldc id of the Model
   */
   SimuBldc(const core::Object *parent, std::string name, uint8_t motors_count,
-           uint32_t dev_id);
+           uint32_t modelId,uint32_t deviceId);
 
   /*!
@@ -107,5 +109,6 @@
   */
   void SetMotors(float *value);
-
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
   core::SharedMem *shmem;
   gui::DoubleSpinBox *k;
Index: /trunk/lib/FlairSensorActuator/src/SimuCamera.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuCamera.cpp	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuCamera.cpp	(revision 158)
@@ -33,5 +33,5 @@
 SimuCamera::SimuCamera(string name,
                        uint16_t width, uint16_t height, uint8_t channels,
-                       uint32_t dev_id, uint8_t priority)
+                       uint32_t modelId,uint32_t deviceId, uint8_t priority)
     : Thread(getFrameworkManager(), name, priority),
       Camera(name, width, height, cvimage::Type::Format::BGR) {
@@ -43,6 +43,6 @@
 
   ostringstream dev_name;
-  dev_name << "simu_cam_" << dev_id;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), buf_size, SharedMem::Type::producerConsumer);
+  dev_name << "simu" <<  modelId << "_cam_" << deviceId;
+  shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId), buf_size, SharedMem::Type::producerConsumer);
   
   SetIsReady(true);
@@ -51,12 +51,10 @@
 //simulation part
 SimuCamera::SimuCamera(const IODevice *parent, string name, uint16_t width,
-                       uint16_t height, uint8_t channels, uint32_t dev_id)
+                       uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId)
     : Thread(parent, name, 0), Camera(parent,name) {
 
   buf_size = width * height * channels+sizeof(Time);
   
-  ostringstream dev_name;
-  dev_name << "simu_cam_" << dev_id;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+  shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId),
                         buf_size, SharedMem::Type::producerConsumer);
   shmemReadBuf=NULL;
@@ -69,4 +67,10 @@
   Join();
   if(shmemReadBuf!=NULL) delete shmemReadBuf;
+}
+
+string SimuCamera::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_cam_" << deviceId;
+  return dev_name.str().c_str();
 }
 
Index: /trunk/lib/FlairSensorActuator/src/SimuCamera.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuCamera.h	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuCamera.h	(revision 158)
@@ -42,9 +42,10 @@
   * \param height height
   * \param channels number of channels
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId Camera id of the Model
   * \param priority priority of the Thread
   */
   SimuCamera(std::string name,
-             uint16_t width, uint16_t height, uint8_t channels, uint32_t dev_id,
+             uint16_t width, uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId,
              uint8_t priority);
 
@@ -60,8 +61,9 @@
   * \param height height
   * \param channels number of channels
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId Camera id of the Model
   */
   SimuCamera(const core::IODevice *parent, std::string name, uint16_t width,
-             uint16_t height, uint8_t channels, uint32_t dev_id);
+             uint16_t height, uint8_t channels, uint32_t modelId,uint32_t deviceId);
 
   /*!
@@ -95,4 +97,6 @@
   */
   void UpdateFrom(const core::io_data *data){};
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
 
   size_t buf_size;
Index: /trunk/lib/FlairSensorActuator/src/SimuGps.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuGps.cpp	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuGps.cpp	(revision 158)
@@ -39,5 +39,5 @@
 
 SimuGps::SimuGps(string name,
-                 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t deviceId,uint8_t priority)
+                 NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority)
     : NmeaGps(name, NMEAFlags),Thread(getFrameworkManager(), name, priority) {
 
@@ -49,7 +49,5 @@
   numberOfSatellites = new SpinBox(GetGroupBox()->NewRow(), "number of satellites", 1, 15, 1, 5);
 
-  ostringstream dev_name;
-  dev_name << "simu_gps_" << deviceId;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
                         sizeof(gps_states_t));
                         
@@ -58,11 +56,9 @@
 
 
-SimuGps::SimuGps(const IODevice *parent, string name, uint32_t deviceId)
+SimuGps::SimuGps(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId)
     : NmeaGps(parent, name), Thread(parent, name, 0) {
   dataRate = NULL;
 
-  ostringstream dev_name;
-  dev_name << "simu_gps_" << deviceId;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+  shmem = new SharedMem((Thread *)this,ShMemName(modelId, deviceId),
                         sizeof(gps_states_t));
   
@@ -73,4 +69,10 @@
   SafeStop();
   Join();
+}
+
+string SimuGps::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_gps_" << deviceId;
+  return dev_name.str().c_str();
 }
 
Index: /trunk/lib/FlairSensorActuator/src/SimuGps.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuGps.h	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuGps.h	(revision 158)
@@ -43,9 +43,10 @@
   * \param name name
   * \param NMEAFlags NMEA sentances to enable
-  * \param deviceId device id
+  * \param modelId Model id
+  * \param deviceId Gps id of the Model
   * \param priority priority of the Thread
   */
   SimuGps(std::string name,
-          NmeaGps::NMEAFlags_t NMEAFlags, uint32_t deviceId,uint8_t priority);
+          NmeaGps::NMEAFlags_t NMEAFlags, uint32_t modelId,uint32_t deviceId,uint8_t priority);
 
   /*!
@@ -57,7 +58,8 @@
   * \param parent parent
   * \param name name
-  * \param deviceId device id
+  * \param modelId Model id
+  * \param deviceId Gps id of the Model
   */
-  SimuGps(const core::IODevice *parent, std::string name, uint32_t deviceId);
+  SimuGps(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId);
 
   /*!
@@ -92,4 +94,6 @@
     float vn;
   } gps_states_t;
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
 
   core::SharedMem *shmem;
Index: /trunk/lib/FlairSensorActuator/src/SimuImu.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuImu.cpp	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuImu.cpp	(revision 158)
@@ -34,5 +34,5 @@
 namespace sensor {
 
-SimuImu::SimuImu(string name, uint32_t dev_id,
+SimuImu::SimuImu(string name, uint32_t modelId,uint32_t deviceId,
                  uint8_t priority)
     : Imu(name), Thread(getFrameworkManager(), name, priority) {
@@ -40,19 +40,15 @@
       new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 200);
   ahrsData = new AhrsData((Imu *)this);
-
-  ostringstream dev_name;
-  dev_name << "simu_imu_" << dev_id;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+  
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
                         sizeof(imu_states_t));
   SetIsReady(true);
 }
 
-SimuImu::SimuImu(const IODevice *parent, string name, uint32_t dev_id)
+SimuImu::SimuImu(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId)
     : Imu(parent,name), Thread(parent, name, 0) {
   dataRate = NULL;
 
-  ostringstream dev_name;
-  dev_name << "simu_imu_" << dev_id;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
                         sizeof(imu_states_t));
   SetIsReady(true);
@@ -62,4 +58,10 @@
   SafeStop();
   Join();
+}
+
+string SimuImu::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_imu_" << deviceId;
+  return dev_name.str().c_str();
 }
 
Index: /trunk/lib/FlairSensorActuator/src/SimuImu.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuImu.h	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuImu.h	(revision 158)
@@ -42,9 +42,10 @@
   *
   * \param name name
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId Imu id of the Model
   * \param priority priority of the Thread
   */
   SimuImu(std::string name,
-          uint32_t dev_id, uint8_t priority);
+          uint32_t modelId,uint32_t deviceId, uint8_t priority);
 
   /*!
@@ -56,7 +57,8 @@
   * \param parent parent
   * \param name name
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId Imu id of the Model
   */
-  SimuImu(const core::IODevice *parent, std::string name, uint32_t dev_id);
+  SimuImu(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId);
 
   /*!
@@ -93,4 +95,6 @@
     float wz;
   } imu_states_t;
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
 
   gui::SpinBox *dataRate;
Index: /trunk/lib/FlairSensorActuator/src/SimuLaser.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuLaser.cpp	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuLaser.cpp	(revision 158)
@@ -33,23 +33,19 @@
 
 SimuLaser::SimuLaser(string name,
-                     uint32_t dev_id, uint8_t priority)
+                     uint32_t modelId,uint32_t deviceId, uint8_t priority)
     : Thread(getFrameworkManager(), name, priority), LaserRangeFinder(name) {
   data_rate =
       new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
 
-  ostringstream dev_name;
-  dev_name << "simu_Laser_" << dev_id;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
                         360 * sizeof(float));
   SetIsReady(true);
 }
 
-SimuLaser::SimuLaser(const IODevice *parent, string name, uint32_t dev_id)
+SimuLaser::SimuLaser(const IODevice *parent, string name, uint32_t modelId,uint32_t deviceId)
     : Thread(parent, name, 0), LaserRangeFinder(parent, name) {
   data_rate = NULL;
 
-  ostringstream dev_name;
-  dev_name << "simu_Laser_" << dev_id;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(),
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId),
                         360 * sizeof(float));
   SetIsReady(true);
@@ -59,4 +55,10 @@
   SafeStop();
   Join();
+}
+
+string SimuLaser::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_laser_" << deviceId;
+  return dev_name.str().c_str();
 }
 
Index: /trunk/lib/FlairSensorActuator/src/SimuLaser.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuLaser.h	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuLaser.h	(revision 158)
@@ -41,9 +41,10 @@
   *
   * \param name name
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId LaserRangeFinder id of the Model
   * \param priority priority of the Thread
   */
   SimuLaser(std::string name,
-            uint32_t dev_id, uint8_t priority);
+            uint32_t modelId,uint32_t deviceId, uint8_t priority);
 
   /*!
@@ -55,7 +56,8 @@
   * \param parent parent
   * \param name name
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId LaserRangeFinder id of the Model
   */
-  SimuLaser(const core::IODevice *parent, std::string name, uint32_t dev_id);
+  SimuLaser(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId);
 
   /*!
@@ -89,5 +91,6 @@
   */
   void Run(void);
-
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
   gui::SpinBox *data_rate;
 };
Index: /trunk/lib/FlairSensorActuator/src/SimuUs.cpp
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuUs.cpp	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuUs.cpp	(revision 158)
@@ -32,5 +32,5 @@
 namespace sensor {
 
-SimuUs::SimuUs(string name, uint32_t dev_id,
+SimuUs::SimuUs(string name, uint32_t modelId,uint32_t deviceId,
                uint8_t priority)
     : Thread(getFrameworkManager(), name, priority), UsRangeFinder( name) {
@@ -38,18 +38,14 @@
       new SpinBox(GetGroupBox()->NewRow(), "data rate", " Hz", 1, 500, 1, 50);
 
-  ostringstream dev_name;
-  dev_name << "simu_us_" << dev_id;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), sizeof(float));
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float));
 
   SetIsReady(true);
 }
 
-SimuUs::SimuUs(const IODevice *parent, string name, uint32_t dev_id)
+SimuUs::SimuUs(const IODevice *parent, string name,uint32_t modelId,uint32_t deviceId)
     : Thread(parent, name, 0), UsRangeFinder(parent,name) {
   data_rate = NULL;
 
-  ostringstream dev_name;
-  dev_name << "simu_us_" << dev_id;
-  shmem = new SharedMem((Thread *)this, dev_name.str().c_str(), sizeof(float));
+  shmem = new SharedMem((Thread *)this, ShMemName(modelId, deviceId), sizeof(float));
   
   SetIsReady(true);
@@ -59,4 +55,10 @@
   SafeStop();
   Join();
+}
+
+string SimuUs::ShMemName(uint32_t modelId,uint32_t deviceId) {
+  ostringstream dev_name;
+  dev_name << "simu" <<  modelId << "_us_" << deviceId;
+  return dev_name.str().c_str();
 }
 
Index: /trunk/lib/FlairSensorActuator/src/SimuUs.h
===================================================================
--- /trunk/lib/FlairSensorActuator/src/SimuUs.h	(revision 157)
+++ /trunk/lib/FlairSensorActuator/src/SimuUs.h	(revision 158)
@@ -41,9 +41,10 @@
   *
   * \param name name
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId UsRangeFinder id of the Model
   * \param priority priority of the Thread
   */
   SimuUs(std::string name,
-         uint32_t dev_id, uint8_t priority);
+         uint32_t modelId,uint32_t deviceId, uint8_t priority);
 
   /*!
@@ -55,7 +56,8 @@
   * \param parent parent
   * \param name name
-  * \param dev_id device id
+  * \param modelId Model id
+  * \param deviceId UsRangeFinder id of the Model
   */
-  SimuUs(const core::IODevice *parent, std::string name, uint32_t dev_id);
+  SimuUs(const core::IODevice *parent, std::string name, uint32_t modelId,uint32_t deviceId);
 
   /*!
@@ -89,5 +91,6 @@
   */
   void Run(void);
-
+  
+  std::string ShMemName(uint32_t modelId,uint32_t deviceId);
   gui::SpinBox *data_rate;
 };
Index: /trunk/lib/FlairSimulator/src/Castle.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/Castle.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Castle.cpp	(revision 158)
@@ -17,5 +17,4 @@
 
 #include "Castle.h"
-#include "Simulator.h"
 #include <IrrlichtDevice.h>
 #include <IFileSystem.h>
@@ -27,7 +26,7 @@
 namespace simulator {
 
-Castle::Castle(const Simulator *parent, int app_width, int app_height,
+Castle::Castle(int app_width, int app_height,
                int scene_width, int scene_height, std::string media_path)
-    : Gui(parent, "Castle", app_width, app_height, scene_width, scene_height,
+    : Gui("Castle", app_width, app_height, scene_width, scene_height,
           media_path) {
   // carte
Index: /trunk/lib/FlairSimulator/src/Castle.h
===================================================================
--- /trunk/lib/FlairSimulator/src/Castle.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Castle.h	(revision 158)
@@ -23,5 +23,5 @@
 class Castle : public Gui {
 public:
-  Castle(const flair::simulator::Simulator *parent, int app_width,
+  Castle(int app_width,
          int app_height, int scene_width, int scene_height,
          std::string media_path);
Index: /trunk/lib/FlairSimulator/src/GenericObject.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/GenericObject.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/GenericObject.cpp	(revision 158)
@@ -37,5 +37,5 @@
 namespace simulator {
 
-GenericObject::GenericObject(Simulator *parent, IMesh *mesh)
+GenericObject::GenericObject(IMesh *mesh)
 {
 	meshSceneNode=getGui()->getSceneManager()->addMeshSceneNode(mesh);
@@ -46,5 +46,5 @@
   meshSceneNode->setMaterialFlag(EMF_LIGHTING, false);
 
-  parent->pimpl_->objects.push_back(this);
+  getSimulator()->pimpl_->objects.push_back(this);
 }
 
Index: /trunk/lib/FlairSimulator/src/Gui.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/Gui.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Gui.cpp	(revision 158)
@@ -133,8 +133,8 @@
 }
 
-Gui::Gui(const Simulator *parent, std::string name, int app_width,
+Gui::Gui(std::string name, int app_width,
          int app_height, int scene_width, int scene_height,
          std::string media_path, E_DRIVER_TYPE driver_type)
-    : Object(parent, name, "Gui") {
+    : Object(getSimulator(), name, "Gui") {
   if (gui_ != NULL)
     Err("Gui should be instanced only one time\n");
Index: /trunk/lib/FlairSimulator/src/Gui.h
===================================================================
--- /trunk/lib/FlairSimulator/src/Gui.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Gui.h	(revision 158)
@@ -48,5 +48,4 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 
 class Gui: public core::Object {
@@ -55,5 +54,5 @@
 
 public:
-  Gui(const Simulator *parent, std::string name, int app_width, int app_height,
+  Gui(std::string name, int app_width, int app_height,
       int scene_width, int scene_height, std::string media_path,
       irr::video::E_DRIVER_TYPE driver_type = irr::video::EDT_OPENGL);
Index: /trunk/lib/FlairSimulator/src/Man.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/Man.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Man.cpp	(revision 158)
@@ -18,6 +18,4 @@
 #include "Man.h"
 #include "Gui.h"
-#include "Simulator.h"
-#include "Simulator_impl.h"
 #include "Euler.h"
 #include <ISceneManager.h>
@@ -38,5 +36,5 @@
 namespace simulator {
 
-Man::Man(const Simulator *parent, std::string name) : Model(parent, name) {
+Man::Man(std::string name,uint32_t modelId) : Model(name,modelId) {
   node = getGui()->getSceneManager()->addAnimatedMeshSceneNode(
       getGui()->getMesh("ninja.b3d"), getSceneNode(), -1, vector3df(0, 0, 0),
Index: /trunk/lib/FlairSimulator/src/Man.h
===================================================================
--- /trunk/lib/FlairSimulator/src/Man.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Man.h	(revision 158)
@@ -34,9 +34,8 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 
 class Man : private Model {
 public:
-  Man(const Simulator *parent, std::string name);
+  Man(std::string name,uint32_t modelId);
   ~Man();
 
Index: /trunk/lib/FlairSimulator/src/Model.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/Model.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Model.cpp	(revision 158)
@@ -18,10 +18,8 @@
 #include "Model_impl.h"
 #include "Simulator.h"
-#include "Simulator_impl.h"
 #include <DoubleSpinBox.h>
 
 #ifdef GL
 #include "FollowMeCamera.h"
-#include "Gui.h"
 #include <ICameraSceneNode.h>
 using namespace irr;
@@ -36,13 +34,7 @@
 namespace simulator {
 
-Model::Model(const Simulator *parent, std::string name)
-    : IODevice(parent, name) {
-#ifdef GL
-  pimpl_ =
-      new Model_impl(this, name, getGui()->getSceneManager(), parent->pimpl_);
-#else
-  pimpl_ = new Model_impl(this, name, parent->pimpl_);
-#endif
-  parent->pimpl_->models.push_back(this);
+Model::Model(std::string name,uint32_t modelId)
+    : IODevice(getSimulator(), name) {
+  pimpl_ = new Model_impl(this, name,modelId);
 }
 
@@ -79,4 +71,8 @@
 float Model::dT(void) const { return pimpl_->dT->Value(); }
 
+int Model::GetId(void) const {
+  return pimpl_->modelId;
+}
+
 } // end namespace simulator
 } // end namespace flair
Index: /trunk/lib/FlairSimulator/src/Model.h
===================================================================
--- /trunk/lib/FlairSimulator/src/Model.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Model.h	(revision 158)
@@ -51,5 +51,4 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 class FollowMeCamera;
 
@@ -65,5 +64,5 @@
 
 public:
-  Model(const Simulator *parent, std::string name);
+  Model(std::string name,uint32_t modelId);
   virtual ~Model();
 
@@ -93,4 +92,5 @@
 #endif
   gui::TabWidget *GetTabWidget(void) const;
+  int GetId(void) const;
 
 protected:
Index: /trunk/lib/FlairSimulator/src/Model_impl.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Model_impl.cpp	(revision 158)
@@ -18,4 +18,5 @@
 #include "Model_impl.h"
 #include "Simulator.h"
+#include "Simulator_impl.h"
 #include "TabWidget.h"
 #include "Tab.h"
@@ -51,15 +52,15 @@
 
 #ifdef GL
-Model_impl::Model_impl(Model *self, std::string name,
-                       ISceneManager *scenemanager, vrpn_Connection_IP *vrpn)
-    : ISceneNode(scenemanager->getRootSceneNode(), scenemanager, -1),
-      Thread(self, name, 50), vrpn_Tracker(name.c_str(), vrpn)
+Model_impl::Model_impl(Model *self, std::string name,uint32_t modelId)
+    : ISceneNode(getGui()->getSceneManager()->getRootSceneNode(), getGui()->getSceneManager(), -1),
+      Thread(self, name, 50), vrpn_Tracker(name.c_str(), getSimulator()->pimpl_)
 
 #else
-Model_impl::Model_impl(Model *self, std::string name, vrpn_Connection_IP *vrpn)
-    : Thread(self, name, 50), vrpn_Tracker(name.c_str(), vrpn)
+Model_impl::Model_impl(Model *self, std::string name,uint32_t modelId)
+    : Thread(self, name, 50), vrpn_Tracker(name.c_str(), getSimulator()->pimpl_)
 #endif
 {
   this->self = self;
+  this->modelId=modelId;
 
 #ifdef GL
@@ -131,4 +132,6 @@
 
   self->AddDataToLog(output);
+  
+  getSimulator()->pimpl_->models.push_back(self);
 }
 
Index: /trunk/lib/FlairSimulator/src/Parser.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/Parser.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Parser.cpp	(revision 158)
@@ -40,11 +40,10 @@
 namespace flair {
 namespace simulator {
-Parser::Parser(Simulator *parent, int app_width, int app_height,
+Parser::Parser(int app_width, int app_height,
                int scene_width, int scene_height, std::string media_path,
                std::string xmlFile)
-    : Gui(parent, "Parser", app_width, app_height, scene_width, scene_height,
+    : Gui("Parser", app_width, app_height, scene_width, scene_height,
           media_path) {
   this->media_path = media_path;
-  this->parent = parent;
   xmlNode *root_element = NULL;
   doc = xmlReadFile(xmlFile.c_str(), NULL, 0);
@@ -121,5 +120,5 @@
       if (fp != NULL) {
         GenericObject *object =
-            new GenericObject(parent, getGui()->getMesh((char *)xmlGetProp(cur_node, (xmlChar *)"model")));
+            new GenericObject(getGui()->getMesh((char *)xmlGetProp(cur_node, (xmlChar *)"model")));
         object->setPosition(
             getMeshVect(cur_node->children, (xmlChar *)"position"));
@@ -140,5 +139,5 @@
           getScolor(cur_node->children));
           //SColor(100, 255, 100, 100));
-      GenericObject *object = new GenericObject(parent, mesh);
+      GenericObject *object = new GenericObject(mesh);
       object->setPosition(getMeshVect(cur_node->children, (xmlChar *)"position"));
       object->setRotation(getMeshVect(cur_node->children, (xmlChar *)"rotation"));
@@ -152,6 +151,5 @@
                     atof((char *)xmlGetProp(cur_node, (xmlChar *)"eight"))));
 			
-      GenericObject *object =
-          new GenericObject(parent, mesh);
+      GenericObject *object =new GenericObject(mesh);
       object->setPosition(
           getMeshVect(cur_node->children, (xmlChar *)"position"));
Index: /trunk/lib/FlairSimulator/src/Parser.h
===================================================================
--- /trunk/lib/FlairSimulator/src/Parser.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Parser.h	(revision 158)
@@ -39,5 +39,5 @@
   */
 public:
-  Parser(Simulator *parent, int app_width, int app_height, int scene_width,
+  Parser(int app_width, int app_height, int scene_width,
          int scene_height, std::string media_path, std::string xmlFile);
   ~Parser();
@@ -46,5 +46,4 @@
   xmlDoc *doc;
   std::string media_path;
-  Simulator *parent;
   void processElements(xmlNode *a_node);
   void processObjects(xmlNode *a_node);
Index: /trunk/lib/FlairSimulator/src/SimuCameraGL.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/SimuCameraGL.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/SimuCameraGL.cpp	(revision 158)
@@ -45,10 +45,10 @@
 
 SimuCameraGL::SimuCameraGL(const Model *parent, std::string name, int width,
-                           int height, int x, int y, int dev_id)
-    : SimuCamera(parent, name, width, height, 3, dev_id), SensorGL(parent) {
+                           int height, int x, int y, uint32_t modelId,uint32_t deviceId)
+    : SimuCamera(parent, name, width, height, 3, modelId,deviceId), SensorGL(parent) {
   smgr = getGui()->getSceneManager();
   camera = smgr->addCameraSceneNode();
   camera->addAnimator(this);
-  camera->setAspectRatio(4.0f / 3.0f); // on force a cause du view port
+  camera->setAspectRatio((float)width /(float)height); // on force a cause du view port
 
   this->width = width;
Index: /trunk/lib/FlairSimulator/src/SimuCameraGL.h
===================================================================
--- /trunk/lib/FlairSimulator/src/SimuCameraGL.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/SimuCameraGL.h	(revision 158)
@@ -51,5 +51,5 @@
   // top left origin
   SimuCameraGL(const simulator::Model *parent, std::string name, int width,
-               int height, int x, int y, int dev_id);
+               int height, int x, int y, uint32_t modelId,uint32_t deviceId);
   ~SimuCameraGL();
   //! Sets the value of the near clipping plane. (default: 1.0f)
Index: /trunk/lib/FlairSimulator/src/SimuLaserGL.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/SimuLaserGL.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/SimuLaserGL.cpp	(revision 158)
@@ -38,6 +38,6 @@
 namespace flair {
 namespace sensor {
-SimuLaserGL::SimuLaserGL(const Model *parent, std::string name, int dev_id)
-    : SimuLaser(parent, name, dev_id), SensorGL(parent) {
+SimuLaserGL::SimuLaserGL(const Model *parent, std::string name, uint32_t modelId,uint32_t deviceId)
+    : SimuLaser(parent, name, modelId,deviceId), SensorGL(parent) {
   Tab *setup_tab = new Tab(parent->GetTabWidget(), name);
   position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01);
Index: /trunk/lib/FlairSimulator/src/SimuLaserGL.h
===================================================================
--- /trunk/lib/FlairSimulator/src/SimuLaserGL.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/SimuLaserGL.h	(revision 158)
@@ -38,5 +38,5 @@
 class SimuLaserGL : public SimuLaser, public SensorGL {
 public:
-  SimuLaserGL(const simulator::Model *parent, std::string name, int dev_id);
+  SimuLaserGL(const simulator::Model *parent, std::string name, uint32_t modelId,uint32_t deviceId);
   ~SimuLaserGL();
 
Index: /trunk/lib/FlairSimulator/src/SimuUsGL.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/SimuUsGL.cpp	(revision 158)
@@ -38,6 +38,6 @@
 namespace flair {
 namespace sensor {
-SimuUsGL::SimuUsGL(const Model *parent, std::string name, int dev_id)
-    : SimuUs(parent, name, dev_id), SensorGL(parent) {
+SimuUsGL::SimuUsGL(const Model *parent, std::string name, uint32_t modelId,uint32_t deviceId)
+    : SimuUs(parent, name, modelId,deviceId), SensorGL(parent) {
   Tab *setup_tab = new Tab(parent->GetTabWidget(), name);
   position = new Vector3DSpinBox(setup_tab->NewRow(), "position", -2, 2, .01);
Index: /trunk/lib/FlairSimulator/src/SimuUsGL.h
===================================================================
--- /trunk/lib/FlairSimulator/src/SimuUsGL.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/SimuUsGL.h	(revision 158)
@@ -38,5 +38,5 @@
 class SimuUsGL : public SimuUs, public SensorGL {
 public:
-  SimuUsGL(const simulator::Model *parent, std::string name, int dev_id);
+  SimuUsGL(const simulator::Model *parent, std::string name, uint32_t modelId,uint32_t deviceId);
   ~SimuUsGL();
 
Index: /trunk/lib/FlairSimulator/src/Simulator.h
===================================================================
--- /trunk/lib/FlairSimulator/src/Simulator.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/Simulator.h	(revision 158)
@@ -22,4 +22,5 @@
 
 class Simulator_impl;
+class Model_impl;
 
 namespace flair {
@@ -36,5 +37,5 @@
 
 class Simulator : public core::FrameworkManager {
-  friend class Model;
+  friend class ::Model_impl;
   friend class Gui;
   friend class GenericObject;
Index: /trunk/lib/FlairSimulator/src/X4.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/X4.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/X4.cpp	(revision 158)
@@ -16,5 +16,4 @@
 
 #include "X4.h"
-#include "Simulator.h"
 #include <SimuBldc.h>
 #include <TabWidget.h>
@@ -46,6 +45,6 @@
 namespace simulator {
 
-X4::X4(const Simulator *parent, std::string name, int dev_id)
-    : Model(parent, name) {
+X4::X4(std::string name, uint32_t modelId)
+    : Model(name,modelId) {
   Tab *setup_tab = new Tab(GetTabWidget(), "model");
   m = new DoubleSpinBox(setup_tab->NewRow(), "mass (kg):", 0, 20, 0.1);
@@ -75,5 +74,5 @@
                             5); // moment d'inertie d'un axe (N.m.s²/rad)
 
-  motors = new SimuBldc(this, name, 4, dev_id);
+  motors = new SimuBldc(this, name, 4, modelId,0);
   
   SetIsReady(true);
@@ -96,27 +95,27 @@
 
   // cylinders are aligned with y axis
-  red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
-  black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
-  motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
+  IMesh *red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
+  IMesh *black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
+  IMesh *motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
   // geo->drop();
 
   ITexture *texture = getGui()->getTexture("carbone.jpg");
-  fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+  MeshSceneNode *fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, -135));
-  fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+  MeshSceneNode *fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, -45));
-  rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+  MeshSceneNode *rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, 135), texture);
-  rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+  MeshSceneNode *rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, 45), texture);
 
   texture = getGui()->getTexture("metal047.jpg");
-  fl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
+  MeshSceneNode *fl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
                                vector3df(90, 0, 0), texture);
-  fr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
+  MeshSceneNode *fr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
                                vector3df(90, 0, 0), texture);
-  rl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
+  MeshSceneNode *rl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
                                vector3df(90, 0, 0), texture);
-  rr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
+  MeshSceneNode *rr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
                                vector3df(90, 0, 0), texture);
 
Index: /trunk/lib/FlairSimulator/src/X4.h
===================================================================
--- /trunk/lib/FlairSimulator/src/X4.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/X4.h	(revision 158)
@@ -32,21 +32,11 @@
 }
 
-#ifdef GL
-namespace irr {
-namespace scene {
-class IMesh;
-}
-}
-#endif
-
 namespace flair {
 namespace simulator {
-class Simulator;
 class Blade;
-class MeshSceneNode;
 
 class X4 : public Model {
 public:
-  X4(const Simulator *parent, std::string name, int dev_id);
+  X4(std::string name, uint32_t modelId);
   ~X4();
 #ifdef GL
@@ -55,7 +45,4 @@
 
 protected:
-  irr::scene::IMesh *red_arm, *black_arm, *motor;
-  MeshSceneNode *fl_arm, *fr_arm, *rl_arm, *rr_arm;
-  MeshSceneNode *fl_motor, *fr_motor, *rl_motor, *rr_motor;
   Blade *fl_blade, *fr_blade, *rl_blade, *rr_blade;
   core::Mutex *motor_speed_mutex;
Index: /trunk/lib/FlairSimulator/src/X8.cpp
===================================================================
--- /trunk/lib/FlairSimulator/src/X8.cpp	(revision 157)
+++ /trunk/lib/FlairSimulator/src/X8.cpp	(revision 158)
@@ -16,5 +16,4 @@
 
 #include "X8.h"
-#include "Simulator.h"
 #include <SimuBldc.h>
 #include <TabWidget.h>
@@ -46,6 +45,5 @@
 namespace simulator {
 
-X8::X8(const Simulator *parent, std::string name, int dev_id)
-    : Model(parent, name) {
+X8::X8(std::string name, uint32_t modelId): Model( name,modelId) {
   Tab *setup_tab = new Tab(GetTabWidget(), "model");
   m = new DoubleSpinBox(setup_tab->NewRow(), "mass (kg):", 0, 20, 0.1);
@@ -84,5 +82,5 @@
       0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite)
 
-  motors = new SimuBldc(this, name, 8, dev_id);
+  motors = new SimuBldc(this, name, 8, modelId,0);
   
   SetIsReady(true);
@@ -101,36 +99,36 @@
 
   // cylinders are aligned with y axis
-  red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
-  black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
-  motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
+  IMesh *red_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 255, 0, 0));
+  IMesh *black_arm = geo->createCylinderMesh(2.5, 100, 16, SColor(0, 128, 128, 128));
+  IMesh *motor = geo->createCylinderMesh(7.5, 15, 16); //,SColor(0, 128, 128, 128));
   // geo->drop();
 
   ITexture *texture = getGui()->getTexture("carbone.jpg");
-  fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+  MeshSceneNode *fl_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, -135));
-  fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
+  MeshSceneNode *fr_arm = new MeshSceneNode(this, red_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, -45));
-  rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+  MeshSceneNode *rl_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, 135), texture);
-  rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
+  MeshSceneNode *rr_arm = new MeshSceneNode(this, black_arm, vector3df(0, 0, 0),
                              vector3df(0, 0, 45), texture);
 
   texture = getGui()->getTexture("metal047.jpg");
-  tfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
-                                vector3df(90, 0, 0), texture);
-  tfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
-                                vector3df(90, 0, 0), texture);
-  trl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
-                                vector3df(90, 0, 0), texture);
-  trr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
-                                vector3df(90, 0, 0), texture);
-
-  bfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, -17.5),
-                                vector3df(90, 0, 0), texture);
-  bfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, -17.5),
-                                vector3df(90, 0, 0), texture);
-  brl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, -17.5),
-                                vector3df(90, 0, 0), texture);
-  brr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, -17.5),
+  MeshSceneNode *tfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *tfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *trl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *trr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, 2.5),
+                                vector3df(90, 0, 0), texture);
+
+  MeshSceneNode *bfl_motor = new MeshSceneNode(this, motor, vector3df(70.71, -70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *bfr_motor = new MeshSceneNode(this, motor, vector3df(70.71, 70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *brl_motor = new MeshSceneNode(this, motor, vector3df(-70.71, -70.71, -17.5),
+                                vector3df(90, 0, 0), texture);
+  MeshSceneNode *brr_motor = new MeshSceneNode(this, motor, vector3df(-70.71, 70.71, -17.5),
                                 vector3df(90, 0, 0), texture);
 
Index: /trunk/lib/FlairSimulator/src/X8.h
===================================================================
--- /trunk/lib/FlairSimulator/src/X8.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/X8.h	(revision 158)
@@ -32,21 +32,11 @@
 }
 
-#ifdef GL
-namespace irr {
-namespace scene {
-class IMesh;
-}
-}
-#endif
-
 namespace flair {
 namespace simulator {
-class Simulator;
 class Blade;
-class MeshSceneNode;
 
 class X8 : public Model {
 public:
-  X8(const Simulator *parent, std::string name, int dev_id);
+  X8(std::string name, uint32_t modelId);
   ~X8();
   virtual void Draw(void);
@@ -55,8 +45,4 @@
 protected:
 #ifdef GL
-  irr::scene::IMesh *red_arm, *black_arm, *motor;
-  MeshSceneNode *fl_arm, *fr_arm, *rl_arm, *rr_arm;
-  MeshSceneNode *tfl_motor, *tfr_motor, *trl_motor, *trr_motor;
-  MeshSceneNode *bfl_motor, *bfr_motor, *brl_motor, *brr_motor;
   Blade *tfl_blade, *tfr_blade, *trl_blade, *trr_blade;
   Blade *bfl_blade, *bfr_blade, *brl_blade, *brr_blade;
Index: /trunk/lib/FlairSimulator/src/unexported/GenericObject.h
===================================================================
--- /trunk/lib/FlairSimulator/src/unexported/GenericObject.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/unexported/GenericObject.h	(revision 158)
@@ -34,5 +34,4 @@
 namespace flair {
 namespace simulator {
-class Simulator;
 
 class GenericObject {
@@ -40,5 +39,5 @@
 
 public:
-  GenericObject(Simulator *parent,irr::scene::IMesh *mesh);
+  GenericObject(irr::scene::IMesh *mesh);
   virtual ~GenericObject();
 
Index: /trunk/lib/FlairSimulator/src/unexported/Model_impl.h
===================================================================
--- /trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/unexported/Model_impl.h	(revision 158)
@@ -66,11 +66,5 @@
                    {
 public:
-#ifdef GL
-  Model_impl(flair::simulator::Model *self, std::string name,
-             irr::scene::ISceneManager *scenemanager, vrpn_Connection_IP *vrpn);
-#else
-  Model_impl(flair::simulator::Model *self, std::string name,
-             vrpn_Connection_IP *vrpn);
-#endif
+  Model_impl(flair::simulator::Model *self, std::string name,uint32_t modelId);
   ~Model_impl();
 
@@ -100,4 +94,5 @@
   flair::gui::TabWidget *tabwidget;
   flair::gui::DoubleSpinBox *dT;
+  int modelId;
 
 private:
Index: /trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h
===================================================================
--- /trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h	(revision 157)
+++ /trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h	(revision 158)
@@ -29,6 +29,8 @@
 }
 
+class Model_impl;
+
 class Simulator_impl : public vrpn_Connection_IP, private flair::core::Thread {
-  friend class flair::simulator::Model;
+  friend class ::Model_impl;
   friend class flair::simulator::GenericObject;
 
