source: flair-src/trunk/lib/FlairMeta/src/XAir.cpp @ 7

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

filter and meta

File size: 2.2 KB
Line 
1//  created:    2015/02/08
2//  filename:   XAir.cpp
3//
4//  author:     Guillaume Sanahuja
5//              Copyright Heudiasyc UMR UTC/CNRS 7253
6//
7//  version:    $Id: $
8//
9//  purpose:    Class defining a Xair uav
10//
11//
12/*********************************************************************/
13
14#include "XAir.h"
15#include <FrameworkManager.h>
16#include <RTDM_I2cPort.h>
17#include <RTDM_SerialPort.h>
18#include <Srf08.h>
19#include <Gx3_25_ahrs.h>
20#include <AfroBldc.h>
21#include <X4X8Multiplex.h>
22#include <Ps3Eye.h>
23#include <BatteryMonitor.h>
24#include <Tab.h>
25
26using std::string;
27using namespace flair::core;
28using namespace flair::gui;
29using namespace flair::sensor;
30using namespace flair::filter;
31using namespace flair::actuator;
32
33namespace flair { namespace meta {
34
35XAir::XAir(FrameworkManager* parent,string uav_name,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
36    RTDM_I2cPort* i2cport=new RTDM_I2cPort(parent,"rtdm_i2c","rti2c3");
37    RTDM_SerialPort* imu_port=new RTDM_SerialPort(parent,"imu_port","rtser1");
38
39    if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X8));
40
41    SetBldc(new AfroBldc(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),i2cport));
42    SetUsRangeFinder(new Srf08(parent,"SRF08",i2cport,0x70,60));
43    SetAhrs(new Gx3_25_ahrs(parent,"imu",imu_port,Gx3_25_imu::EulerAnglesAndAngularRates,70));
44    Tab* bat_tab=new Tab(parent->GetTabWidget(),"battery");
45    SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(),"battery"));
46    GetBatteryMonitor()->SetBatteryValue(12);
47
48/*
49        if(VRPNType==Auto || VRPNType==AutoSerialPort)
50        {
51            RTDM_SerialPort* vrpn_port=new RTDM_SerialPort(parent,"vrpn_port","rtser3");
52
53            vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
54            uav_vrpn=new MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
55        }
56*/
57    SetVerticalCamera(new Ps3Eye(parent,"camv",0,50));
58}
59
60XAir::~XAir() {
61
62}
63
64void XAir::StartSensors(void) {
65    ((Gx3_25_ahrs*)GetAhrs())->Start();
66    ((Srf08*)GetUsRangeFinder())->Start();
67    ((Ps3Eye *)GetVerticalCamera())->Start();
68    Uav::StartSensors();
69}
70
71} // end namespace meta
72} // end namespace flair
Note: See TracBrowser for help on using the repository browser.