Main MRPT website > C++ reference for MRPT 1.9.9
ClearanceDiagram.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <vector>
12 #include <map>
13 #include <cstdint>
15 namespace mrpt
16 {
17 namespace utils
18 {
19 class CStream;
20 }
21 }
22 
23 namespace mrpt
24 {
25 namespace nav
26 {
27 /** Clearance information for one particular PTG and one set of obstacles.
28  * Usage:
29  * - Declare an object of this type (it will be initialized to "empty"),
30  * - Call CParameterizedTrajectoryGenerator::initClearanceDiagram()
31  * - Repeatedly call CParameterizedTrajectoryGenerator::updateClearance() for
32  * each 2D obstacle point.
33  *
34  * \ingroup nav_tpspace
35  */
37 {
38  public:
39  /** default ctor */
41  /** Reset to default, empty state */
42  void clear();
43  /** Initializes the container to allocate `decimated_num_paths` entries, as
44  * a decimated
45  * subset of a total of `actual_num_paths` paths */
46  void resize(size_t actual_num_paths, size_t decimated_num_paths);
47  inline bool empty() const { return m_raw_clearances.empty(); }
48  inline size_t get_actual_num_paths() const { return m_actual_num_paths; }
49  inline size_t get_decimated_num_paths() const
50  {
51  return m_raw_clearances.size();
52  }
53 
54  /** Gets the clearance for path `k` and distance `TPS_query_distance` in one
55  * of two modes:
56  * - [integrate_over_path=false] clearance from that specific spot, or
57  * - [integrate_over_path=true] average clearance over the path from the
58  * origin to that specific spot.
59  */
60  double getClearance(
61  uint16_t k, double TPS_query_distance, bool integrate_over_path) const;
62  void renderAs3DObject(
63  mrpt::opengl::CMesh& mesh, double min_x, double max_x, double min_y,
64  double max_y, double cell_res, bool integrate_over_path) const;
65 
67  void writeToStream(mrpt::utils::CStream& out) const;
68 
69  /** [TPS_distance] => normalized_clearance_for_exactly_that_robot_pose */
70  typedef std::map<double, double> dist2clearance_t;
71  dist2clearance_t& get_path_clearance(size_t actual_k);
72  const dist2clearance_t& get_path_clearance(size_t actual_k) const;
73 
75  {
76  return m_raw_clearances[decim_k];
77  }
79  size_t decim_k) const
80  {
81  return m_raw_clearances[decim_k];
82  }
83 
84  size_t real_k_to_decimated_k(size_t k) const;
85  size_t decimated_k_to_real_k(size_t k) const;
86 
87  protected:
88  /** Container: [decimated_path_k][TPS_distance] =>
89  * normalized_clearance_for_exactly_that_robot_pose */
90  std::vector<dist2clearance_t> m_raw_clearances;
91 
92  size_t m_actual_num_paths; // The decimated number of paths is implicit in
93  // raw_clearances.size()
94  double m_k_a2d, m_k_d2a;
95 };
96 
97 } // ns
98 } // ns
size_t get_decimated_num_paths() const
unsigned __int16 uint16_t
Definition: rptypes.h:44
dist2clearance_t & get_path_clearance_decimated(size_t decim_k)
void clear()
Reset to default, empty state.
std::vector< dist2clearance_t > m_raw_clearances
Container: [decimated_path_k][TPS_distance] => normalized_clearance_for_exactly_that_robot_pose.
Clearance information for one particular PTG and one set of obstacles.
void writeToStream(mrpt::utils::CStream &out) const
dist2clearance_t & get_path_clearance(size_t actual_k)
double getClearance(uint16_t k, double TPS_query_distance, bool integrate_over_path) const
Gets the clearance for path k and distance TPS_query_distance in one of two modes: ...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
size_t decimated_k_to_real_k(size_t k) const
size_t get_actual_num_paths() const
std::map< double, double > dist2clearance_t
[TPS_distance] => normalized_clearance_for_exactly_that_robot_pose
size_t real_k_to_decimated_k(size_t k) const
void resize(size_t actual_num_paths, size_t decimated_num_paths)
Initializes the container to allocate decimated_num_paths entries, as a decimated subset of a total o...
const dist2clearance_t & get_path_clearance_decimated(size_t decim_k) const
void readFromStream(mrpt::utils::CStream &in)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void renderAs3DObject(mrpt::opengl::CMesh &mesh, double min_x, double max_x, double min_y, double max_y, double cell_res, bool integrate_over_path) const
GLuint in
Definition: glext.h:7274
A planar (XY) grid where each cell has an associated height and, optionally, a texture map...
Definition: CMesh.h:39



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019