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