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