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

Last change on this file was 340, checked in by Sanahuja Guillaume, 23 months ago

add servos

File size: 2.1 KB
Line 
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:    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>
25#include <Matrix.h>
26
27using std::string;
28using namespace flair::core;
29using namespace flair::gui;
30
31namespace flair {
32namespace sensor {
33
34UsRangeFinder::UsRangeFinder(string name)
35    : IODevice(getFrameworkManager(), name) {
36  plot_tab = NULL;
37
38  MatrixDescriptor *desc = new MatrixDescriptor(1, 1);
39  desc->SetElementName(0, 0, name);
40  output = new Matrix(this, desc, floatType);
41  delete desc;
42  AddDataToLog(output);
43
44  // station sol
45  main_tab = new Tab(getFrameworkManager()->GetTabWidget(), name);
46  tab = new TabWidget(main_tab->NewRow(), name);
47  sensor_tab = new Tab(tab, "Reglages");
48  setup_groupbox = new GroupBox(sensor_tab->NewRow(), name);
49}
50
51UsRangeFinder::~UsRangeFinder() {
52    delete main_tab;
53}
54
55GroupBox *UsRangeFinder::GetGroupBox(void) const { return setup_groupbox; }
56
57Layout *UsRangeFinder::GetLayout(void) const { return sensor_tab; }
58
59DataPlot1D *UsRangeFinder::GetPlot(void) const { return plot; }
60
61Tab *UsRangeFinder::GetPlotTab(void) const { return plot_tab; }
62
63TabWidget *UsRangeFinder::GetTabWidget(void) const { return tab; }
64
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));
69}
70
71void UsRangeFinder::LockUserInterface(void) const {
72  setup_groupbox->setEnabled(false);
73}
74
75void UsRangeFinder::UnlockUserInterface(void) const {
76  setup_groupbox->setEnabled(true);
77}
78
79float UsRangeFinder::Value(void) const { return output->Value(0, 0); }
80
81} // end namespace sensor
82} // end namespace flair
Note: See TracBrowser for help on using the repository browser.