TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
LocalizationAndMapping2D< T > Class Template Reference

Modular 2D Simultaneous Localization and Mapping (SLAM) system with flexible map, IMU, and exploration integration. More...

#include <LocalizationAndMapping2D.h>

Inheritance diagram for LocalizationAndMapping2D< T >:
Inheritance graph
[legend]
Collaboration diagram for LocalizationAndMapping2D< T >:
Collaboration graph
[legend]

Public Member Functions

 LocalizationAndMapping2D (IMap< T > &map, IFrontierExplorer< T > &explorer, Frame2D &world, Frame2D &base, Frame2D &lidar, IMotionState2D &imu)
 
bool begin ()
 Initialize SLAM system (IMU and range sensor)
 
void end ()
 
void addRangeMeasurement (Distance dist, Angle angle, CellState state)
 Register Range Measurement from Lidar.
 
void addRangeMeasurement (float distanceM, float angleDeg, CellState state)
 Register Range Measurement from Lidar.
 
bool getNextFrontier (Coordinate< float > &result) const
 Find the next frontier cell (boundary between known free and unknown space).
 
void subscribe (MessageHandler &handler)
 Subscribe to imu and range sensor messages.
 
void unsubscribeAll ()
 
IMap< T > & getMap ()
 Access to map.
 
IMotionState2DgetIMU ()
 Access to IMU state.
 
IFrontierExplorer< T > & getFrontierExplorer ()
 
- Public Member Functions inherited from MessageSource
void subscribe (MessageHandler &handler, MessageOrigin origin=MessageOrigin::Undefined, MessageContent content=MessageContent::Undefined)
 Subscribe a message handler to this source, with optional filtering.
 
void unsubscribeAll ()
 Remove all registered message handlers.
 
void sendMessage (Message< float > &msg)
 Publish a message to all registered handlers.
 
void sendMessage (const Message< Coordinate< float > > &msg)
 Publish a message to all registered handlers.
 
void sendMessage (const Message< GPSCoordinate > &msg)
 Publish a message to all registered handlers.
 
void sendMessage (const Message< MotionState3D > &msg)
 Overload for MotionState3D messages.
 

Protected Member Functions

void markRay (const Coordinate< float > &sensor, const Coordinate< float > &obstacle, CellState state)
 Mark all cells between the sensor and the obstacle as FREE, and the obstacle cell as OCCUPIED.
 

Static Protected Member Functions

static bool onIMUPublished (const Message< float > &msg, void *ref)
 

Protected Attributes

IFrontierExplorer< T > & explorer_
 
RangeSensor< T > rangeSensor_
 
IMotionState2Dimu2d_
 
IMap< T > & map_
 
CallbackMessageHandler callbackHandler_
 
Frame2Dworld_
 
Frame2Dbase_
 
Frame2D lidar_
 
FrameMgr2D tf_
 
- Protected Attributes inherited from MessageSource
std::vector< MessageHandlerEntrymessageHandlers_
 

Detailed Description

template<typename T>
class tinyrobotics::LocalizationAndMapping2D< T >

Modular 2D Simultaneous Localization and Mapping (SLAM) system with flexible map, IMU, and exploration integration.

This class implements a highly modular and extensible 2D SLAM system for occupancy grid mapping, pose estimation, sensor fusion, and autonomous exploration.

Features

Template Parameters

Template Parameters
TScalar type for coordinates and math (default: DistanceM)
IFrontierExplorer<T>The frontier exploration strategy (default: IFrontierExplorer<T><T>)

Ownership & Lifetime

Usage Example

Frame2D world, base, lidar;
FrontierExplorer<T> explorer(map);
LocalizationAndMapping2D slam(map, explorer, world, base, lidar, imu);
slam.begin();
// ...
Generic exploration and frontier-based SLAM utility for grid or occupancy maps.
Definition: FrontierExplorer.h:35
A grid map using two bit vectors to represent CellState efficiently.
Definition: GridBitMap.h:30
Basic 2D IMU dead-reckoning class.
Definition: IMU2D.h:47
Modular 2D Simultaneous Localization and Mapping (SLAM) system with flexible map, IMU,...
Definition: LocalizationAndMapping2D.h:61
Represents a 2D coordinate frame in a hierarchical frame tree.
Definition: FrameMgr2D.h:130

Member Function Documentation

◆ getNextFrontier()

bool getNextFrontier ( Coordinate< float > &  result) const
inline

Find the next frontier cell (boundary between known free and unknown space).

Returns
World coordinates of the next frontier cell, or (0,0) if none found.

◆ markRay()

void markRay ( const Coordinate< float > &  sensor,
const Coordinate< float > &  obstacle,
CellState  state 
)
inlineprotected

Mark all cells between the sensor and the obstacle as FREE, and the obstacle cell as OCCUPIED.

Parameters
sensor_worldWorld coordinates of the sensor
obs_worldWorld coordinates of the obstacle

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