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