feature.hh
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2010
4  * Mayte Lázaro, 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 FEATURE_H_
23 #define FEATURE_H_
24 
25 
26 #define MAX_OBS_FEATURES 100
27 
28 #include <vector>
29 #include "scan.hh"
30 #include "types.hh"
31 #include "uloc.hh"
32 
33 class Feature
34 {
35 public:
37  Feature(GeometricEntityKinds entity_kind);
38  virtual ~Feature();
39 
40  double dimension() const;
41  double codimension() const;
42  const Transf& Loc() const;
43 
44  const MatrixXd& Cov() const;
45  double Cov(int i, int j) const;
46  void SetCov(const MatrixXd& c) { uloc_.SetCov(c); };
47 
48  const Uloc& uloc(void) const { return uloc_; };
49  void set_uloc(const Uloc& u) { uloc_ = u; };
50 
51  void ComputeSegmentLength(Uloc p1, Uloc p2);
52 
53  void SetScan(const GuiSplit &split) { split_ = split; };
54  // Keep the original raw data for debug
55  const GuiSplit &GetScan(void) const { return split_; };
56 private:
57  void GeometricRelationsObservationPointToPoint(Uloc Lsp1, Uloc Lsp2);
58 
59  double dimension_;
60  double codimension_;
61  Uloc uloc_;
62 
63  GuiSplit split_;
64 };
65 
66 
68 {
69 public:
71  virtual ~ObservedFeatures();
72 
73  void AddObservedFeature(Feature f);
74  int Count() const;
75  //void SetPaired(int i, bool b);
76  const Feature & features(int f) const;
77 
78  void Clear(void) { features_.clear(); }
79 
80 private:
81  vector<Feature> features_;
82  vector<bool> is_paired_;
83 };
84 
85 void ScanDataSegmentation(const Scan &laser_raw_data, ObservedFeatures *feat_table);
86 
87 #endif /* FEATURE_H_ */
Definition: feature.hh:67
Definition: feature.hh:33
Feature(GeometricEntityKinds entity_kind)
Defaults to EDGE.
Definition: feature.cc:27
Definition: transf.hh:36
Definition: uloc.hh:32
Definition: types.hh:73
Definition: scan.hh:30