Fawkes API  Fawkes Development Version
abstract_search.h
1 
2 /***************************************************************************
3  * abstract_search.h - An abstract class for a search in an occupancy grid
4  *
5  * Created: Fri Oct 18 15:16:23 2013
6  * Copyright 2002 Stefan Jacobs
7  * 2013-2014 Bahram Maleki-Fard
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
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 file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_COLLI_SEARCH_ABSTRACTSEARCH_H_
24 #define __PLUGINS_COLLI_SEARCH_ABSTRACTSEARCH_H_
25 
26 #include "og_laser.h"
27 #include "../common/types.h"
28 
29 #include <logging/logger.h>
30 #include <utils/math/types.h>
31 
32 namespace fawkes
33 {
34 #if 0 /* just to make Emacs auto-indent happy */
35 }
36 #endif
37 
38 /** @class AbstractSearch <plugins/colli/search/abstract_search.h>
39  * This is the abstract search interpretation class for an arbitrary
40  * search algorithm to find its way through
41  * an Occupancy grid from a robopos to a targetpos.
42  */
43 
45 {
46  public:
47  AbstractSearch( LaserOccupancyGrid * occ_grid, Logger* logger );
48  virtual ~AbstractSearch();
49 
50  /** update complete plan things
51  * precondition: the occupancy grid has to be updated previously!
52  * @param robo_x Robot x position in grid
53  * @param robo_y Robot y position in grid
54  * @param target_x Target x position in grid
55  * @param target_y Target y position in grid
56  */
57  virtual void update( int robo_x, int robo_y, int target_x, int target_y ) = 0;
58 
59  /** Checks if the update was successful.
60  * @return true if "update(...)" was successful, fals otherwise.
61  */
62  virtual bool updated_successful() = 0;
63 
64  /** return pointer to the local target. do not modify afterwards
65  * precondition: update has to be called before this is ok here
66  */
67  const point_t& get_local_target();
68 
69  /** return pointer to the local trajectory point. do not modify afterwards
70  * precondition: update has to be called before this is ok here
71  */
72  const point_t& get_local_trajec();
73 
74  protected:
75  LaserOccupancyGrid * occ_grid_; /**< The occupancy grid */
76 
77  point_t local_target_; /**< the calculated target where to drive to */
78  point_t local_trajec_; /**< the calculated trajectory where to drive to */
79 
80  colli_cell_cost_t cell_costs_; /**< The costs for cells in occupancy grid */
81 };
82 
83 
84 
85 /** Constructor.
86  * @param occ_grid The laser occupancy-grid
87  * @param logger The fawkes logger
88  */
89 inline
91 {
92  logger->log_debug("AbstractSearch", "(Constructor): Entering");
93  occ_grid_ = occ_grid;
95  logger->log_debug("AbstractSearch", "(Constructor): Exiting");
96 }
97 
98 /** Destructor. */
99 inline
101 {
102 }
103 
104 /** Get the local target in the grid.
105  * @return The local target in grid as a point_t struct
106  */
107 inline const point_t&
109 {
110  return local_target_;
111 }
112 
113 /** Get the local trajectory in the grid.
114  * @return The local trajectory in grid as a point_t struct
115  */
116 inline const point_t&
118 {
119  return local_trajec_;
120 }
121 
122 } // namespace fawkes
123 
124 #endif
point_t local_trajec_
the calculated trajectory where to drive to
Fawkes library namespace.
virtual ~AbstractSearch()
Destructor.
LaserOccupancyGrid * occ_grid_
The occupancy grid.
const point_t & get_local_target()
return pointer to the local target.
This is the abstract search interpretation class for an arbitrary search algorithm to find its way th...
colli_cell_cost_t get_cell_costs() const
Get cell costs.
Definition: og_laser.cpp:442
Costs of occupancy-grid cells.
Definition: types.h:51
This OccGrid is derived by the Occupancy Grid originally from Andreas Strack, but modified for speed ...
Definition: og_laser.h:49
virtual bool updated_successful()=0
Checks if the update was successful.
virtual void update(int robo_x, int robo_y, int target_x, int target_y)=0
update complete plan things precondition: the occupancy grid has to be updated previously! ...
AbstractSearch(LaserOccupancyGrid *occ_grid, Logger *logger)
Constructor.
colli_cell_cost_t cell_costs_
The costs for cells in occupancy grid.
const point_t & get_local_trajec()
return pointer to the local trajectory point.
virtual void log_debug(const char *component, const char *format,...)=0
Log debug message.
Point with cartesian coordinates as signed integers.
Definition: types.h:40
point_t local_target_
the calculated target where to drive to
Interface for logging.
Definition: logger.h:34