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

Last change on this file since 214 was 214, checked in by Sanahuja Guillaume, 3 years ago

matrix

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 <Matrix.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  SetIsReady(true);
41}
42
43JoyReference::~JoyReference(void) { delete pimpl_; }
44
45AhrsData *JoyReference::GetReferenceOrientation(void) const {
46  return pimpl_->ahrsData;
47}
48
49void JoyReference::SetRollAxis(float value) { pimpl_->SetRollAxis(value); }
50
51void JoyReference::SetPitchAxis(float value) { pimpl_->SetPitchAxis(value); }
52
53void JoyReference::SetYawAxis(float value) { pimpl_->SetYawAxis(value); }
54
55void JoyReference::SetAltitudeAxis(float value) {
56  pimpl_->SetAltitudeAxis(value);
57}
58
59void JoyReference::RollTrimUp(void) { pimpl_->RollTrimUp(); }
60
61void JoyReference::RollTrimDown(void) { pimpl_->RollTrimDown(); }
62
63void JoyReference::PitchTrimUp(void) { pimpl_->PitchTrimUp(); }
64
65void JoyReference::PitchTrimDown(void) { pimpl_->PitchTrimDown(); }
66
67void JoyReference::SetYawRef(float value) { pimpl_->SetYawRef(value); }
68
69void JoyReference::SetYawRef(core::Quaternion const &value) {
70  Euler euler;
71  value.ToEuler(euler);
72  pimpl_->SetYawRef(euler.yaw);
73}
74void JoyReference::SetZRef(float value) { pimpl_->SetZRef(value); }
75
76float JoyReference::ZRef(void) const { return pimpl_->ZRef(); }
77
78float JoyReference::DzRef(void) const { return pimpl_->dZRef(); }
79
80float JoyReference::RollTrim(void) const { return pimpl_->RollTrim(); }
81
82float JoyReference::PitchTrim(void) const { return pimpl_->PitchTrim(); }
83
84void JoyReference::Update(Time time) {
85  pimpl_->Update(time);
86  ProcessUpdate(pimpl_->output);
87}
88
89void JoyReference::UpdateFrom(const io_data *data) {
90  pimpl_->UpdateFrom(data);
91  ProcessUpdate(pimpl_->output);
92}
93
94} // end namespace sensor
95} // end namespace flair
Note: See TracBrowser for help on using the repository browser.