source: flair-src/trunk/lib/FlairFilter/src/SimuAhrs.cpp @ 137

Last change on this file since 137 was 137, checked in by Sanahuja Guillaume, 4 years ago

singleton manager

File size: 1.3 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:    2014/02/07
6//  filename:   SimuAhrs.cpp
7//
8//  author:     Guillaume Sanahuja
9//              Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11//  version:    $Id: $
12//
13//  purpose:    Class for a simulation ahrs
14//
15//
16/*********************************************************************/
17
18#include "SimuAhrs.h"
19#include "SimuImu.h"
20#include <AhrsData.h>
21
22using std::string;
23using namespace flair::core;
24using namespace flair::sensor;
25
26namespace flair {
27namespace filter {
28
29SimuAhrs::SimuAhrs(string name, uint32_t dev_id,
30                   uint8_t priority)
31    : Ahrs(new SimuImu(name, dev_id, priority), name) {}
32
33SimuAhrs::~SimuAhrs() {}
34
35void SimuAhrs::Start(void) { ((SimuImu *)GetImu())->Start(); }
36
37// datas from SimuImu are AhrsData!
38void SimuAhrs::UpdateFrom(const io_data *data) {
39  AhrsData *input = (AhrsData *)data;
40  AhrsData *output;
41  GetDatas(&output);
42
43  Quaternion quaternion;
44  Vector3D filteredAngRates;
45  input->GetQuaternionAndAngularRates(quaternion, filteredAngRates);
46  output->SetQuaternionAndAngularRates(quaternion, filteredAngRates);
47  output->SetDataTime(input->DataTime());
48
49  ProcessUpdate(output);
50}
51
52} // end namespace filter
53} // end namespace flair
Note: See TracBrowser for help on using the repository browser.