Changeset 15 in flair-src for trunk/lib/FlairFilter/src/PidThrust.cpp
- Timestamp:
- 04/08/16 15:40:57 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairFilter/src/PidThrust.cpp
r10 r15 27 27 using namespace flair::gui; 28 28 29 namespace flair 30 { 31 namespace filter 32 { 29 namespace flair { 30 namespace filter { 33 31 34 PidThrust::PidThrust(const LayoutPosition * position,string name) : ControlLaw(position->getLayout(),name)35 {36 pimpl_=new PidThrust_impl(this,position,name);32 PidThrust::PidThrust(const LayoutPosition *position, string name) 33 : ControlLaw(position->getLayout(), name) { 34 pimpl_ = new PidThrust_impl(this, position, name); 37 35 } 38 36 39 PidThrust::~PidThrust(void) 40 { 41 delete pimpl_; 42 } 37 PidThrust::~PidThrust(void) { delete pimpl_; } 43 38 44 void PidThrust::UseDefaultPlot(const flair::gui::LayoutPosition* position) 45 { 46 pimpl_->UseDefaultPlot(position); 39 void PidThrust::UseDefaultPlot(const flair::gui::LayoutPosition *position) { 40 pimpl_->UseDefaultPlot(position); 47 41 } 48 42 49 43 void PidThrust::Reset(void) { 50 pimpl_->i=0;51 pimpl_->offset_g=0;44 pimpl_->i = 0; 45 pimpl_->offset_g = 0; 52 46 } 53 47 54 void PidThrust::ResetI(void) 55 { 56 pimpl_->i=0; 48 void PidThrust::ResetI(void) { pimpl_->i = 0; } 49 50 float PidThrust::GetOffset(void) { return pimpl_->offset_g; } 51 52 void PidThrust::UpdateFrom(const io_data *data) { 53 pimpl_->UpdateFrom(data); 54 ProcessUpdate(output); 57 55 } 58 56 59 float PidThrust::GetOffset(void) { 60 return pimpl_->offset_g; 57 void PidThrust::SetValues(float p, float d) { 58 input->SetValue(0, 0, p); 59 input->SetValue(1, 0, d); 61 60 } 62 61 63 void PidThrust::UpdateFrom(const io_data *data) 64 { 65 pimpl_->UpdateFrom(data); 66 ProcessUpdate(output); 62 void PidThrust::ResetOffset(void) { pimpl_->offset_g = 0; } 63 64 void PidThrust::SetOffset(void) { pimpl_->offset_g = pimpl_->offset->Value(); } 65 66 bool PidThrust::OffsetStepUp(void) { 67 pimpl_->offset_g += pimpl_->pas_offset->Value(); 68 if (pimpl_->offset_g > 1) { 69 pimpl_->offset_g = 1; 70 return false; 71 } else { 72 return true; 73 } 67 74 } 68 75 69 void PidThrust::SetValues(float p,float d) 70 { 71 input->SetValue(0,0,p); 72 input->SetValue(1,0,d); 73 } 74 75 void PidThrust::ResetOffset(void) 76 { 77 pimpl_->offset_g=0; 78 } 79 80 void PidThrust::SetOffset(void) 81 { 82 pimpl_->offset_g=pimpl_->offset->Value(); 83 } 84 85 bool 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 99 bool 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 } 76 bool PidThrust::OffsetStepDown(void) { 77 pimpl_->offset_g -= pimpl_->pas_offset->Value(); 78 if (pimpl_->offset_g < pimpl_->offset->Value()) { 79 pimpl_->offset_g = pimpl_->offset->Value(); 80 return false; 81 } else { 82 return true; 83 } 111 84 } 112 85
Note:
See TracChangeset
for help on using the changeset viewer.