Fawkes API  Fawkes Development Version
fawkes::AStar Class Reference

Class AStar. More...

#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...
 

Detailed Description

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 ;-).

Author
Stefan Jacobs, Martin Liebenberg

Therefore this code does not always look very nice here. So be patient and try to understand what I was trying to implement here.

Definition at line 36 of file astar.h.

Constructor & Destructor Documentation

◆ AStar() [1/2]

fawkes::AStar::AStar ( )

Constructor.

This is the constructor for the AStar Object.

Definition at line 56 of file astar.cpp.

◆ ~AStar()

fawkes::AStar::~AStar ( )

Destructor.

This destructs the AStarObject.

This destructor deletes all the states allocated during construction.

Definition at line 63 of file astar.cpp.

Referenced by AStar().

◆ AStar() [2/2]

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.

Parameters
occGridis a pointer to an LaserOccupancyGrid to search through.
loggerThe fawkes logger
configThe 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().

Member Function Documentation

◆ remove_target_from_obstacle()

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.

Parameters
target_xtarget x position
target_ytarget y position
step_xstep size in x direction
step_ystep size in y direction
Returns
a new modified point.

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().

◆ solve() [1/2]

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.

Parameters
initialStatepointer of AStarState to the initial state
Returns
a vector of pointers of AStarState with the solution sequence

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().

◆ solve() [2/2]

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.

Parameters
robo_posThe position of the robot in the grid
target_posThe position of the target in the grid
solutiona 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_.


The documentation for this class was generated from the following files: