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

Last change on this file since 10 was 10, checked in by Sanahuja Guillaume, 8 years ago

lic

File size: 2.1 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
30{
31namespace filter
32{
33
34PidThrust::PidThrust(const LayoutPosition* position,string name) : ControlLaw(position->getLayout(),name)
35{
36 pimpl_=new PidThrust_impl(this,position,name);
37}
38
39PidThrust::~PidThrust(void)
40{
41 delete pimpl_;
42}
43
44void PidThrust::UseDefaultPlot(const flair::gui::LayoutPosition* position)
45{
46 pimpl_->UseDefaultPlot(position);
47}
48
49void PidThrust::Reset(void) {
50 pimpl_->i=0;
51 pimpl_->offset_g=0;
52}
53
54void PidThrust::ResetI(void)
55{
56 pimpl_->i=0;
57}
58
59float PidThrust::GetOffset(void) {
60 return pimpl_->offset_g;
61}
62
63void PidThrust::UpdateFrom(const io_data *data)
64{
65 pimpl_->UpdateFrom(data);
66 ProcessUpdate(output);
67}
68
69void PidThrust::SetValues(float p,float d)
70{
71 input->SetValue(0,0,p);
72 input->SetValue(1,0,d);
73}
74
75void PidThrust::ResetOffset(void)
76{
77 pimpl_->offset_g=0;
78}
79
80void PidThrust::SetOffset(void)
81{
82 pimpl_->offset_g=pimpl_->offset->Value();
83}
84
85bool PidThrust::OffsetStepUp(void)
86{
87 pimpl_->offset_g+=pimpl_->pas_offset->Value();
88 if(pimpl_->offset_g>1)
89 {
90 pimpl_->offset_g=1;
91 return false;
92 }
93 else
94 {
95 return true;
96 }
97}
98
99bool PidThrust::OffsetStepDown(void)
100{
101 pimpl_->offset_g-=pimpl_->pas_offset->Value();
102 if(pimpl_->offset_g<pimpl_->offset->Value())
103 {
104 pimpl_->offset_g=pimpl_->offset->Value();
105 return false;
106 }
107 else
108 {
109 return true;
110 }
111}
112
113} // end namespace filter
114} // end namespace flair
Note: See TracBrowser for help on using the repository browser.