source: flair-src/trunk/lib/FlairFilter/src/PidThrust.cpp@ 206

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

m

File size: 2.0 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: 2014/11/07
6// filename: PidThrust.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Class defining a PidThrust
14//
15//
16/*********************************************************************/
17
18#include "PidThrust.h"
19#include "PidThrust_impl.h"
20#include <cvmatrix.h>
21#include <Layout.h>
22#include <LayoutPosition.h>
23#include <DoubleSpinBox.h>
24
25using std::string;
26using namespace flair::core;
27using namespace flair::gui;
28
29namespace flair {
30namespace filter {
31
32PidThrust::PidThrust(const LayoutPosition *position, string name)
33 : ControlLaw(position->getLayout(), name) {
34 pimpl_ = new PidThrust_impl(this, position, name);
35
36 SetIsReady(true);
37}
38
39PidThrust::~PidThrust(void) { delete pimpl_; }
40
41void PidThrust::UseDefaultPlot(const flair::gui::LayoutPosition *position) {
42 pimpl_->UseDefaultPlot(position);
43}
44
45void PidThrust::ResetI(void) { pimpl_->i = 0; }
46
47float PidThrust::GetOffset(void) { return pimpl_->offset_g; }
48
49void PidThrust::UpdateFrom(const io_data *data) {
50 pimpl_->UpdateFrom(data);
51 ProcessUpdate(output);
52}
53
54void PidThrust::SetValues(float p, float d) {
55 input->SetValue(0, 0, p);
56 input->SetValue(1, 0, d);
57}
58
59void PidThrust::SetDefaultOffset(void) { pimpl_->offset_g = pimpl_->offset->Value(); }
60
61void PidThrust::SetOffset(float value) { pimpl_->offset_g = value; }
62
63bool PidThrust::OffsetStepUp(void) {
64 pimpl_->offset_g += pimpl_->pas_offset->Value();
65 if (pimpl_->offset_g > 1) {
66 pimpl_->offset_g = 1;
67 return false;
68 } else {
69 return true;
70 }
71}
72
73bool PidThrust::OffsetStepDown(void) {
74 pimpl_->offset_g -= pimpl_->pas_offset->Value();
75 if (pimpl_->offset_g < pimpl_->offset->Value()) {
76 pimpl_->offset_g = pimpl_->offset->Value();
77 return false;
78 } else {
79 return true;
80 }
81}
82
83} // end namespace filter
84} // end namespace flair
Note: See TracBrowser for help on using the repository browser.