source: flair-src/trunk/lib/FlairMeta/src/HdsX8.cpp@ 175

Last change on this file since 175 was 157, checked in by Sanahuja Guillaume, 8 years ago

iadded isready to iodevice:
avoid problem of imu not ready in ardrone2

File size: 2.0 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5// created: 2015/02/08
6// filename: HdsX8.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class defining a HDS X8 uav
14//
15//
16/*********************************************************************/
17
18#include "HdsX8.h"
19#include <FrameworkManager.h>
20#include <RTDM_I2cPort.h>
21#include <RTDM_SerialPort.h>
22#include <Srf08.h>
23#include <Gx3_25_ahrs.h>
24#include <BlCtrlV2.h>
25#include <X4X8Multiplex.h>
26#include <Ps3Eye.h>
27
28using std::string;
29using namespace flair::core;
30using namespace flair::sensor;
31using namespace flair::filter;
32using namespace flair::actuator;
33
34namespace flair {
35namespace meta {
36
37HdsX8::HdsX8(string name,string options,
38 filter::UavMultiplex *multiplex)
39 : Uav(name, multiplex) {
40 RTDM_I2cPort *i2cport = new RTDM_I2cPort(getFrameworkManager(), "rtdm_i2c", "rti2c3");
41 RTDM_SerialPort *imu_port = new RTDM_SerialPort(getFrameworkManager(), "imu_port", "rtser1");
42
43 if (multiplex == NULL)
44 SetMultiplex(new X4X8Multiplex( "motors", X4X8Multiplex::X8));
45
46 SetBldc(new BlCtrlV2(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
47 "motors", GetUavMultiplex()->MotorsCount(), i2cport));
48 SetUsRangeFinder(new Srf08("SRF08", i2cport, 0x70, 60));
49 SetAhrs(new Gx3_25_ahrs("imu", imu_port,
50 Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70));
51 SetBatteryMonitor(((BlCtrlV2 *)GetBldc())->GetBatteryMonitor());
52 SetVerticalCamera(new Ps3Eye("camv", 0, 50));
53}
54
55HdsX8::~HdsX8() {}
56
57void HdsX8::StartSensors(void) {
58 ((Gx3_25_imu *)(GetAhrs()->GetImu()))->Start();
59 ((Srf08 *)GetUsRangeFinder())->Start();
60 ((Ps3Eye *)GetVerticalCamera())->Start();
61}
62
63bool HdsX8::isReadyToFly(void) const {
64 return GetAhrs()->GetImu()->IsReady();
65}
66
67} // end namespace meta
68} // end namespace flair
Note: See TracBrowser for help on using the repository browser.