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

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

iadded isready to iodevice:
avoid problem of imu not ready in ardrone2

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