[376] | 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: 2020/12/09
|
---|
| 6 | // filename: UgvControls.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Virtual class for igv controls
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "UgvControls.h"
|
---|
| 19 | #include <Matrix.h>
|
---|
[377] | 20 | #include <FrameworkManager.h>
|
---|
| 21 | #include <Tab.h>
|
---|
| 22 | #include <DataPlot1D.h>
|
---|
[376] | 23 |
|
---|
| 24 | using namespace flair::core;
|
---|
[377] | 25 | using namespace flair::gui;
|
---|
[376] | 26 |
|
---|
| 27 | using std::string;
|
---|
| 28 |
|
---|
| 29 | namespace flair {
|
---|
| 30 | namespace actuator {
|
---|
| 31 |
|
---|
[377] | 32 | UgvControls::UgvControls(string name)
|
---|
| 33 | : IODevice(getFrameworkManager(), name) {
|
---|
| 34 | mainTab = new Tab(getFrameworkManager()->GetTabWidget(), name);
|
---|
[376] | 35 |
|
---|
| 36 | MatrixDescriptor *desc = new MatrixDescriptor(2, 1);
|
---|
| 37 | desc->SetElementName(0, 0, "speed");
|
---|
| 38 | desc->SetElementName(1, 0, "turn");
|
---|
| 39 |
|
---|
| 40 | output = new Matrix(this, desc, floatType);
|
---|
| 41 | delete desc;
|
---|
| 42 | AddDataToLog(output);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | UgvControls::~UgvControls() {
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | void UgvControls::UseDefaultPlot(void) {
|
---|
[377] | 49 | DataPlot1D *speedPlot = new DataPlot1D(mainTab->NewRow(), "speed", -1, 1);
|
---|
| 50 | speedPlot->AddCurve(output->Element(0));
|
---|
| 51 | DataPlot1D *turnPlot = new DataPlot1D(mainTab->LastRowLastCol(), "turn", -1, 1);
|
---|
| 52 | turnPlot->AddCurve(output->Element(1));
|
---|
[376] | 53 | }
|
---|
| 54 |
|
---|
| 55 | Matrix *UgvControls::Output(void) const {
|
---|
| 56 | return output;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 | } // end namespace actuator
|
---|
| 61 | } // end namespace flair
|
---|