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

Last change on this file since 7 was 7, checked in by Sanahuja Guillaume, 6 years ago

filter and meta

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