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: 2022/01/05
|
---|
6 | // filename: SimuPlane.cpp
|
---|
7 | //
|
---|
8 | // author: Guillaume Sanahuja
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: Class defining a simulation plane
|
---|
14 | //
|
---|
15 | //
|
---|
16 | /*********************************************************************/
|
---|
17 | #ifdef CORE2_64
|
---|
18 |
|
---|
19 | #include "SimuPlane.h"
|
---|
20 | #include <FrameworkManager.h>
|
---|
21 | #include <SimulatedImu.h>
|
---|
22 | #include <PassthroughAhrs.h>
|
---|
23 | #include <SimulatedBldc.h>
|
---|
24 | #include <SimulatedServos.h>
|
---|
25 | #include <SimulatedUs.h>
|
---|
26 | #include <BatteryMonitor.h>
|
---|
27 | #include "PlaneMultiplex.h"
|
---|
28 | #include <Tab.h>
|
---|
29 |
|
---|
30 | using std::string;
|
---|
31 | using namespace flair::core;
|
---|
32 | using namespace flair::gui;
|
---|
33 | using namespace flair::sensor;
|
---|
34 | using namespace flair::filter;
|
---|
35 | using namespace flair::actuator;
|
---|
36 |
|
---|
37 | namespace flair {
|
---|
38 | namespace meta {
|
---|
39 |
|
---|
40 | SimuPlane::SimuPlane(string name, uint32_t simu_id,filter::PlaneMultiplex *multiplex)
|
---|
41 | : Plane(name, multiplex) {
|
---|
42 |
|
---|
43 |
|
---|
44 | SetBldc(new SimulatedBldc(multiplex->GetBldcMultiplex(), multiplex->GetLayout(),"motors",1, simu_id,0));
|
---|
45 | SetServos(new SimulatedServos(multiplex->GetServosMultiplex(),multiplex->GetLayout(),"servos",2, simu_id,0));
|
---|
46 | SetUsRangeFinder(new SimulatedUs("us", simu_id,0, 60));
|
---|
47 | SetAhrs(new PassthroughAhrs(new SimulatedImu("imu", simu_id,0, 70),"ahrs"));
|
---|
48 | Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
|
---|
49 | SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
|
---|
50 | GetBatteryMonitor()->SetBatteryValue(12);
|
---|
51 |
|
---|
52 | }
|
---|
53 |
|
---|
54 | SimuPlane::~SimuPlane() {}
|
---|
55 |
|
---|
56 | void SimuPlane::StartSensors(void) {
|
---|
57 | ((SimulatedImu *)(GetAhrs()->GetImu()))->Start();
|
---|
58 | ((SimulatedUs *)GetUsRangeFinder())->Start();
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 | } // end namespace meta
|
---|
64 | } // end namespace flair
|
---|
65 |
|
---|
66 | #endif |
---|