[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: 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 |
|
---|
| 27 | using std::string;
|
---|
| 28 | using namespace flair::core;
|
---|
| 29 | using namespace flair::gui;
|
---|
| 30 |
|
---|
[15] | 31 | namespace flair {
|
---|
| 32 | namespace filter {
|
---|
[7] | 33 |
|
---|
[15] | 34 | JoyReference::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);
|
---|
[7] | 39 | }
|
---|
| 40 |
|
---|
[15] | 41 | JoyReference::~JoyReference(void) { delete pimpl_; }
|
---|
[7] | 42 |
|
---|
[15] | 43 | AhrsData *JoyReference::GetReferenceOrientation(void) const {
|
---|
| 44 | return pimpl_->ahrsData;
|
---|
[7] | 45 | }
|
---|
| 46 |
|
---|
[15] | 47 | void JoyReference::SetRollAxis(float value) { pimpl_->SetRollAxis(value); }
|
---|
[7] | 48 |
|
---|
[15] | 49 | void JoyReference::SetPitchAxis(float value) { pimpl_->SetPitchAxis(value); }
|
---|
[7] | 50 |
|
---|
[15] | 51 | void JoyReference::SetYawAxis(float value) { pimpl_->SetYawAxis(value); }
|
---|
[7] | 52 |
|
---|
| 53 | void JoyReference::SetAltitudeAxis(float value) {
|
---|
[15] | 54 | pimpl_->SetAltitudeAxis(value);
|
---|
[7] | 55 | }
|
---|
| 56 |
|
---|
[15] | 57 | void JoyReference::RollTrimUp(void) { pimpl_->RollTrimUp(); }
|
---|
[7] | 58 |
|
---|
[15] | 59 | void JoyReference::RollTrimDown(void) { pimpl_->RollTrimDown(); }
|
---|
[7] | 60 |
|
---|
[15] | 61 | void JoyReference::PitchTrimUp(void) { pimpl_->PitchTrimUp(); }
|
---|
[7] | 62 |
|
---|
[15] | 63 | void JoyReference::PitchTrimDown(void) { pimpl_->PitchTrimDown(); }
|
---|
[7] | 64 |
|
---|
[15] | 65 | void JoyReference::SetYawRef(float value) { pimpl_->SetYawRef(value); }
|
---|
[7] | 66 |
|
---|
| 67 | void JoyReference::SetYawRef(core::Quaternion const &value) {
|
---|
[15] | 68 | Euler euler;
|
---|
| 69 | value.ToEuler(euler);
|
---|
| 70 | pimpl_->SetYawRef(euler.yaw);
|
---|
[7] | 71 | }
|
---|
[15] | 72 | void JoyReference::SetZRef(float value) { pimpl_->SetZRef(value); }
|
---|
[7] | 73 |
|
---|
[15] | 74 | float JoyReference::ZRef(void) const { return pimpl_->ZRef(); }
|
---|
[7] | 75 |
|
---|
[15] | 76 | float JoyReference::DzRef(void) const { return pimpl_->dZRef(); }
|
---|
[7] | 77 |
|
---|
[15] | 78 | float JoyReference::RollTrim(void) const { return pimpl_->RollTrim(); }
|
---|
[7] | 79 |
|
---|
[15] | 80 | float JoyReference::PitchTrim(void) const { return pimpl_->PitchTrim(); }
|
---|
[7] | 81 |
|
---|
| 82 | void JoyReference::Update(Time time) {
|
---|
[15] | 83 | pimpl_->Update(time);
|
---|
| 84 | ProcessUpdate(pimpl_->output);
|
---|
[7] | 85 | }
|
---|
| 86 |
|
---|
| 87 | void JoyReference::UpdateFrom(const io_data *data) {
|
---|
[15] | 88 | pimpl_->UpdateFrom(data);
|
---|
| 89 | ProcessUpdate(pimpl_->output);
|
---|
[7] | 90 | }
|
---|
| 91 |
|
---|
| 92 | } // end namespace sensor
|
---|
| 93 | } // end namespace flair
|
---|