source: flair-src/trunk/lib/FlairMeta/src/SimuX4.cpp@ 10

Last change on this file since 10 was 10, checked in by Sanahuja Guillaume, 6 years ago

lic

File size: 1.9 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: 2016/02/08
6// filename: SimuX4.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class defining a simultation x4 uav
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
29using std::string;
30using namespace flair::core;
31using namespace flair::gui;
32using namespace flair::sensor;
33using namespace flair::filter;
34using namespace flair::actuator;
35
36namespace flair { namespace meta {
37
38SimuX4::SimuX4(FrameworkManager* parent,string uav_name,int simu_id,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
39
40 if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X4));
41
42 SetBldc(new SimuBldc(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),simu_id));
43 SetUsRangeFinder(new SimuUs(parent,"us",simu_id,60));
44 SetAhrs(new SimuAhrs(parent,"imu",simu_id,70));
45 Tab* bat_tab=new Tab(parent->GetTabWidget(),"battery");
46 SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(),"battery"));
47 GetBatteryMonitor()->SetBatteryValue(12);
48 SetVerticalCamera(new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
49}
50
51SimuX4::~SimuX4() {
52
53}
54
55void SimuX4::StartSensors(void) {
56 ((SimuAhrs*)GetAhrs())->Start();
57 ((SimuUs*)GetUsRangeFinder())->Start();
58 ((SimuCamera *)GetVerticalCamera())->Start();
59 Uav::StartSensors();
60}
61
62void SimuX4::SetupVRPNAutoIP(string name) {
63 SetupVRPN("127.0.0.1:3883",name);
64}
65
66} // end namespace meta
67} // end namespace flair
Note: See TracBrowser for help on using the repository browser.