types.hh
1/*
2 * Player - One Hell of a Robot Server
3 * Copyright (C) 2010
4 * Alejandro R. Mosteo
5 *
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef TYPES_HH_
23#define TYPES_HH_
24
25#include <vector>
26
27typedef std::vector<double> DoublesVector;
28
30{
31public:
32 double x1, y1, x2, y2;
33 Segment(double x1, double y1, double x2, double y2)
34 {
35 this->x1 = x1; this->y1 = y1;
36 this->x2 = x2; this->y2 = y2;
37 }
38};
39
40typedef std::vector<Segment> SegmentsVector;
41
42class Pose
43{
44public:
45 double x, y, th;
46 Pose(double x, double y, double th)
47 {
48 this->x = x; this->y = y; this->th = th;
49 }
50};
51
53{
54 public:
55 GuiSegment(double rho0, double phi0, double rho1, double phi1) :
56 rho0_(rho0), phi0_(phi0), rho1_(rho1), phi1_(phi1) {};
57
58 double rho0(void) const { return rho0_; };
59 double rho1(void) const { return rho1_; };
60 double phi0(void) const { return phi0_; };
61 double phi1(void) const { return phi1_; };
62 private:
63 double rho0_, phi0_, rho1_, phi1_;
64};
65
66class GuiRegion : public GuiSegment
67{
68 public:
69 GuiRegion(double rho0, double phi0, double rho1, double phi1) :
70 GuiSegment(rho0, phi0, rho1, phi1) {};
71};
72
73class GuiSplit : public GuiSegment
74{
75 public:
76 GuiSplit(double rho0, double phi0, double rho1, double phi1) :
77 GuiSegment(rho0, phi0, rho1, phi1) {};
78};
79
81{
82 public:
83 void Clear(void)
84 {
85 regions.clear(); splits.clear(); matches.clear(); mahala.clear();
86 laser_rho.clear(); laser_phi.clear();
87 }
88
89 std::vector<GuiRegion> regions;
90 std::vector<GuiSplit> splits;
91 std::vector<GuiSplit> matches; // lasers that match
92 std::vector<double> mahala; // mahala distance of the match, norm to 1
93 std::vector<double> laser_rho;
94 std::vector<double> laser_phi;
95};
96
97extern GuiData GUI_DATA; // Declared in the driver, for passing via the opaque
98
99#endif /* TYPES_HH_ */
Definition types.hh:81
Definition types.hh:67
Definition types.hh:53
Definition types.hh:74
Definition types.hh:43
Definition types.hh:30