Index: trunk/demos/Gps/simulator/CMakeLists.txt
===================================================================
--- trunk/demos/Gps/simulator/CMakeLists.txt	(revision 181)
+++ trunk/demos/Gps/simulator/CMakeLists.txt	(revision 185)
@@ -5,5 +5,4 @@
 SET(FLAIR_USE_SIMULATOR TRUE)
 SET(FLAIR_USE_SIMULATOR_GL TRUE)
-SET(FLAIR_USE_GPS TRUE)
 
 include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
@@ -23,5 +22,5 @@
 )
 
-TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_rt ${FLAIR_LIBRARIES_RT} nmea)
 
 #non real time executable
@@ -30,3 +29,3 @@
 )
 
-TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}_nrt ${FLAIR_LIBRARIES_NRT} nmea)
Index: trunk/demos/Gps/uav/CMakeLists.txt
===================================================================
--- trunk/demos/Gps/uav/CMakeLists.txt	(revision 181)
+++ trunk/demos/Gps/uav/CMakeLists.txt	(revision 185)
@@ -7,6 +7,4 @@
 SET(FLAIR_USE_VISION_FILTER TRUE)
 SET(FLAIR_USE_META TRUE)
-SET(FLAIR_USE_GPS TRUE)
-
 
 include($ENV{FLAIR_ROOT}/flair-dev/cmake-modules/GlobalCmakeFlair.cmake)
Index: trunk/demos/Gps/uav/src/DemoGps.cpp
===================================================================
--- trunk/demos/Gps/uav/src/DemoGps.cpp	(revision 181)
+++ trunk/demos/Gps/uav/src/DemoGps.cpp	(revision 185)
@@ -46,13 +46,5 @@
   stopCircle = new PushButton(GetButtonsLayout()->LastRowLastCol(), "stop_circle");
 
