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