Fawkes API
Fawkes Development Version
|
#include <>>
Public Member Functions | |
AStar () | |
Constructor. More... | |
~AStar () | |
Destructor. More... | |
std::vector< AStarState * > | solve (AStarState *initialState) |
Solves a situation given by the initial state with AStar, and returns a vector of AStarStates that solve the problem. More... | |
AStar (LaserOccupancyGrid *occGrid, Logger *logger, Configuration *config) | |
Constructor. More... | |
void | solve (const point_t &robo_pos, const point_t &target_pos, std::vector< point_t > &solution) |
solves the given assignment. More... | |
point_t | remove_target_from_obstacle (int target_x, int target_y, int step_x, int step_y) |
Method, returning the nearest point outside of an obstacle. More... | |
Class AStar.
This is a high efficient implementation.
This is an implementation of the A* search algorithm.
This is an implementation of the A* search algorithm in a highly efficient way (I hope ;-).
Therefore this code does not always look very nice here. So be patient and try to understand what I was trying to implement here.
fawkes::AStar::AStar | ( | ) |
fawkes::AStar::~AStar | ( | ) |
fawkes::AStar::AStar | ( | LaserOccupancyGrid * | occGrid, |
Logger * | logger, | ||
Configuration * | config | ||
) |
Constructor.
This constructor does several things ;-) It gets an occupancy grid for the local pointer to garant fast access, and queries the settings for the grid. After that several states are initialized. This is done for speed purposes again, cause only here new is called in this code.. Afterwards the Openlist, closedlist and states for A* are initialized.
occGrid | is a pointer to an LaserOccupancyGrid to search through. |
logger | The fawkes logger |
config | The fawkes configuration |
Definition at line 55 of file astar.cpp.
References fawkes::LaserOccupancyGrid::get_cell_costs(), fawkes::OccupancyGrid::get_height(), fawkes::Configuration::get_int(), fawkes::OccupancyGrid::get_width(), fawkes::Logger::log_debug(), and ~AStar().
point_t fawkes::AStar::remove_target_from_obstacle | ( | int | target_x, |
int | target_y, | ||
int | step_x, | ||
int | step_y | ||
) |
Method, returning the nearest point outside of an obstacle.
target_x | target x position |
target_y | target y position |
step_x | step size in x direction |
step_y | step size in y direction |
Definition at line 353 of file astar.cpp.
References fawkes::OccupancyGrid::get_prob(), fawkes::Logger::log_debug(), fawkes::colli_cell_cost_t::near, fawkes::AStarState::total_cost_, fawkes::AStarState::x_, and fawkes::AStarState::y_.
Referenced by fawkes::Search::update().
std::vector< AStarState *> fawkes::AStar::solve | ( | AStarState * | initialState | ) |
Solves a situation given by the initial state with AStar, and returns a vector of AStarStates that solve the problem.
initialState | pointer of AStarState to the initial state |
Definition at line 80 of file astar.cpp.
References fawkes::AStarState::children(), fawkes::AStarState::is_goal(), fawkes::AStarState::key(), and fawkes::AStarState::parent.
Referenced by fawkes::NavGraph::search_path(), and fawkes::Search::update().
void fawkes::AStar::solve | ( | const point_t & | robo_pos, |
const point_t & | target_pos, | ||
std::vector< point_t > & | solution | ||
) |
solves the given assignment.
solve.
This starts the search for a path through the occupance grid to the target point. Performing astar search over the occupancy grid and returning the solution.
solve is the externally called method to solve the assignment by A*. It generates an initial state, and sets its values accordingly. This state is put on the openlist, and then the search is called, after which the solution sequence is generated by the pointers in all states.
robo_pos | The position of the robot in the grid |
target_pos | The position of the target in the grid |
solution | a vector that will be filled with the found path |
Definition at line 109 of file astar.cpp.
References fawkes::AStarState::father_, fawkes::OccupancyGrid::get_prob(), fawkes::Logger::log_warn(), fawkes::colli_cell_cost_t::occ, fawkes::AStarState::past_cost_, fawkes::AStarState::total_cost_, fawkes::point_struct::x, fawkes::AStarState::x_, fawkes::point_struct::y, and fawkes::AStarState::y_.