-  // RTDM_SerialPort *serialport=new RTDM_SerialPort(getFrameworkManager(),"gps_serial","rtser2");
-  // gps=new Mb800("gps",serialport,(NmeaGps::NMEAFlags_t)(NmeaGps::GGA|NmeaGps::VTG),40);
-  gps = new SimuGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40);
-
-  gps->UseDefaultPlot();
-  getFrameworkManager()->AddDeviceToLog(gps);
-  gps->Start();
-
-  circle = new TrajectoryGenerator2DCircle(gps->GetLayout()->NewRow(), "circle");
+  circle = new TrajectoryGenerator2DCircle(uav->GetGps()->GetLayout()->NewRow(), "circle");
   // todo: add graphs in gps plot
   /*
Index: trunk/demos/Gps/uav/src/DemoGps.h
===================================================================
--- trunk/demos/Gps/uav/src/DemoGps.h	(revision 181)
+++ trunk/demos/Gps/uav/src/DemoGps.h	(revision 185)
@@ -26,6 +26,4 @@
     namespace sensor {
         class TargetController;
-        class Mb800;
-        class SimuGps;
     }
 }
@@ -63,6 +61,4 @@
         flair::filter::TrajectoryGenerator2DCircle *circle;
         flair::core::AhrsData *customReferenceOrientation,*customOrientation;
-        //flair::sensor::Mb800 *gps;
-        flair::sensor::SimuGps *gps;
 };
 
Index: trunk/demos/Gps/uav/src/main.cpp
===================================================================
--- trunk/demos/Gps/uav/src/main.cpp	(revision 181)
+++ trunk/demos/Gps/uav/src/main.cpp	(revision 185)
@@ -45,5 +45,5 @@
     manager->SetupLogger(log_path);
 
-    Uav* drone=CreateUav(name,uav_type);
+    Uav* drone=CreateUav(name,uav_type,"use_gps=true");
     TargetEthController *controller=new TargetEthController("Dualshock3",ds3port);
     DemoGps* demo=new DemoGps(controller);
Index: trunk/lib/FlairMeta/src/HdsX8.cpp
===================================================================
--- trunk/lib/FlairMeta/src/HdsX8.cpp	(revision 181)
+++ trunk/lib/FlairMeta/src/HdsX8.cpp	(revision 185)
@@ -25,4 +25,6 @@
 #include <X4X8Multiplex.h>
 #include <Ps3Eye.h>
+#include <Mb800.h>
+#include <FindArgument.h>
 
 using std::string;
@@ -51,4 +53,10 @@
   SetBatteryMonitor(((BlCtrlV2 *)GetBldc())->GetBatteryMonitor());
   SetVerticalCamera(new Ps3Eye("camv", 0, 50));
+  
+  string useGps=FindArgument(options,"use_gps=",false);
+  if(useGps=="true") {
+    RTDM_SerialPort *gps_port = new RTDM_SerialPort(getFrameworkManager(), "gps_port", "rtser2");
+    SetGps(new Mb800("gps",gps_port,(NmeaGps::NMEAFlags_t)(NmeaGps::GGA|NmeaGps::VTG),40));
+  } 
 }
 
@@ -59,4 +67,5 @@
   ((Srf08 *)GetUsRangeFinder())->Start();
   ((Ps3Eye *)GetVerticalCamera())->Start();
+  ((Mb800 *)GetGps())->Start();
 }
 
Index: trunk/lib/FlairMeta/src/SimuX4.cpp
===================================================================
--- trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 181)
+++ trunk/lib/FlairMeta/src/SimuX4.cpp	(revision 185)
@@ -25,4 +25,5 @@
 #include <SimuCamera.h>
 #include <BatteryMonitor.h>
+#include <SimuGps.h>
 #include <Tab.h>
 #include <FindArgument.h>
@@ -62,4 +63,9 @@
   Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight);
   SetHorizontalCamera(new SimuCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
+  
+  string useGps=FindArgument(options,"use_gps=",false);
+  if(useGps=="true") {
+    SetGps(new SimuGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
+  } 
 }
 
@@ -71,4 +77,5 @@
   ((SimuCamera *)GetVerticalCamera())->Start();
   ((SimuCamera *)GetHorizontalCamera())->Start();
+  ((SimuGps *)GetGps())->Start();
 }
 
Index: trunk/lib/FlairMeta/src/SimuX8.cpp
===================================================================
--- trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 181)
+++ trunk/lib/FlairMeta/src/SimuX8.cpp	(revision 185)
@@ -25,4 +25,5 @@
 #include <SimuCamera.h>
 #include <BatteryMonitor.h>
+#include <SimuGps.h>
 #include <Tab.h>
 #include <FindArgument.h>
@@ -62,4 +63,9 @@
   Info("using horizontal camera resolution: %ix%i\n",camhWidth, camhHeight);
   SetHorizontalCamera(new SimuCamera("simu_cam_h", camhWidth, camhHeight, 3, simu_id,1, 10));
+  
+  string useGps=FindArgument(options,"use_gps=",false);
+  if(useGps=="true") {
+    SetGps(new SimuGps("gps", (NmeaGps::NMEAFlags_t)(NmeaGps::GGA | NmeaGps::VTG), 0,0, 40));
+  } 
 }
 
@@ -71,4 +77,5 @@
   ((SimuCamera *)GetVerticalCamera())->Start();
   ((SimuCamera *)GetHorizontalCamera())->Start();
+  ((SimuGps *)GetGps())->Start();
 }
 
Index: trunk/lib/FlairMeta/src/Uav.cpp
===================================================================
--- trunk/lib/FlairMeta/src/Uav.cpp	(revision 181)
+++ trunk/lib/FlairMeta/src/Uav.cpp	(revision 185)
@@ -26,4 +26,5 @@
 #include <UavMultiplex.h>
 #include <UsRangeFinder.h>
+#include <NmeaGps.h>
 #include <Bldc.h>
 #include <cvmatrix.h>
@@ -57,4 +58,5 @@
   verticalCamera = NULL;
   horizontalCamera = NULL;
+  gps = NULL;
   this->multiplex = multiplex;
 }
@@ -91,4 +93,9 @@
 void Uav::SetHorizontalCamera(const Camera *inHorizontalCamera) {
   horizontalCamera = (Camera *)inHorizontalCamera;
+}
+
+void Uav::SetGps(const NmeaGps *inGps) {
+  gps=(NmeaGps*)inGps;
+  getFrameworkManager()->AddDeviceToLog(gps);
 }
 
@@ -148,4 +155,5 @@
   meta_us->UseDefaultPlot();
   ahrs->UseDefaultPlot();
+  if(gps!=NULL) gps->UseDefaultPlot();
 }
 
@@ -168,4 +176,6 @@
 Camera *Uav::GetHorizontalCamera(void) const { return horizontalCamera; }
 
+NmeaGps *Uav::GetGps(void) const { return gps; }
+
 } // end namespace meta
 } // end namespace flair
Index: trunk/lib/FlairMeta/src/Uav.h
===================================================================
--- trunk/lib/FlairMeta/src/Uav.h	(revision 181)
+++ trunk/lib/FlairMeta/src/Uav.h	(revision 185)
@@ -30,4 +30,5 @@
 		class Imu;
 		class Camera;
+		class NmeaGps;
 	}
 }
@@ -62,4 +63,5 @@
   sensor::Camera *GetVerticalCamera(void) const;
   sensor::Camera *GetHorizontalCamera(void) const;
+  sensor::NmeaGps *GetGps(void) const;
 	virtual std::string GetDefaultVrpnAddress(void) const{return "127.0.0.1:3883";}
   virtual bool isReadyToFly(void) const { return true;}
@@ -74,7 +76,9 @@
   void SetVerticalCamera(const sensor::Camera *verticalCamera);
   void SetHorizontalCamera(const sensor::Camera *verticalCamera);
+  void SetGps(const sensor::NmeaGps *gps);
 
 private:
   sensor::Imu *imu;
+  sensor::NmeaGps *gps;
   filter::Ahrs *ahrs;
   actuator::Bldc *bldc;
