source: flair-src/trunk/lib/FlairMeta/src/XAir.cpp@ 443

Last change on this file since 443 was 417, checked in by Sanahuja Guillaume, 3 years ago

define and use passthrough ahrs

File size: 2.4 KB
RevLine 
[10]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[10]4// %flair:license}
[7]5// created: 2015/02/08
6// filename: XAir.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class defining a Xair uav
14//
15//
16/*********************************************************************/
[268]17#ifdef ARMV7A
[7]18
19#include "XAir.h"
20#include <FrameworkManager.h>
21#include <RTDM_I2cPort.h>
22#include <RTDM_SerialPort.h>
23#include <Srf08.h>
[417]24#include <PassthroughAhrs.h>
25#include <Gx3_25_imu.h>
[7]26#include <AfroBldc.h>
27#include <X4X8Multiplex.h>
28#include <Ps3Eye.h>
29#include <BatteryMonitor.h>
30#include <Tab.h>
31
32using std::string;
33using namespace flair::core;
34using namespace flair::gui;
35using namespace flair::sensor;
36using namespace flair::filter;
37using namespace flair::actuator;
38
[15]39namespace flair {
40namespace meta {
[7]41
[157]42XAir::XAir(string name, string options,
[15]43 filter::UavMultiplex *multiplex)
[122]44 : Uav(name, multiplex) {
45 RTDM_I2cPort *i2cport = new RTDM_I2cPort(getFrameworkManager(), "rtdm_i2c", "rti2c3");
46 RTDM_SerialPort *imu_port = new RTDM_SerialPort(getFrameworkManager(), "imu_port", "rtser1");
[7]47
[15]48 if (multiplex == NULL)
[137]49 SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X8));
[7]50
[15]51 SetBldc(new AfroBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
52 "motors", GetUavMultiplex()->MotorsCount(), i2cport));
[137]53 SetUsRangeFinder(new Srf08("SRF08", i2cport, 0x70, 60));
[417]54 SetAhrs(new PassthroughAhrs(new Gx3_25_imu("imu",imu_port,Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70),"ahrs"));
55
[122]56 Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
[15]57 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
58 GetBatteryMonitor()->SetBatteryValue(12);
[403]59
60 if(Image::IsUsingDefaultAllocAndFree()) {
61 SetVerticalCamera(new Ps3Eye("camv", 0, false,50));//no cmem and no dsp
62 } else {
63 SetVerticalCamera(new Ps3Eye("camv", 0, true,50));//cmem and dsp
64 }
[7]65}
66
[15]67XAir::~XAir() {}
[7]68
69void XAir::StartSensors(void) {
[157]70 ((Gx3_25_imu *)(GetAhrs()->GetImu()))->Start();
[15]71 ((Srf08 *)GetUsRangeFinder())->Start();
72 ((Ps3Eye *)GetVerticalCamera())->Start();
[7]73}
74
[157]75bool XAir::isReadyToFly(void) const {
76 return GetAhrs()->GetImu()->IsReady();
77}
78
[7]79} // end namespace meta
80} // end namespace flair
[268]81
[403]82#endif
Note: See TracBrowser for help on using the repository browser.