Main MRPT website > C++ reference for MRPT 1.5.9
CHolonomicFullEval.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 
14 
15 namespace mrpt
16 {
17  namespace nav
18  {
19  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, NAV_IMPEXP)
21 
22  /** \addtogroup nav_holo Holonomic navigation methods
23  * \ingroup mrpt_nav_grp
24  * @{ */
25 
26  /** Full evaluation of all possible directions within the discrete set of input directions.
27  *
28  * These are the optional parameters of the method which can be set by means of a configuration file passed to the constructor or to CHolonomicFullEval::initialize() or directly in \a CHolonomicFullEval::options
29  *
30  * \code
31  * # Section name can be changed via setConfigFileSectionName()
32  * [FULL_EVAL_CONFIG]
33  * factorWeights = 1.0 1.0 1.0 0.05 1.0
34  * factorNormalizeOrNot = 0 0 0 0 1
35  * // 0: Clearness in direction
36  * // 1: Closest approach to target along straight line (Euclidean)
37  * // 2: Distance of end collision-free point to target (Euclidean)
38  * // 3: Hysteresis
39  * // 4: Clearness to nearest obstacle along path
40  * TARGET_SLOW_APPROACHING_DISTANCE = 0.20 // Start to reduce speed when closer than this to target [m]
41  * TOO_CLOSE_OBSTACLE = 0.02 // Directions with collision-free distances below this threshold are not elegible.
42  * HYSTERESIS_SECTOR_COUNT = 5 // Range of "sectors" (directions) for hysteresis over successive timesteps
43  * PHASE1_FACTORS = 0 1 2 // Indices of the factors above to be considered in phase 1
44  * PHASE2_FACTORS = 3 4 // Indices of the factors above to be considered in phase 2
45  * PHASE1_THRESHOLD = 0.75 // Phase1 scores must be above this relative range threshold [0,1] to be considered in phase 2 (Default:`0.75`)
46  * \endcode
47  *
48  * \sa CAbstractHolonomicReactiveMethod,CReactiveNavigationSystem
49  */
51  {
53  public:
54  /** Initialize the parameters of the navigator, from some configuration file, or default values if set to NULL */
55  CHolonomicFullEval( const mrpt::utils::CConfigFileBase *INI_FILE = NULL );
56 
57  // See base class docs
58  void navigate(const NavInput & ni, NavOutput &no) MRPT_OVERRIDE;
59 
60  virtual void initialize(const mrpt::utils::CConfigFileBase &INI_FILE) MRPT_OVERRIDE; // See base class docs
61  virtual void saveConfigFile(mrpt::utils::CConfigFileBase &c) const MRPT_OVERRIDE; // See base class docs
62 
63  /** Algorithm options */
65  {
66  double TOO_CLOSE_OBSTACLE; //!< Directions with collision-free distances below this threshold are not elegible.
67  double TARGET_SLOW_APPROACHING_DISTANCE; //!< Start to reduce speed when closer than this to target [m]
68  double OBSTACLE_SLOW_DOWN_DISTANCE; //!< Start to reduce speed when clearance is below this value ([0,1] ratio wrt obstacle reference/max distance)
69  double HYSTERESIS_SECTOR_COUNT; //!< Range of "sectors" (directions) for hysteresis over successive timesteps
70  std::vector<double> factorWeights; //!< See docs above
71  std::vector<int32_t> factorNormalizeOrNot; //!< 0/1 to normalize factors.
72  std::vector<std::vector<int32_t> > PHASE_FACTORS; //!< Factor indices [0,4] for the factors to consider in each phase 1,2,...N of the movement decision (Defaults: `PHASE1_FACTORS=0 1 2`, `PHASE2_FACTORS=`3 4`)
73  std::vector<double> PHASE_THRESHOLDS; //!< Phase 1,2,N-1... scores must be above this relative range threshold [0,1] to be considered in phase 2 (Default:`0.75`)
74 
75  bool LOG_SCORE_MATRIX; //!< (default:false, to save space)
76 
77  double clearance_threshold_ratio; //!< Ratio [0,1], times path_count, gives the minimum number of paths at each side of a target direction to be accepted as desired direction
78  double gap_width_ratio_threshold; //!< Ratio [0,1], times path_count, gives the minimum gap width to accept a direct motion towards target.
79 
80  TOptions();
81  void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source,const std::string &section) MRPT_OVERRIDE; // See base docs
82  void saveToConfigFile(mrpt::utils::CConfigFileBase &cfg ,const std::string &section) const MRPT_OVERRIDE; // See base docs
83  };
84 
85  TOptions options; //!< Parameters of the algorithm (can be set manually or loaded from CHolonomicFullEval::initialize or options.loadFromConfigFile(), etc.)
86 
89 
90  private:
91  unsigned int m_last_selected_sector;
92  unsigned int direction2sector(const double a, const unsigned int N);
93  mrpt::math::CMatrixD m_dirs_scores; //!< Individual scores for each direction: (i,j), i (row) are directions, j (cols) are scores. Not all directions may have evaluations, in which case a "-1" value will be found.
94 
95  virtual void postProcessDirectionEvaluations(std::vector<double> &dir_evals, const NavInput & ni, unsigned int trg_idx); // If desired, override in a derived class to manipulate the final evaluations of each directions
96 
98  {
99  std::vector<std::vector<double> > phase_scores;
101  };
102 
103  void evalSingleTarget(unsigned int target_idx, const NavInput & ni, EvalOutput &eo); //!< Evals one single target of the potentially many of them in NavInput
105  }; // end of CHolonomicFullEval
106 
108 
109  /** A class for storing extra information about the execution of CHolonomicFullEval navigation.
110  * \sa CHolonomicFullEval, CHolonomicLogFileRecord
111  */
113  {
115  public:
117 
118  /** Member data */
120  double evaluation;
121  mrpt::math::CMatrixD dirs_scores; //!< Individual scores for each direction: (i,j), i (row) are directions, j (cols) are scores. Not all directions may have evaluations, in which case a "-1" value will be found.
122  int32_t selectedTarget; //!< Normally = 0. Can be >0 if multiple targets passed simultaneously.
123 
124  const mrpt::math::CMatrixD * getDirectionScores() const MRPT_OVERRIDE { return &dirs_scores; }
125  };
126  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, NAV_IMPEXP)
127 
128  /** @} */
129  } // end namespace
130 }
double gap_width_ratio_threshold
Ratio [0,1], times path_count, gives the minimum gap width to accept a direct motion towards target...
mrpt::obs::CSinCosLookUpTableFor2DScans m_sincos_lut
A class for storing extra information about the execution of CHolonomicFullEval navigation.
This class is a "CSerializable" wrapper for "CMatrixTemplateNumeric<double>".
Definition: CMatrixD.h:30
double TOO_CLOSE_OBSTACLE
Directions with collision-free distances below this threshold are not elegible.
CAbstractHolonomicReactiveMethod
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
A base class for holonomic reactive navigation methods.
double TARGET_SLOW_APPROACHING_DISTANCE
Start to reduce speed when closer than this to target [m].
int32_t selectedTarget
Normally = 0. Can be >0 if multiple targets passed simultaneously.
std::vector< int32_t > factorNormalizeOrNot
0/1 to normalize factors.
double clearance_threshold_ratio
Ratio [0,1], times path_count, gives the minimum number of paths at each side of a target direction t...
std::vector< double > PHASE_THRESHOLDS
Phase 1,2,N-1... scores must be above this relative range threshold [0,1] to be considered in phase 2...
This class allows loading and storing values and vectors of different types from a configuration text...
TOptions options
Parameters of the algorithm (can be set manually or loaded from CHolonomicFullEval::initialize or opt...
double OBSTACLE_SLOW_DOWN_DISTANCE
Start to reduce speed when clearance is below this value ([0,1] ratio wrt obstacle reference/max dist...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
const GLubyte * c
Definition: glext.h:5590
double getTargetApproachSlowDownDistance() const MRPT_OVERRIDE
Returns the actual value of this parameter [m], as set via the children class options structure...
A smart look-up-table (LUT) of sin/cos values for 2D laser scans.
A base class for log records for different holonomic navigation methods.
std::vector< double > factorWeights
See docs above.
GLsizei const GLchar ** string
Definition: glext.h:3919
Full evaluation of all possible directions within the discrete set of input directions.
__int32 int32_t
Definition: rptypes.h:48
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
mrpt::math::CMatrixD m_dirs_scores
Individual scores for each direction: (i,j), i (row) are directions, j (cols) are scores...
GLsizei GLsizei GLchar * source
Definition: glext.h:3908
double HYSTERESIS_SECTOR_COUNT
Range of "sectors" (directions) for hysteresis over successive timesteps.
Input parameters for CAbstractHolonomicReactiveMethod::navigate()
void setTargetApproachSlowDownDistance(const double dist) MRPT_OVERRIDE
Sets the actual value of this parameter [m].
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
GLubyte GLubyte GLubyte a
Definition: glext.h:5575
Output for CAbstractHolonomicReactiveMethod::navigate()
mrpt::math::CMatrixD dirs_scores
Individual scores for each direction: (i,j), i (row) are directions, j (cols) are scores...
std::vector< std::vector< double > > phase_scores
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
std::vector< std::vector< int32_t > > PHASE_FACTORS
Factor indices [0,4] for the factors to consider in each phase 1,2,...N of the movement decision (Def...
bool LOG_SCORE_MATRIX
(default:false, to save space)
const mrpt::math::CMatrixD * getDirectionScores() const MRPT_OVERRIDE



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020