source: flair-src/trunk/lib/FlairMeta/src/SimuX8.cpp @ 7

Last change on this file since 7 was 7, checked in by Sanahuja Guillaume, 5 years ago

filter and meta

File size: 1.8 KB
Line 
1//  created:    2016/02/08
2//  filename:   SimuX8.cpp
3//
4//  author:     Guillaume Sanahuja
5//              Copyright Heudiasyc UMR UTC/CNRS 7253
6//
7//  version:    $Id: $
8//
9//  purpose:    Class defining a simultation x4 uav
10//
11//
12/*********************************************************************/
13
14#include "SimuX8.h"
15#include <FrameworkManager.h>
16#include <X4X8Multiplex.h>
17#include <SimuImu.h>
18#include <SimuAhrs.h>
19#include <SimuBldc.h>
20#include <SimuUs.h>
21#include <SimuCamera.h>
22#include <BatteryMonitor.h>
23#include <Tab.h>
24
25using std::string;
26using namespace flair::core;
27using namespace flair::gui;
28using namespace flair::sensor;
29using namespace flair::filter;
30using namespace flair::actuator;
31
32namespace flair { namespace meta {
33
34SimuX8::SimuX8(FrameworkManager* parent,string uav_name,int simu_id,filter::UavMultiplex *multiplex) : Uav(parent,uav_name,multiplex) {
35
36    if(multiplex==NULL) SetMultiplex(new X4X8Multiplex(parent,"motors",X4X8Multiplex::X8));
37
38    SetBldc(new SimuBldc(GetUavMultiplex(),GetUavMultiplex()->GetLayout(),"motors",GetUavMultiplex()->MotorsCount(),simu_id));
39    SetUsRangeFinder(new SimuUs(parent,"us",simu_id,60));
40    SetAhrs(new SimuAhrs(parent,"imu",simu_id,70));
41    Tab* bat_tab=new Tab(parent->GetTabWidget(),"battery");
42    SetBatteryMonitor(new BatteryMonitor(bat_tab->NewRow(),"battery"));
43    GetBatteryMonitor()->SetBatteryValue(12);
44    SetVerticalCamera(new SimuCamera(parent, "simu_cam_v", 320, 240, 3, simu_id, 10));
45}
46
47SimuX8::~SimuX8() {
48
49}
50
51void SimuX8::StartSensors(void) {
52    ((SimuAhrs*)GetAhrs())->Start();
53    ((SimuUs*)GetUsRangeFinder())->Start();
54    ((SimuCamera *)GetVerticalCamera())->Start();
55    Uav::StartSensors();
56}
57
58void SimuX8::SetupVRPNAutoIP(string name) {
59    SetupVRPN("127.0.0.1:3883",name);
60}
61
62} // end namespace meta
63} // end namespace flair
Note: See TracBrowser for help on using the repository browser.