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

Last change on this file since 10 was 10, checked in by Sanahuja Guillaume, 6 years ago

lic

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