source: flair-src/trunk/lib/FlairMeta/src/UavFactory.cpp@ 32

Last change on this file since 32 was 15, checked in by Bayard Gildas, 9 years ago

sources reformatted with flair-format-dir script

File size: 1.9 KB
RevLine 
[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/05
6// filename: UavFactory.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: construct a Uav based on the type name
14//
15//
16/*********************************************************************/
17
18#include "UavFactory.h"
19#include "FrameworkManager.h"
20//#include "ArDrone2.h"
21#include "SimuX4.h"
22#include "SimuX8.h"
23#include "HdsX8.h"
24#include "XAir.h"
25
26using namespace std;
27using namespace flair::core;
28using namespace flair::filter;
29using namespace flair::meta;
30
[15]31Uav *CreateUav(FrameworkManager *parent, string uav_name, string uav_type,
32 UavMultiplex *multiplex) {
33 /*if(uav_type=="ardrone2") {
[7]34 return new ArDrone2(parent,uav_name,multiplex);
[15]35 } else */ if (uav_type == "hds_x4") {
36 parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());
37 return NULL;
38 } else if (uav_type == "hds_x8") {
39 return new HdsX8(parent, uav_name, multiplex);
40 } else if (uav_type == "xair") {
41 return new XAir(parent, uav_name, multiplex);
42 } else if (uav_type == "hds_xufo") {
43 parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());
44 return NULL;
45 } else if (uav_type.compare(0, 7, "x4_simu") == 0) {
46 int simu_id = 0;
47 if (uav_type.size() > 7) {
48 simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str());
[7]49 }
[15]50 return new SimuX4(parent, uav_name, simu_id, multiplex);
51 } else if (uav_type.compare(0, 7, "x8_simu") == 0) {
52 int simu_id = 0;
53 if (uav_type.size() > 7) {
54 simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str());
55 }
56 return new SimuX8(parent, uav_name, simu_id, multiplex);
57 } else {
58 parent->Err("UAV type %s unknown\n", uav_type.c_str());
59 return NULL;
60 }
[7]61}
Note: See TracBrowser for help on using the repository browser.