1 | // created: 2016/02/08
|
---|
2 | // filename: SimuX4.cpp
|
---|
3 | //
|
---|
4 | // author: Guillaume Sanahuja
|
---|
5 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
6 | //
|
---|
7 | // version: $Id: $
|
---|
8 | //
|
---|
9 | // purpose: Class defining a simultation x4 uav
|
---|
10 | //
|
---|
11 | //
|
---|
12 | /*********************************************************************/
|
---|
13 |
|
---|
14 | #include "SimuX4.h"
|
---|
15 | #include <FrameworkManager.h>
|
---|
16 | #include <X4X8Multiplex.h>
|
---|
17 | #include <SimuImu.h>
|
---|
18 | #include <SimuAhrs.h>
|
---|
19 | #include <SimuBldc.h>
|
---|
20 | #include <SimuUs.h>
|
---|
21 | #include <SimuCamera.h>
|
---|
22 | #include <BatteryMonitor.h>
|
---|
23 | #include <Tab.h>
|
---|
24 |
|
---|
25 | using std::string;
|
---|
26 | using namespace flair::core;
|
---|
27 | using namespace flair::gui;
|
---|
28 | using namespace flair::sensor;
|
---|
29 | using namespace flair::filter;
|
---|
30 | using namespace flair::actuator;
|
---|
31 |
|
---|
32 | namespace flair { namespace meta {
|
---|
33 |
|
---|
34 | SimuX4::SimuX4(FrameworkManager* parent,string uav_name,int simu_id,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
|
---|
35 |
|
---|
36 | if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X4));
|
---|
37 |
|
---|
38 | SetBldc(new SimuBldc(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),simu_id));
|
---|
39 | SetUsRangeFinder(new SimuUs(parent,"us",simu_id,60));
|
---|
40 | SetAhrs(new SimuAhrs(parent,"imu",simu_id,70));
|
---|
41 | Tab* bat_tab=new Tab(parent->GetTabWidget(),"battery");
|
---|
42 | SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(),"battery"));
|
---|
43 | GetBatteryMonitor()->SetBatteryValue(12);
|
---|
44 | SetVerticalCamera(new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
|
---|
45 | }
|
---|
46 |
|
---|
47 | SimuX4::~SimuX4() {
|
---|
48 |
|
---|
49 | }
|
---|
50 |
|
---|
51 | void SimuX4::StartSensors(void) {
|
---|
52 | ((SimuAhrs*)GetAhrs())->Start();
|
---|
53 | ((SimuUs*)GetUsRangeFinder())->Start();
|
---|
54 | ((SimuCamera *)GetVerticalCamera())->Start();
|
---|
55 | Uav::StartSensors();
|
---|
56 | }
|
---|
57 |
|
---|
58 | void SimuX4::SetupVRPNAutoIP(string name) {
|
---|
59 | SetupVRPN("127.0.0.1:3883",name);
|
---|
60 | }
|
---|
61 |
|
---|
62 | } // end namespace meta
|
---|
63 | } // end namespace flair
|
---|