Fawkes API  Fawkes Development Version
astar_search.h
1 
2 /***************************************************************************
3  * astar_search.h - A colli-specific A* search implementation
4  *
5  * Created: Fri Oct 18 15:16:23 2013
6  * Copyright 2002 Stefan Jacobs
7  * 2013 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_ASTAR_SEARCH_H_
24 #define __PLUGINS_COLLI_SEARCH_ASTAR_SEARCH_H_
25 
26 #include "abstract_search.h"
27 
28 #include <vector>
29 
30 namespace fawkes
31 {
32 #if 0 /* just to make Emacs auto-indent happy */
33 }
34 #endif
35 
36 class LaserOccupancyGrid;
37 class AStar;
38 class Logger;
39 class Configuration;
40 
41 typedef struct point_struct point_t;
42 
43 /** This is the plan class.
44  * Here the plan from A* is managed and cut into small pieces.
45  * Also usable methods for managing the plan are implemented here.
46  */
47 class Search: public AbstractSearch
48 {
49  public:
50  Search( LaserOccupancyGrid * occ_grid , Logger* logger, Configuration* config);
51  virtual ~Search();
52 
53  ///\brief update complete plan things
54  void update( int robo_x, int robo_y, int target_x, int target_y );
55 
56  ///\brief returns, if the update was successful or not.
57  bool updated_successful();
58 
59  ///\brief Get the current plan
60  std::vector<point_t>* get_plan();
61 
62  ///\brief Get the robot's position in the grid, used for the plan
63  point_t get_robot_position();
64 
65  private:
66 
67  /** Returns the current, modified waypoint to drive to. */
68  point_t calculate_local_target();
69 
70  /** Adjust the waypoint if it is not the final point. */
71  point_t adjust_waypoint( const point_t &local_target );
72 
73  /** Returns the current trajectory point to drive to. */
74  point_t calculate_local_trajec_point( );
75 
76  /** Method for checking if an obstacle is between two points. */
77  bool is_obstacle_between( const point_t &a, const point_t &b, const int maxcount );
78 
79 
80  AStar * astar_; /**< the A* search algorithm */
81  std::vector< point_t > plan_; /**< the local representation of the plan */
82 
83  point_t robo_position_, target_position_;
84  bool updated_successful_;
85  int cfg_search_line_allowed_cost_max_; /**< the config value for the max allowed costs on the line search on the a-star result */
86 
87  fawkes::Logger* logger_;
88 };
89 
90 } // namespace fawkes
91 
92 #endif
struct fawkes::point_struct point_t
Point with cartesian coordinates as signed integers.
Definition: astar.h:43
Fawkes library namespace.
This is the abstract search interpretation class for an arbitrary search algorithm to find its way th...
This OccGrid is derived by the Occupancy Grid originally from Andreas Strack, but modified for speed ...
Definition: og_laser.h:49
Class AStar.
Definition: astar.h:36
This is the plan class.
Definition: astar_search.h:47
Point with cartesian coordinates as signed integers.
Definition: types.h:40
Interface for configuration handling.
Definition: config.h:67
Interface for logging.
Definition: logger.h:34