Index: trunk/lib/FlairMeta/src/HdsX8.cpp
===================================================================
--- trunk/lib/FlairMeta/src/HdsX8.cpp	(revision 153)
+++ trunk/lib/FlairMeta/src/HdsX8.cpp	(revision 157)
@@ -35,5 +35,5 @@
 namespace meta {
 
-HdsX8::HdsX8(string name,
+HdsX8::HdsX8(string name,string options,
              filter::UavMultiplex *multiplex)
     : Uav(name, multiplex) {
@@ -56,9 +56,13 @@
 
 void HdsX8::StartSensors(void) {
-  ((Gx3_25_ahrs *)GetAhrs())->Start();
+  ((Gx3_25_imu *)(GetAhrs()->GetImu()))->Start();
   ((Srf08 *)GetUsRangeFinder())->Start();
   ((Ps3Eye *)GetVerticalCamera())->Start();
 }
 
+bool HdsX8::isReadyToFly(void) const {
+  return GetAhrs()->GetImu()->IsReady();
+}
+
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/HdsX8.h
===================================================================
--- trunk/lib/FlairMeta/src/HdsX8.h	(revision 153)
+++ trunk/lib/FlairMeta/src/HdsX8.h	(revision 157)
@@ -24,9 +24,10 @@
 class HdsX8 : public Uav {
 public:
-  HdsX8(std::string name,
+  HdsX8(std::string name,std::string options="",
         filter::UavMultiplex *multiplex = NULL);
   ~HdsX8();
   void StartSensors(void);
 	std::string GetDefaultVrpnAddress(void) const{return "192.168.147.197:3883";}
+  bool isReadyToFly(void) const;
 
 private:
Index: trunk/lib/FlairMeta/src/MetaDualShock3.cpp
===================================================================
--- trunk/lib/FlairMeta/src/MetaDualShock3.cpp	(revision 153)
+++ trunk/lib/FlairMeta/src/MetaDualShock3.cpp	(revision 157)
@@ -42,4 +42,6 @@
   getFrameworkManager()->AddDeviceToLog(pimpl_->joy_ref);
   controller->Start();
+  
+  SetIsReady(true);
 }
 
Index: trunk/lib/FlairMeta/src/SimuX4.cpp
===================================================================
--- trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 153)
+++ trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 157)
@@ -26,4 +26,5 @@
 #include <BatteryMonitor.h>
 #include <Tab.h>
+#include <FindArgument.h>
 
 using std::string;
@@ -37,5 +38,5 @@
 namespace meta {
 
-SimuX4::SimuX4(string name, int simu_id,
+SimuX4::SimuX4(string name, int simu_id,string options,
                filter::UavMultiplex *multiplex)
     : Uav(name, multiplex) {
@@ -51,6 +52,13 @@
   SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
   GetBatteryMonitor()->SetBatteryValue(12);
+  
+  string camvOpts=FindArgument(options,"camv=",false);
+  uint16_t camvWidth=320,camvHeight=240;
+	if(camvOpts=="") {
+    Info("using default vertical camera resolution: %ix%i\n",camvWidth, camvHeight);
+	}
+  
   SetVerticalCamera(
-      new SimuCamera("simu_cam_v", 320, 240, 3, simu_id, 10));
+      new SimuCamera("simu_cam_v", camvWidth, camvHeight, 3, simu_id, 10));
 }
 
@@ -58,9 +66,10 @@
 
 void SimuX4::StartSensors(void) {
-  ((SimuAhrs *)GetAhrs())->Start();
+  ((SimuImu *)(GetAhrs()->GetImu()))->Start();
   ((SimuUs *)GetUsRangeFinder())->Start();
   ((SimuCamera *)GetVerticalCamera())->Start();
 }
 
+
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/SimuX4.h
===================================================================
--- trunk/lib/FlairMeta/src/SimuX4.h	(revision 153)
+++ trunk/lib/FlairMeta/src/SimuX4.h	(revision 157)
@@ -26,5 +26,5 @@
   // simu_id: 0 if simulating only one UAV
   //>0 otherwise
-  SimuX4(std::string name, int simu_id = 0,
+  SimuX4(std::string name, int 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 153)
+++ trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 157)
@@ -37,5 +37,5 @@
 namespace meta {
 
-SimuX8::SimuX8(string name, int simu_id,
+SimuX8::SimuX8(string name, int simu_id,string options,
                filter::UavMultiplex *multiplex)
     : Uav(name, multiplex) {
@@ -58,5 +58,5 @@
 
 void SimuX8::StartSensors(void) {
-  ((SimuAhrs *)GetAhrs())->Start();
+  ((SimuImu *)(GetAhrs()->GetImu()))->Start();
   ((SimuUs *)GetUsRangeFinder())->Start();
   ((SimuCamera *)GetVerticalCamera())->Start();
Index: trunk/lib/FlairMeta/src/SimuX8.h
===================================================================
--- trunk/lib/FlairMeta/src/SimuX8.h	(revision 153)
+++ trunk/lib/FlairMeta/src/SimuX8.h	(revision 157)
@@ -26,5 +26,5 @@
   // simu_id: 0 if simulating only one UAV
   //>0 otherwise
-  SimuX8(std::string name, int simu_id = 0,
+  SimuX8(std::string name, int simu_id = 0,std::string options="",
          filter::UavMultiplex *multiplex = NULL);
   ~SimuX8();
Index: trunk/lib/FlairMeta/src/Uav.h
===================================================================
--- trunk/lib/FlairMeta/src/Uav.h	(revision 153)
+++ trunk/lib/FlairMeta/src/Uav.h	(revision 157)
@@ -15,4 +15,5 @@
 
 #include <Object.h>
+#include <UsRangeFinder.h>
 
 namespace flair {
@@ -62,4 +63,5 @@
   sensor::Camera *GetHorizontalCamera(void) const;
 	virtual std::string GetDefaultVrpnAddress(void) const{return "127.0.0.1:3883";}
+  virtual bool isReadyToFly(void) const { return true;}
 
 protected:
Index: trunk/lib/FlairMeta/src/UavFactory.cpp
===================================================================
--- trunk/lib/FlairMeta/src/UavFactory.cpp	(revision 153)
+++ trunk/lib/FlairMeta/src/UavFactory.cpp	(revision 157)
@@ -30,5 +30,5 @@
 
 namespace { // anonymous
-     vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)> *vectoroffunctions=NULL;
+     vector<flair::meta::Uav* (*)(string,string,string,UavMultiplex*)> *vectoroffunctions=NULL;
 }
 
@@ -41,5 +41,5 @@
 
 
-Uav *CreateUav(string name, string uav_type,
+Uav *CreateUav(string name, string type,string options,
                UavMultiplex *multiplex) {
 
@@ -48,5 +48,5 @@
   if(vectoroffunctions!=NULL) {
     for(int i=0;i<vectoroffunctions->size();i++) {
-      uav=vectoroffunctions->at(i)(name,uav_type,multiplex);
+      uav=vectoroffunctions->at(i)(name,type,options,multiplex);
       if(uav!=NULL) {
         free(vectoroffunctions);
@@ -57,35 +57,34 @@
   }
 
-  if (uav_type == "hds_x4") {
-    getFrameworkManager()->Err("UAV type %s not yet implemented\n", uav_type.c_str());
+  if (type == "hds_x4") {
+    getFrameworkManager()->Err("UAV type %s not yet implemented\n", type.c_str());
     return NULL;
-  } else if (uav_type == "hds_x8") {
-    return new HdsX8(name, multiplex);
-  } else if (uav_type == "xair") {
-    return new XAir(name, multiplex);
-  } else if (uav_type == "hds_xufo") {
-    getFrameworkManager()->Err("UAV type %s not yet implemented\n", uav_type.c_str());
+  } else if (type == "hds_x8") {
+    return new HdsX8(name,options, multiplex);
+  } else if (type == "xair") {
+    return new XAir(name,options, multiplex);
+  } else if (type == "hds_xufo") {
+    getFrameworkManager()->Err("UAV type %s not yet implemented\n", type.c_str());
     return NULL;
-  } else if (uav_type.compare(0, 7, "x4_simu") == 0) {
+  } else if (type.compare(0, 7, "x4_simu") == 0) {
     int simu_id = 0;
-    if (uav_type.size() > 7) {
-      simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str());
+    if (type.size() > 7) {
+      simu_id = atoi(type.substr(7, type.size() - 7).c_str());
     }
-    return new SimuX4(name, simu_id, multiplex);
-  } else if (uav_type.compare(0, 7, "x8_simu") == 0) {
+    return new SimuX4(name, simu_id,options, multiplex);
+  } else if (type.compare(0, 7, "x8_simu") == 0) {
     int simu_id = 0;
-    if (uav_type.size() > 7) {
-      simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str());
+    if (type.size() > 7) {
+      simu_id = atoi(type.substr(7, type.size() - 7).c_str());
     }
-    return new SimuX8(name, simu_id, multiplex);
+    return new SimuX8(name, simu_id,options, multiplex);
   } else {
-    getFrameworkManager()->Err("UAV type %s unknown\n", uav_type.c_str());
+    getFrameworkManager()->Err("UAV type %s unknown\n", type.c_str());
     return NULL;
   }
 }
 
-void RegisterUavCreator(flair::meta::Uav*(*func)(string name, string type,
-               UavMultiplex *multiplex)) {
-  if(vectoroffunctions==NULL) vectoroffunctions=(vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)>*)malloc(sizeof(vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)>));
+void RegisterUavCreator(flair::meta::Uav*(*func)(string,string,string,UavMultiplex*)) {
+  if(vectoroffunctions==NULL) vectoroffunctions=(vector<flair::meta::Uav* (*)(string,string,string,UavMultiplex*)>*)malloc(sizeof(vector<flair::meta::Uav* (*)(string,string,string,UavMultiplex*)>));
 
   vectoroffunctions->push_back(func);
Index: trunk/lib/FlairMeta/src/UavFactory.h
===================================================================
--- trunk/lib/FlairMeta/src/UavFactory.h	(revision 153)
+++ trunk/lib/FlairMeta/src/UavFactory.h	(revision 157)
@@ -21,8 +21,8 @@
 #include <Uav.h>
 
-flair::meta::Uav *CreateUav(std::string name, std::string type,
+flair::meta::Uav *CreateUav(std::string name, std::string type,std::string options="",
                             flair::filter::UavMultiplex *multiplex = NULL);
 
-void RegisterUavCreator(flair::meta::Uav*(*func)(std::string name, std::string type,
-                                   flair::filter::UavMultiplex *multiplex));
+void RegisterUavCreator(flair::meta::Uav*(*func)(std::string,std::string,std::string,
+                                   flair::filter::UavMultiplex*));
 #endif // UAVFACTORY
Index: trunk/lib/FlairMeta/src/UavStateMachine.cpp
===================================================================
--- trunk/lib/FlairMeta/src/UavStateMachine.cpp	(revision 153)
+++ trunk/lib/FlairMeta/src/UavStateMachine.cpp	(revision 157)
@@ -460,11 +460,11 @@
   flagZTrajectoryFinished = false;
 
-    if((altitudeState==AltitudeState_t::Stopped) && safeToFly) {// && GetBatteryMonitor()->IsBatteryLow()==false)
-        //The uav always takes off in fail safe mode
-        EnterFailSafeMode();
-        joy->SetLedOFF(4);//DualShock3::led4
-        joy->SetLedOFF(1);//DualShock3::led1
-        joy->Rumble(0x70);
-        joy->SetZRef(0);
+  if((altitudeState==AltitudeState_t::Stopped) && safeToFly && uav->isReadyToFly()) {// && GetBatteryMonitor()->IsBatteryLow()==false)
+    //The uav always takes off in fail safe mode
+    EnterFailSafeMode();
+    joy->SetLedOFF(4);//DualShock3::led4
+    joy->SetLedOFF(1);//DualShock3::led1
+    joy->Rumble(0x70);
+    joy->SetZRef(0);
 
     uZ->SetOffset(); // positionne l'offset de compensation de la gravité à sa
@@ -481,4 +481,5 @@
     SignalEvent(Event_t::TakingOff);
   } else {
+    Warn("cannot takeoff\n");
     joy->ErrorNotify();
   }
Index: trunk/lib/FlairMeta/src/XAir.cpp
===================================================================
--- trunk/lib/FlairMeta/src/XAir.cpp	(revision 153)
+++ trunk/lib/FlairMeta/src/XAir.cpp	(revision 157)
@@ -38,5 +38,5 @@
 namespace meta {
 
-XAir::XAir(string name,
+XAir::XAir(string name, string options,
            filter::UavMultiplex *multiplex)
     : Uav(name, multiplex) {
@@ -61,9 +61,13 @@
 
 void XAir::StartSensors(void) {
-  ((Gx3_25_ahrs *)GetAhrs())->Start();
+  ((Gx3_25_imu *)(GetAhrs()->GetImu()))->Start();
   ((Srf08 *)GetUsRangeFinder())->Start();
   ((Ps3Eye *)GetVerticalCamera())->Start();
 }
 
+bool XAir::isReadyToFly(void) const {
+  return GetAhrs()->GetImu()->IsReady();
+}
+
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/XAir.h
===================================================================
--- trunk/lib/FlairMeta/src/XAir.h	(revision 153)
+++ trunk/lib/FlairMeta/src/XAir.h	(revision 157)
@@ -24,9 +24,10 @@
 class XAir : public Uav {
 public:
-  XAir(std::string name,
+  XAir(std::string name,std::string options="",
        filter::UavMultiplex *multiplex = NULL);
   ~XAir();
   void StartSensors(void);
 	std::string GetDefaultVrpnAddress(void) const{return "192.168.147.197:3883";}
+  bool isReadyToFly(void) const;
 
 private:
