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

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

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

File size: 2.0 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: HdsX8.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
[22]13// purpose: Class defining a HDS X8 uav
[7]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
[15]34namespace flair {
35namespace meta {
[7]36
[157]37HdsX8::HdsX8(string name,string options,
[15]38 filter::UavMultiplex *multiplex)
[122]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");
[7]42
[15]43 if (multiplex == NULL)
[137]44 SetMultiplex(new X4X8Multiplex( "motors", X4X8Multiplex::X8));
[7]45
[15]46 SetBldc(new BlCtrlV2(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
47 "motors", GetUavMultiplex()->MotorsCount(), i2cport));
[137]48 SetUsRangeFinder(new Srf08("SRF08", i2cport, 0x70, 60));
49 SetAhrs(new Gx3_25_ahrs("imu", imu_port,
[100]50 Gx3_25_imu::AccelerationAngularRateAndOrientationMatrix, 70));
[15]51 SetBatteryMonitor(((BlCtrlV2 *)GetBldc())->GetBatteryMonitor());
[137]52 SetVerticalCamera(new Ps3Eye("camv", 0, 50));
[7]53}
54
[15]55HdsX8::~HdsX8() {}
[7]56
57void HdsX8::StartSensors(void) {
[157]58 ((Gx3_25_imu *)(GetAhrs()->GetImu()))->Start();
[15]59 ((Srf08 *)GetUsRangeFinder())->Start();
[107]60 ((Ps3Eye *)GetVerticalCamera())->Start();
[7]61}
62
[157]63bool HdsX8::isReadyToFly(void) const {
64 return GetAhrs()->GetImu()->IsReady();
65}
66
[7]67} // end namespace meta
68} // end namespace flair
Note: See TracBrowser for help on using the repository browser.