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

Last change on this file since 23 was 22, checked in by Sanahuja Guillaume, 9 years ago

m

File size: 2.3 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(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");
42
43 if (multiplex == NULL)
44 SetMultiplex(new X4X8Multiplex(parent, "motors", X4X8Multiplex::X8));
45
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());
52
53 /*
54 if(VRPNType==Auto || VRPNType==AutoSerialPort)
55 {
56 RTDM_SerialPort* vrpn_port=new
57 RTDM_SerialPort(parent,"vrpn_port","rtser3");
58
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));
65}
66
67HdsX8::~HdsX8() {}
68
69void HdsX8::StartSensors(void) {
70 ((Gx3_25_ahrs *)GetAhrs())->Start();
71 ((Srf08 *)GetUsRangeFinder())->Start();
72 ((Ps3Eye *)GetVerticalCamera())->Start();
73 Uav::StartSensors();
74}
75
76} // end namespace meta
77} // end namespace flair
Note: See TracBrowser for help on using the repository browser.