1 | // created: 2015/02/08
|
---|
2 | // filename: HdsX8.cpp
|
---|
3 | //
|
---|
4 | // author: Guillaume Sanahuja
|
---|
5 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
6 | //
|
---|
7 | // version: $Id: $
|
---|
8 | //
|
---|
9 | // purpose: Class defining an HDS X8 uav
|
---|
10 | //
|
---|
11 | //
|
---|
12 | /*********************************************************************/
|
---|
13 |
|
---|
14 | #include "HdsX8.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 <BlCtrlV2.h>
|
---|
21 | #include <X4X8Multiplex.h>
|
---|
22 | #include <Ps3Eye.h>
|
---|
23 |
|
---|
24 | using std::string;
|
---|
25 | using namespace flair::core;
|
---|
26 | using namespace flair::sensor;
|
---|
27 | using namespace flair::filter;
|
---|
28 | using namespace flair::actuator;
|
---|
29 |
|
---|
30 | namespace flair { namespace meta {
|
---|
31 |
|
---|
32 | HdsX8::HdsX8(FrameworkManager* parent,string uav_name,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
|
---|
33 | RTDM_I2cPort* i2cport=new RTDM_I2cPort(parent,"rtdm_i2c","rti2c3");
|
---|
34 | RTDM_SerialPort* imu_port=new RTDM_SerialPort(parent,"imu_port","rtser1");
|
---|
35 |
|
---|
36 | if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X8));
|
---|
37 |
|
---|
38 | SetBldc(new BlCtrlV2(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),i2cport));
|
---|
39 | SetUsRangeFinder(new Srf08(parent,"SRF08",i2cport,0x70,60));
|
---|
40 | SetAhrs(new Gx3_25_ahrs(parent,"imu",imu_port,Gx3_25_imu::EulerAnglesAndAngularRates,70));
|
---|
41 | SetBatteryMonitor(((BlCtrlV2*)GetBldc())->GetBatteryMonitor());
|
---|
42 |
|
---|
43 | /*
|
---|
44 | if(VRPNType==Auto || VRPNType==AutoSerialPort)
|
---|
45 | {
|
---|
46 | RTDM_SerialPort* vrpn_port=new RTDM_SerialPort(parent,"vrpn_port","rtser3");
|
---|
47 |
|
---|
48 | vrpnclient=new VrpnClient(parent,"vrpn",vrpn_port,10000,80);
|
---|
49 | uav_vrpn=new MetaVrpnObject(vrpnclient,uav_name,VRPNSerialObjectId);
|
---|
50 | }
|
---|
51 | */
|
---|
52 | SetVerticalCamera(new Ps3Eye(parent,"camv",0,50));
|
---|
53 | }
|
---|
54 |
|
---|
55 | HdsX8::~HdsX8() {
|
---|
56 |
|
---|
57 | }
|
---|
58 |
|
---|
59 | void HdsX8::StartSensors(void) {
|
---|
60 | ((Gx3_25_ahrs*)GetAhrs())->Start();
|
---|
61 | ((Srf08*)GetUsRangeFinder())->Start();
|
---|
62 | ((Ps3Eye *)GetVerticalCamera())->Start();
|
---|
63 | Uav::StartSensors();
|
---|
64 | }
|
---|
65 |
|
---|
66 | } // end namespace meta
|
---|
67 | } // end namespace flair
|
---|