[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 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "XAir.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 <AfroBldc.h>
|
---|
| 25 | #include <X4X8Multiplex.h>
|
---|
| 26 | #include <Ps3Eye.h>
|
---|
| 27 | #include <BatteryMonitor.h>
|
---|
| 28 | #include <Tab.h>
|
---|
| 29 |
|
---|
| 30 | using std::string;
|
---|
| 31 | using namespace flair::core;
|
---|
| 32 | using namespace flair::gui;
|
---|
| 33 | using namespace flair::sensor;
|
---|
| 34 | using namespace flair::filter;
|
---|
| 35 | using namespace flair::actuator;
|
---|
| 36 |
|
---|
[15] | 37 | namespace flair {
|
---|
| 38 | namespace meta {
|
---|
[7] | 39 |
|
---|
[15] | 40 | XAir::XAir(FrameworkManager *parent, string uav_name,
|
---|
| 41 | filter::UavMultiplex *multiplex)
|
---|
| 42 | : Uav(parent, uav_name, multiplex) {
|
---|
| 43 | RTDM_I2cPort *i2cport = new RTDM_I2cPort(parent, "rtdm_i2c", "rti2c3");
|
---|
| 44 | RTDM_SerialPort *imu_port = new RTDM_SerialPort(parent, "imu_port", "rtser1");
|
---|
[7] | 45 |
|
---|
[15] | 46 | if (multiplex == NULL)
|
---|
| 47 | SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X8));
|
---|
[7] | 48 |
|
---|
[15] | 49 | SetBldc(new AfroBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),
|
---|
| 50 | "motors", GetUavMultiplex()->MotorsCount(), i2cport));
|
---|
| 51 | SetUsRangeFinder(new Srf08(parent, "SRF08", i2cport, 0x70, 60));
|
---|
| 52 | SetAhrs(new Gx3_25_ahrs(parent, "imu", imu_port,
|
---|
| 53 | Gx3_25_imu::EulerAnglesAndAngularRates, 70));
|
---|
| 54 | Tab *bat_tab = new Tab(parent->GetTabWidget(), "battery");
|
---|
| 55 | SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
|
---|
| 56 | GetBatteryMonitor()->SetBatteryValue(12);
|
---|
[7] | 57 |
|
---|
[15] | 58 | /*
|
---|
| 59 | if(VRPNType==Auto || VRPNType==AutoSerialPort)
|
---|
| 60 | {
|
---|
| 61 | RTDM_SerialPort* vrpn_port=new
|
---|
| 62 | RTDM_SerialPort(parent,"vrpn_port","rtser3");
|
---|
[7] | 63 |
|
---|
[15] | 64 | vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
|
---|
| 65 | uav_vrpn=new
|
---|
| 66 | MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
|
---|
| 67 | }
|
---|
| 68 | */
|
---|
| 69 | SetVerticalCamera(new Ps3Eye(parent, "camv", 0, 50));
|
---|
[7] | 70 | }
|
---|
| 71 |
|
---|
[15] | 72 | XAir::~XAir() {}
|
---|
[7] | 73 |
|
---|
| 74 | void XAir::StartSensors(void) {
|
---|
[15] | 75 | ((Gx3_25_ahrs *)GetAhrs())->Start();
|
---|
| 76 | ((Srf08 *)GetUsRangeFinder())->Start();
|
---|
| 77 | ((Ps3Eye *)GetVerticalCamera())->Start();
|
---|
| 78 | Uav::StartSensors();
|
---|
[7] | 79 | }
|
---|
| 80 |
|
---|
| 81 | } // end namespace meta
|
---|
| 82 | } // end namespace flair
|
---|