|
TinyRobotics
|
Generic exploration and frontier-based SLAM utility for grid or occupancy maps. More...
#include <FrontierExplorer.h>


Public Member Functions | |
| FrontierExplorer (IMap< T > &map) | |
| Construct a FrontierExplorer with a given map (by reference). | |
| void | setCurrentPosition (const Coordinate< T > &pos) |
| Set the current position of the explorer. | |
| Coordinate< T > | getCurrentPosition () const |
| Get the current position of the explorer. | |
| void | setStrategy (FrontierSelectionStrategy strategy) |
| Set the strategy for selecting the next frontier cell. | |
| FrontierSelectionStrategy | getStrategy () const |
| Get the current frontier selection strategy. | |
| bool | getNextFrontier (Coordinate< T > &nextCell) |
| Provides the next frontier cell to explore based on the current strategy. | |
| size_t | size () const |
| Provides the number of potential frontier cells found in the last search. | |
| virtual void | setCurrentPosition (const Coordinate< T > &pos)=0 |
| virtual Coordinate< T > | getCurrentPosition () const =0 |
| virtual bool | getNextFrontier (Coordinate< T > &nextCell)=0 |
Protected Member Functions | |
| bool | selectRandom (Coordinate< T > &nextCell) |
| bool | selectNearest (Coordinate< T > &nextCell) |
| bool | selectFarthest (Coordinate< T > &nextCell) |
| bool | selectFirst (Coordinate< T > &nextCell) |
| bool | selectLast (Coordinate< T > &nextCell) |
| bool | selectCustom (Coordinate< T > &nextCell) |
| void | setSelectCallback (int(*cb)(std::vector< Coordinate< T > > &frontiers, void *ref), void *ref=nullptr) |
| Set a custom callback for selecting the next frontier cell. You can implement your own optimization strategy here. | |
| void | collectFrontiers () |
| Find all frontier cells in the map (cells adjacent to unknown space). | |
Protected Attributes | |
| Coordinate< T > | current_pos {} |
| FrontierSelectionStrategy | strategy_ = FrontierSelectionStrategy::RANDOM |
| bool | switchFirstLast = false |
| size_t | record_count_ = 0 |
| IMap< T > & | map_ |
| std::vector< Coordinate< T > > | frontiers |
| void * | ref = this |
| int(* | select_callback )(std::vector< Coordinate< T > > &frontiers, void *ref) = nullptr |
Generic exploration and frontier-based SLAM utility for grid or occupancy maps.
Implements IFrontierExplorer for flexible autonomous exploration.
| T | Scalar type for coordinates and map (e.g., float, DistanceM). Default: DistanceM. |
|
inline |
Construct a FrontierExplorer with a given map (by reference).
| map | The map to explore (must outlive this object). |
|
inlineprotected |
Find all frontier cells in the map (cells adjacent to unknown space).
A frontier cell is defined as a cell that is FREE (traversable) and has at least one neighboring cell (in any of the 8 directions) that is UNKNOWN (unexplored). This method iterates over every cell in the map, and for each FREE cell, checks all 8 neighbors. If any neighbor is UNKNOWN, the cell is added to the internal frontiers vector. Each cell is considered only once, so no duplicates occur.
This is a key step in frontier-based exploration and SLAM, as it identifies the boundary between explored and unexplored space, guiding the robot to new areas.
After calling this method, the frontiers vector will contain all current frontier coordinates, which can then be used by the exploration strategy to select the next goal.
|
inlinevirtual |
Get the current position of the explorer.
Implements IFrontierExplorer< T >.
|
inlinevirtual |
Provides the next frontier cell to explore based on the current strategy.
| nextCell | Output parameter for the selected frontier cell. |
Implements IFrontierExplorer< T >.
|
inline |
Get the current frontier selection strategy.
|
inlinevirtual |
Set the current position of the explorer.
| pos | The current position. |
Implements IFrontierExplorer< T >.
|
inlineprotected |
Set a custom callback for selecting the next frontier cell. You can implement your own optimization strategy here.
| cb | The callback function (returns index of selected cell). |
|
inline |
Set the strategy for selecting the next frontier cell.
| strategy | The selection strategy to use. |