[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: 2011/05/01
|
---|
| 6 | // filename: Pid.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Class defining a PID
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "Pid.h"
|
---|
| 19 | #include "Pid_impl.h"
|
---|
| 20 | #include <cvmatrix.h>
|
---|
| 21 | #include <Layout.h>
|
---|
| 22 | #include <LayoutPosition.h>
|
---|
| 23 |
|
---|
| 24 | using std::string;
|
---|
| 25 | using namespace flair::core;
|
---|
| 26 | using namespace flair::gui;
|
---|
| 27 |
|
---|
[15] | 28 | namespace flair {
|
---|
| 29 | namespace filter {
|
---|
[7] | 30 |
|
---|
[15] | 31 | Pid::Pid(const LayoutPosition *position, string name)
|
---|
| 32 | : ControlLaw(position->getLayout(), name) {
|
---|
| 33 | pimpl_ = new Pid_impl(this, position, name);
|
---|
[157] | 34 |
|
---|
| 35 | SetIsReady(true);
|
---|
[7] | 36 | }
|
---|
| 37 |
|
---|
[15] | 38 | Pid::~Pid(void) { delete pimpl_; }
|
---|
[7] | 39 |
|
---|
[15] | 40 | void Pid::UseDefaultPlot(const gui::LayoutPosition *position) {
|
---|
| 41 | pimpl_->UseDefaultPlot(position);
|
---|
[7] | 42 | }
|
---|
| 43 |
|
---|
| 44 | void Pid::Reset(void) {
|
---|
[15] | 45 | pimpl_->i = 0;
|
---|
| 46 | pimpl_->first_update = true;
|
---|
[7] | 47 | }
|
---|
| 48 |
|
---|
| 49 | void Pid::UpdateFrom(const io_data *data) {
|
---|
[15] | 50 | pimpl_->UpdateFrom(data);
|
---|
| 51 | ProcessUpdate(output);
|
---|
[7] | 52 | }
|
---|
| 53 |
|
---|
[15] | 54 | void Pid::SetValues(float p, float d) {
|
---|
| 55 | input->SetValue(0, 0, p);
|
---|
| 56 | input->SetValue(1, 0, d);
|
---|
[7] | 57 | }
|
---|
| 58 |
|
---|
| 59 | } // end namespace filter
|
---|
| 60 | } // end namespace flair
|
---|