Main MRPT website > C++ reference for MRPT 1.5.7
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 <mrpt/utils/mrpt_stdint.h> // compiler-independent version of "stdint.h"
15 #include <mrpt/nav/link_pragmas.h>
16 namespace mrpt { namespace utils { class CStream; } }
17 
18 namespace mrpt {
19 namespace nav {
20  /** Clearance information for one particular PTG and one set of obstacles.
21  * Usage:
22  * - Declare an object of this type (it will be initialized to "empty"),
23  * - Call CParameterizedTrajectoryGenerator::initClearanceDiagram()
24  * - Repeatedly call CParameterizedTrajectoryGenerator::updateClearance() for each 2D obstacle point.
25  *
26  * \ingroup nav_tpspace
27  */
29  {
30  public:
31  ClearanceDiagram(); //!< default ctor
32  void clear(); //!< Reset to default, empty state
33  /** Initializes the container to allocate `decimated_num_paths` entries, as a decimated
34  * subset of a total of `actual_num_paths` paths */
35  void resize(size_t actual_num_paths, size_t decimated_num_paths);
36  inline bool empty() const { return m_raw_clearances.empty(); }
37  inline size_t get_actual_num_paths() const { return m_actual_num_paths; }
38  inline size_t get_decimated_num_paths() const { return m_raw_clearances.size(); }
39 
40  /** Gets the clearance for path `k` and distance `TPS_query_distance` in one of two modes:
41  * - [integrate_over_path=false] clearance from that specific spot, or
42  * - [integrate_over_path=true] average clearance over the path from the origin to that specific spot.
43  */
44  double getClearance(uint16_t k, double TPS_query_distance, bool integrate_over_path) const;
45  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;
46 
47  void readFromStream(mrpt::utils::CStream &in);
48  void writeToStream(mrpt::utils::CStream &out) const;
49 
50  typedef std::map<double, double> dist2clearance_t; //!< [TPS_distance] => normalized_clearance_for_exactly_that_robot_pose */
51  dist2clearance_t & get_path_clearance(size_t actual_k);
52  const dist2clearance_t & get_path_clearance(size_t actual_k) const;
53 
54  inline dist2clearance_t & get_path_clearance_decimated(size_t decim_k) { return m_raw_clearances[decim_k]; }
55  inline const dist2clearance_t & get_path_clearance_decimated(size_t decim_k) const { return m_raw_clearances[decim_k]; }
56 
57  size_t real_k_to_decimated_k(size_t k) const;
58  size_t decimated_k_to_real_k(size_t k) const;
59 
60  protected:
61  /** Container: [decimated_path_k][TPS_distance] => normalized_clearance_for_exactly_that_robot_pose */
62  std::vector<dist2clearance_t> m_raw_clearances;
63 
64  size_t m_actual_num_paths; // The decimated number of paths is implicit in raw_clearances.size()
65  double m_k_a2d, m_k_d2a;
66  };
67 
68 } // ns
69 } // ns
size_t get_decimated_num_paths() const
unsigned __int16 uint16_t
Definition: rptypes.h:46
dist2clearance_t & get_path_clearance_decimated(size_t decim_k)
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 clear()
Clear the contents of this container.
Definition: ts_hash_map.h:113
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
size_t get_actual_num_paths() const
std::map< double, double > dist2clearance_t
[TPS_distance] => normalized_clearance_for_exactly_that_robot_pose */
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.
GLuint in
Definition: glext.h:6301
A planar (XY) grid where each cell has an associated height and, optionally, a texture map...
Definition: CMesh.h:40



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019