[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: 2013/01/16
|
---|
| 6 | // filename: Gx3_25_ahrs.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: class for 3dmgx3-25 ahrs
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "Gx3_25_ahrs.h"
|
---|
| 19 | #include <FrameworkManager.h>
|
---|
| 20 | #include <AhrsData.h>
|
---|
[99] | 21 | #include <OneAxisRotation.h>
|
---|
[7] | 22 |
|
---|
| 23 | using std::string;
|
---|
| 24 | using namespace flair::core;
|
---|
| 25 | using namespace flair::sensor;
|
---|
| 26 |
|
---|
[15] | 27 | namespace flair {
|
---|
| 28 | namespace filter {
|
---|
[7] | 29 |
|
---|
[15] | 30 | Gx3_25_ahrs::Gx3_25_ahrs(const FrameworkManager *parent, string name,
|
---|
| 31 | SerialPort *serialport, Gx3_25_imu::Command_t command,
|
---|
| 32 | uint8_t priority)
|
---|
| 33 | : Ahrs(new Gx3_25_imu(parent, name, serialport, command, priority), name) {}
|
---|
[7] | 34 |
|
---|
[15] | 35 | Gx3_25_ahrs::~Gx3_25_ahrs() {}
|
---|
[7] | 36 |
|
---|
[15] | 37 | void Gx3_25_ahrs::Start(void) { ((Gx3_25_imu *)GetImu())->Start(); }
|
---|
[7] | 38 |
|
---|
[15] | 39 | // datas from Gx3_25_imu are AhrsData!
|
---|
[7] | 40 | void Gx3_25_ahrs::UpdateFrom(const io_data *data) {
|
---|
[15] | 41 | AhrsData *input = (AhrsData *)data;
|
---|
| 42 | AhrsData *output;
|
---|
| 43 | GetDatas(&output);
|
---|
[7] | 44 |
|
---|
[15] | 45 | Quaternion quaternion;
|
---|
| 46 | Vector3D filteredAngRates;
|
---|
| 47 | input->GetQuaternionAndAngularRates(quaternion, filteredAngRates);
|
---|
[99] | 48 | GetImu()->GetOneAxisRotation()->ComputeRotation(quaternion);
|
---|
| 49 | GetImu()->GetOneAxisRotation()->ComputeRotation(filteredAngRates);
|
---|
[15] | 50 | output->SetQuaternionAndAngularRates(quaternion, filteredAngRates);
|
---|
| 51 | output->SetDataTime(input->DataTime());
|
---|
[7] | 52 |
|
---|
[15] | 53 | ProcessUpdate(output);
|
---|
[7] | 54 | }
|
---|
| 55 |
|
---|
| 56 | } // end namespace filter
|
---|
| 57 | } // end namespace flair
|
---|