Fawkes API
Fawkes Development Version
|
#include <astar.h>
Public Member Functions | |
AStarColli (LaserOccupancyGrid *occGrid, Logger *logger, Configuration *config) | |
Constructor. More... | |
~AStarColli () | |
Destructor. 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 an implementation of the A* search algorithm in a highly efficient way (I hope ;-).
fawkes::AStarColli::AStarColli | ( | 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 52 of file astar.cpp.
References fawkes::LaserOccupancyGrid::get_cell_costs(), fawkes::OccupancyGrid::get_height(), fawkes::Configuration::get_int(), fawkes::OccupancyGrid::get_width(), and fawkes::Logger::log_debug().
fawkes::AStarColli::~AStarColli | ( | ) |
Destructor.
This destructor deletes all the states allocated during construction.
Definition at line 84 of file astar.cpp.
References fawkes::Logger::log_debug().
point_t fawkes::AStarColli::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 334 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_.
void fawkes::AStarColli::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 102 of file astar.cpp.
References fawkes::AStarState::father_, fawkes::AStarState::past_cost_, fawkes::AStarState::total_cost_, fawkes::point_struct::x, fawkes::AStarState::x_, fawkes::point_struct::y, and fawkes::AStarState::y_.