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: 2021/03/03
|
---|
6 | // filename: IpcX4.cpp
|
---|
7 | //
|
---|
8 | // author: Sébastien Ambroziak
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: Class defining an x4 uav using ipc data
|
---|
14 | //
|
---|
15 | //
|
---|
16 | /*********************************************************************/
|
---|
17 |
|
---|
18 | #include <IpcX4.h>
|
---|
19 | #include <IpcBldc.h>
|
---|
20 | #include <IpcUs.h>
|
---|
21 | #include <IpcAhrs.h>
|
---|
22 | #include <IpcImu.h>
|
---|
23 | #include <BatteryMonitor.h>
|
---|
24 | #include <FrameworkManager.h>
|
---|
25 | #include <X4X8Multiplex.h>
|
---|
26 | #include <Tab.h>
|
---|
27 | //#include <FindArgument.h>
|
---|
28 |
|
---|
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 | IpcX4::IpcX4(string name,string options,
|
---|
41 | filter::UavMultiplex *multiplex)
|
---|
42 | : Uav(name, multiplex) {
|
---|
43 |
|
---|
44 | if (multiplex == NULL)
|
---|
45 | SetMultiplex(new X4X8Multiplex("motors", X4X8Multiplex::X4));
|
---|
46 |
|
---|
47 | SetBldc(new IpcBldc(GetUavMultiplex(), GetUavMultiplex()->GetLayout(),"motors", GetUavMultiplex()->MotorsCount(),"motors",65));
|
---|
48 |
|
---|
49 | SetUsRangeFinder(new IpcUs("us", 70, "altitude", 65));
|
---|
50 |
|
---|
51 | SetAhrs(new IpcAhrs("ahrs",70,"imu",65));
|
---|
52 |
|
---|
53 | Tab *bat_tab = new Tab(getFrameworkManager()->GetTabWidget(), "battery");
|
---|
54 | SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(), "battery"));
|
---|
55 | GetBatteryMonitor()->SetBatteryValue(12);
|
---|
56 |
|
---|
57 | }
|
---|
58 |
|
---|
59 | IpcX4::~IpcX4() {}
|
---|
60 |
|
---|
61 | void IpcX4::StartSensors(void) {
|
---|
62 | ((IpcImu *)(GetAhrs()->GetImu()))->Start();
|
---|
63 | ((IpcUs *)GetUsRangeFinder())->Start();
|
---|
64 |
|
---|
65 | }
|
---|
66 |
|
---|
67 |
|
---|
68 | } // end namespace meta
|
---|
69 | } // end namespace flair |
---|