Fawkes API  Fawkes Development Version
generator.h
1 
2 /***************************************************************************
3  * generator.h - navgraph generator interface and base class
4  *
5  * Created: Thu Mar 16 10:56:32 2017
6  * Copyright 2015-2017 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #ifndef _LIBS_NAVGRAPH_GENERATOR_GENERATOR_H_
24 #define _LIBS_NAVGRAPH_GENERATOR_GENERATOR_H_
25 
26 #include <navgraph/navgraph.h>
27 
28 namespace fawkes {
29 
31 {
32 public:
34  NavGraphGenerator(std::map<std::string, std::string> params);
35  virtual ~NavGraphGenerator();
36 
37  virtual void compute(fawkes::LockPtr<fawkes::NavGraph> graph) = 0;
38 
39  virtual void set_bounding_box(float bbox_p1_x, float bbox_p1_y, float bbox_p2_x, float bbox_p2_y);
40  virtual void set_near_threshold(float near_threshold);
41  virtual void add_obstacle(float x, float y);
42 
43  static std::string genname(unsigned int &i);
44 
45 protected:
46  bool bbox_enabled_; ///< True if bounding box requested, false otherwise
47  float bbox_p1_x_; ///< X part of P1 for bounding box
48  float bbox_p1_y_; ///< Y part of P1 for bounding box
49  float bbox_p2_x_; ///< X part of P2 for bounding box
50  float bbox_p2_y_; ///< Y part of P2 for bounding box
51  float near_threshold_; ///< distance threshold when to consider two nodes to be the same
52 
53  /// Obstacles to consider during navgraph generation.
54  std::list<std::pair<float, float>> obstacles_;
55  /// Parameters specific to the actual generator in a generic format.
56  std::map<std::string, std::string> params_;
57 };
58 
59 } // end of namespace fawkes
60 
61 #endif
fawkes::NavGraphGenerator::set_bounding_box
virtual void set_bounding_box(float bbox_p1_x, float bbox_p1_y, float bbox_p2_x, float bbox_p2_y)
Set bounding box.
Definition: generator.cpp:111
fawkes::NavGraphGenerator::~NavGraphGenerator
virtual ~NavGraphGenerator()
Destructor.
Definition: generator.cpp:81
fawkes::LockPtr< fawkes::NavGraph >
fawkes::NavGraphGenerator
Base class for navgraph generators.
Definition: generator.h:31
fawkes::NavGraphGenerator::bbox_p2_y_
float bbox_p2_y_
Y part of P2 for bounding box.
Definition: generator.h:50
fawkes::NavGraphGenerator::compute
virtual void compute(fawkes::LockPtr< fawkes::NavGraph > graph)=0
Compute graph.
fawkes::NavGraphGenerator::add_obstacle
virtual void add_obstacle(float x, float y)
Add an obstacle point.
Definition: generator.cpp:141
fawkes::NavGraphGenerator::bbox_p1_y_
float bbox_p1_y_
Y part of P1 for bounding box.
Definition: generator.h:48
fawkes::NavGraphGenerator::bbox_enabled_
bool bbox_enabled_
True if bounding box requested, false otherwise.
Definition: generator.h:46
fawkes::NavGraphGenerator::near_threshold_
float near_threshold_
distance threshold when to consider two nodes to be the same
Definition: generator.h:51
fawkes::NavGraphGenerator::NavGraphGenerator
NavGraphGenerator()
Default constructor.
Definition: generator.cpp:56
fawkes
Fawkes library namespace.
fawkes::NavGraphGenerator::obstacles_
std::list< std::pair< float, float > > obstacles_
Obstacles to consider during navgraph generation.
Definition: generator.h:54
fawkes::NavGraphGenerator::genname
static std::string genname(unsigned int &i)
Generate a new name.
Definition: generator.cpp:90
fawkes::NavGraphGenerator::params_
std::map< std::string, std::string > params_
Parameters specific to the actual generator in a generic format.
Definition: generator.h:56
fawkes::NavGraphGenerator::bbox_p1_x_
float bbox_p1_x_
X part of P1 for bounding box.
Definition: generator.h:47
fawkes::NavGraphGenerator::bbox_p2_x_
float bbox_p2_x_
X part of P2 for bounding box.
Definition: generator.h:49
fawkes::NavGraphGenerator::set_near_threshold
virtual void set_near_threshold(float near_threshold)
Set distance threshold for considering nodes to be the same.
Definition: generator.cpp:129