source: flair-src/trunk/lib/FlairFilter/src/JoyReference.cpp @ 15

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

sources reformatted with flair-format-dir script

File size: 2.5 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:    2012/08/29
6//  filename:   JoyReference.cpp
7//
8//  author:     Guillaume Sanahuja
9//              Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11//  version:    $Id: $
12//
13//  purpose:    generation de consignes a partir joystick
14//
15//
16/*********************************************************************/
17
18#include "JoyReference.h"
19#include "JoyReference_impl.h"
20#include <Layout.h>
21#include <LayoutPosition.h>
22#include <cvmatrix.h>
23#include <AhrsData.h>
24#include <Euler.h>
25#include <Quaternion.h>
26
27using std::string;
28using namespace flair::core;
29using namespace flair::gui;
30
31namespace flair {
32namespace filter {
33
34JoyReference::JoyReference(const LayoutPosition *position, string name)
35    : IODevice(position->getLayout(), name) {
36  pimpl_ = new JoyReference_impl(this, position, name);
37  AddDataToLog(pimpl_->output);
38  AddDataToLog(pimpl_->ahrsData);
39}
40
41JoyReference::~JoyReference(void) { delete pimpl_; }
42
43AhrsData *JoyReference::GetReferenceOrientation(void) const {
44  return pimpl_->ahrsData;
45}
46
47void JoyReference::SetRollAxis(float value) { pimpl_->SetRollAxis(value); }
48
49void JoyReference::SetPitchAxis(float value) { pimpl_->SetPitchAxis(value); }
50
51void JoyReference::SetYawAxis(float value) { pimpl_->SetYawAxis(value); }
52
53void JoyReference::SetAltitudeAxis(float value) {
54  pimpl_->SetAltitudeAxis(value);
55}
56
57void JoyReference::RollTrimUp(void) { pimpl_->RollTrimUp(); }
58
59void JoyReference::RollTrimDown(void) { pimpl_->RollTrimDown(); }
60
61void JoyReference::PitchTrimUp(void) { pimpl_->PitchTrimUp(); }
62
63void JoyReference::PitchTrimDown(void) { pimpl_->PitchTrimDown(); }
64
65void JoyReference::SetYawRef(float value) { pimpl_->SetYawRef(value); }
66
67void JoyReference::SetYawRef(core::Quaternion const &value) {
68  Euler euler;
69  value.ToEuler(euler);
70  pimpl_->SetYawRef(euler.yaw);
71}
72void JoyReference::SetZRef(float value) { pimpl_->SetZRef(value); }
73
74float JoyReference::ZRef(void) const { return pimpl_->ZRef(); }
75
76float JoyReference::DzRef(void) const { return pimpl_->dZRef(); }
77
78float JoyReference::RollTrim(void) const { return pimpl_->RollTrim(); }
79
80float JoyReference::PitchTrim(void) const { return pimpl_->PitchTrim(); }
81
82void JoyReference::Update(Time time) {
83  pimpl_->Update(time);
84  ProcessUpdate(pimpl_->output);
85}
86
87void JoyReference::UpdateFrom(const io_data *data) {
88  pimpl_->UpdateFrom(data);
89  ProcessUpdate(pimpl_->output);
90}
91
92} // end namespace sensor
93} // end namespace flair
Note: See TracBrowser for help on using the repository browser.