source: flair-src/tags/latest/lib/FlairIpc/src/IpcX4.cpp

Last change on this file was 397, checked in by Sanahuja Guillaume, 8 months ago

add ipc lib

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
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
30using std::string;
31using namespace flair::core;
32using namespace flair::gui;
33using namespace flair::sensor;
34using namespace flair::filter;
35using namespace flair::actuator;
36
37namespace flair {
38namespace meta {
39
40IpcX4::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
59IpcX4::~IpcX4() {}
60
61void IpcX4::StartSensors(void) {
62  ((IpcImu *)(GetAhrs()->GetImu()))->Start();
63  ((IpcUs *)GetUsRangeFinder())->Start();
64 
65}
66
67
68} // end namespace meta
69} // end namespace flair
Note: See TracBrowser for help on using the repository browser.