// %flair:license{ // This file is part of the Flair framework distributed under the // CECILL-C License, Version 1.0. // %flair:license} // created: 2015/02/08 // filename: XAir.cpp // // author: Guillaume Sanahuja // Copyright Heudiasyc UMR UTC/CNRS 7253 // // version: $Id: $ // // purpose: Class defining a Xair uav // // /*********************************************************************/ #ifdef ARMV7A #include "XAir.h" #include #include #include #include #include #include #include #include #include #include using std::string; using namespace flair::core; using namespace flair::gui; using namespace flair::sensor; using namespace flair::filter; using namespace flair::actuator; namespace flair { namespace meta { XAir::XAir(string name, string options, filter::UavMultiplex *multiplex) : Uav(name, multiplex) { RTDM_I2cPort *i2cport = new RTDM_I2cPort(getFrameworkManager(), "rtdm_i2c", "rti2c3"); RTDM_SerialPort *imu_port = new RTDM_SerialPort(getFrameworkManager(), "imu_port", "rtser1"); if (multiplex == NULL) SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X8)); SetBldc(new AfroBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(), "motors", GetUavMultiplex()->MotorsCount(), i2cport)); SetUsRangeFinder(new Srf08("SRF08", i2cport, 0x70, 60)); SetAhrs(new Gx3_25_ahrs("imu", imu_port, Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70)); Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery"); SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery")); GetBatteryMonitor()->SetBatteryValue(12); SetVerticalCamera(new Ps3Eye("camv", 0, 50)); } XAir::~XAir() {} void XAir::StartSensors(void) { ((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 #endif