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 "../common/types.h"
27#include "og_laser.h"
28
29#include <logging/logger.h>
30#include <utils/math/types.h>
31
32namespace fawkes {
33
34/** @class AbstractSearch <plugins/colli/search/abstract_search.h>
35 * This is the abstract search interpretation class for an arbitrary
36 * search algorithm to find its way through
37 * an Occupancy grid from a robopos to a targetpos.
38 */
39
41{
42public:
43 AbstractSearch(LaserOccupancyGrid *occ_grid, Logger *logger);
44 virtual ~AbstractSearch();
45
46 /** update complete plan things
47 * precondition: the occupancy grid has to be updated previously!
48 * @param robo_x Robot x position in grid
49 * @param robo_y Robot y position in grid
50 * @param target_x Target x position in grid
51 * @param target_y Target y position in grid
52 */
53 virtual void update(int robo_x, int robo_y, int target_x, int target_y) = 0;
54
55 /** Checks if the update was successful.
56 * @return true if "update(...)" was successful, fals otherwise.
57 */
58 virtual bool updated_successful() = 0;
59
60 /** return pointer to the local target. do not modify afterwards
61 * precondition: update has to be called before this is ok here
62 */
64
65 /** return pointer to the local trajectory point. do not modify afterwards
66 * precondition: update has to be called before this is ok here
67 */
69
70protected:
71 LaserOccupancyGrid *occ_grid_; /**< The occupancy grid */
72
73 point_t local_target_; /**< the calculated target where to drive to */
74 point_t local_trajec_; /**< the calculated trajectory where to drive to */
75
76 colli_cell_cost_t cell_costs_; /**< The costs for cells in occupancy grid */
77};
78
79/** Constructor.
80 * @param occ_grid The laser occupancy-grid
81 * @param logger The fawkes logger
82 */
84{
85 logger->log_debug("AbstractSearch", "(Constructor): Entering");
86 occ_grid_ = occ_grid;
88 logger->log_debug("AbstractSearch", "(Constructor): Exiting");
89}
90
91/** Destructor. */
93{
94}
95
96/** Get the local target in the grid.
97 * @return The local target in grid as a point_t struct
98 */
99inline const point_t &
101{
102 return local_target_;
103}
104
105/** Get the local trajectory in the grid.
106 * @return The local trajectory in grid as a point_t struct
107 */
108inline const point_t &
110{
111 return local_trajec_;
112}
113
114} // namespace fawkes
115
116#endif
This is the abstract search interpretation class for an arbitrary search algorithm to find its way th...
const point_t & get_local_trajec()
return pointer to the local trajectory point.
virtual ~AbstractSearch()
Destructor.
AbstractSearch(LaserOccupancyGrid *occ_grid, Logger *logger)
Constructor.
colli_cell_cost_t cell_costs_
The costs for cells in occupancy grid.
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!
point_t local_target_
the calculated target where to drive to
const point_t & get_local_target()
return pointer to the local target.
point_t local_trajec_
the calculated trajectory where to drive to
LaserOccupancyGrid * occ_grid_
The occupancy grid.
virtual bool updated_successful()=0
Checks if the update was successful.
This OccGrid is derived by the Occupancy Grid originally from Andreas Strack, but modified for speed ...
Definition: og_laser.h:47
colli_cell_cost_t get_cell_costs() const
Get cell costs.
Definition: og_laser.cpp:471
Interface for logging.
Definition: logger.h:42
virtual void log_debug(const char *component, const char *format,...)
Log debug message.
Definition: multi.cpp:174
Fawkes library namespace.
Costs of occupancy-grid cells.
Definition: types.h:50
Point with cartesian coordinates as signed integers.
Definition: types.h:42