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/07/23
|
---|
6 | // filename: RangeFinderPlot.cpp
|
---|
7 | //
|
---|
8 | // author: Guillaume Sanahuja
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: Class displaying a 2D plot on the ground station for laser range
|
---|
14 | // finder like Hokuyo
|
---|
15 | //
|
---|
16 | //
|
---|
17 | /*********************************************************************/
|
---|
18 |
|
---|
19 | #include "RangeFinderPlot.h"
|
---|
20 | #include "Matrix.h"
|
---|
21 | #include "LayoutPosition.h"
|
---|
22 | #include <cxcore.h>
|
---|
23 |
|
---|
24 | using std::string;
|
---|
25 | using namespace flair::core;
|
---|
26 |
|
---|
27 | namespace flair {
|
---|
28 | namespace gui {
|
---|
29 |
|
---|
30 | RangeFinderPlot::RangeFinderPlot(const LayoutPosition *position, string name,
|
---|
31 | string x_name, float xmin, float xmax,
|
---|
32 | string y_name, float ymin, float ymax,
|
---|
33 | const Matrix *datas, float start_angle,
|
---|
34 | float end_angle, uint32_t nb_samples)
|
---|
35 | : SendData(position, name, "RangeFinderPlot", 200) {
|
---|
36 | this->datas = datas;
|
---|
37 |
|
---|
38 | SetSendSize(datas->GetDataType().GetSize());
|
---|
39 |
|
---|
40 | SetVolatileXmlProp("xmin", xmin);
|
---|
41 | SetVolatileXmlProp("xmax", xmax);
|
---|
42 | SetVolatileXmlProp("ymin", ymin);
|
---|
43 | SetVolatileXmlProp("ymax", ymax);
|
---|
44 | SetVolatileXmlProp("x_name", x_name);
|
---|
45 | SetVolatileXmlProp("y_name", y_name);
|
---|
46 | SetVolatileXmlProp("start_angle", start_angle);
|
---|
47 | SetVolatileXmlProp("end_angle", end_angle);
|
---|
48 | SetVolatileXmlProp("nb_samples", nb_samples);
|
---|
49 | SetVolatileXmlProp(
|
---|
50 | "type", datas->GetDataType().GetElementDataType().GetDescription());
|
---|
51 | SendXml();
|
---|
52 |
|
---|
53 | if (datas->Cols() != 1 || datas->Rows() != nb_samples)
|
---|
54 | Err("Wrong input matrix size\n");
|
---|
55 | }
|
---|
56 |
|
---|
57 | RangeFinderPlot::~RangeFinderPlot() {}
|
---|
58 |
|
---|
59 | void RangeFinderPlot::CopyDatas(char *buf) const {
|
---|
60 | datas->RawRead(buf);
|
---|
61 | }
|
---|
62 |
|
---|
63 | } // end namespace gui
|
---|
64 | } // end namespace flair
|
---|