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-2018, 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>
16 
17 namespace mrpt
18 {
19 namespace nav
20 {
21 /** Clearance information for one particular PTG and one set of obstacles.
22  * Usage:
23  * - Declare an object of this type (it will be initialized to "empty"),
24  * - Call CParameterizedTrajectoryGenerator::initClearanceDiagram()
25  * - Repeatedly call CParameterizedTrajectoryGenerator::updateClearance() for
26  * each 2D obstacle point.
27  *
28  * \ingroup nav_tpspace
29  */
31 {
32  public:
33  /** default ctor */
35  /** Reset to default, empty state */
36  void clear();
37  /** Initializes the container to allocate `decimated_num_paths` entries, as
38  * a decimated
39  * subset of a total of `actual_num_paths` paths */
40  void resize(size_t actual_num_paths, size_t decimated_num_paths);
41  inline bool empty() const { return m_raw_clearances.empty(); }
42  inline size_t get_actual_num_paths() const { return m_actual_num_paths; }
43  inline size_t get_decimated_num_paths() const
44  {
45  return m_raw_clearances.size();
46  }
47 
48  /** Gets the clearance for path `k` and distance `TPS_query_distance` in one
49  * of two modes:
50  * - [integrate_over_path=false] clearance from that specific spot, or
51  * - [integrate_over_path=true] average clearance over the path from the
52  * origin to that specific spot.
53  */
54  double getClearance(
55  uint16_t k, double TPS_query_distance, bool integrate_over_path) const;
56  void renderAs3DObject(
57  mrpt::opengl::CMesh& mesh, double min_x, double max_x, double min_y,
58  double max_y, double cell_res, bool integrate_over_path) const;
59 
62 
63  /** [TPS_distance] => normalized_clearance_for_exactly_that_robot_pose */
64  using dist2clearance_t = std::map<double, double>;
65  dist2clearance_t& get_path_clearance(size_t actual_k);
66  const dist2clearance_t& get_path_clearance(size_t actual_k) const;
67 
69  {
70  return m_raw_clearances[decim_k];
71  }
73  size_t decim_k) const
74  {
75  return m_raw_clearances[decim_k];
76  }
77 
78  size_t real_k_to_decimated_k(size_t k) const;
79  size_t decimated_k_to_real_k(size_t k) const;
80 
81  protected:
82  /** Container: [decimated_path_k][TPS_distance] =>
83  * normalized_clearance_for_exactly_that_robot_pose */
84  std::vector<dist2clearance_t> m_raw_clearances;
85 
86  size_t m_actual_num_paths; // The decimated number of paths is implicit in
87  // raw_clearances.size()
88  double m_k_a2d, m_k_d2a;
89 };
90 
91 } // namespace nav
92 } // namespace mrpt
std::map< double, double > dist2clearance_t
[TPS_distance] => normalized_clearance_for_exactly_that_robot_pose
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.
void writeToStream(mrpt::serialization::CArchive &out) const
void readFromStream(mrpt::serialization::CArchive &in)
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.
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: ...
size_t decimated_k_to_real_k(size_t k) const
size_t get_actual_num_paths() const
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
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
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:48
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: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019