source: flair-src/trunk/lib/FlairSensorActuator/src/UsRangeFinder.cpp@ 422

Last change on this file since 422 was 340, checked in by Sanahuja Guillaume, 4 years ago

add servos

File size: 2.1 KB
RevLine 
[3]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[3]4// %flair:license}
5// created: 2014/01/22
6// filename: UsRangeFinder.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: Base class for UsRangeFinder
14//
15//
16/*********************************************************************/
17
18#include "UsRangeFinder.h"
19#include <FrameworkManager.h>
20#include <Tab.h>
21#include <TabWidget.h>
22#include <GroupBox.h>
23#include <Layout.h>
24#include <DataPlot1D.h>
[214]25#include <Matrix.h>
[3]26
27using std::string;
28using namespace flair::core;
29using namespace flair::gui;
30
[15]31namespace flair {
32namespace sensor {
[3]33
[137]34UsRangeFinder::UsRangeFinder(string name)
35 : IODevice(getFrameworkManager(), name) {
[15]36 plot_tab = NULL;
[3]37
[318]38 MatrixDescriptor *desc = new MatrixDescriptor(1, 1);
[15]39 desc->SetElementName(0, 0, name);
[214]40 output = new Matrix(this, desc, floatType);
[148]41 delete desc;
[15]42 AddDataToLog(output);
[3]43
[15]44 // station sol
[137]45 main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
[15]46 tab = new TabWidget(main_tab->NewRow(), name);
47 sensor_tab = new Tab(tab, "Reglages");
48 setup_groupbox = new GroupBox(sensor_tab->NewRow(), name);
[3]49}
50
[15]51UsRangeFinder::~UsRangeFinder() {
52 delete main_tab;
[3]53}
54
[15]55GroupBox *UsRangeFinder::GetGroupBox(void) const { return setup_groupbox; }
[3]56
[15]57Layout *UsRangeFinder::GetLayout(void) const { return sensor_tab; }
[3]58
[15]59DataPlot1D *UsRangeFinder::GetPlot(void) const { return plot; }
[3]60
[15]61Tab *UsRangeFinder::GetPlotTab(void) const { return plot_tab; }
[3]62
[221]63TabWidget *UsRangeFinder::GetTabWidget(void) const { return tab; }
64
[15]65void UsRangeFinder::UseDefaultPlot(void) {
66 plot_tab = new Tab(tab, "Mesures");
67 plot = new DataPlot1D(plot_tab->NewRow(), ObjectName(), 0, 2);
68 plot->AddCurve(output->Element(0));
[3]69}
70
[15]71void UsRangeFinder::LockUserInterface(void) const {
72 setup_groupbox->setEnabled(false);
[3]73}
74
[15]75void UsRangeFinder::UnlockUserInterface(void) const {
76 setup_groupbox->setEnabled(true);
[3]77}
78
[15]79float UsRangeFinder::Value(void) const { return output->Value(0, 0); }
[3]80
81} // end namespace sensor
82} // end namespace flair
Note: See TracBrowser for help on using the repository browser.