Local Mapper

Real-time, ego-centric occupancy grid generation.

While the global map provides a static long-term view, the Local Mapper builds a dynamic, short-term map of the robot’s immediate surroundings based on real-time sensor data.

It captures moving obstacles (people, other robots) and temporary changes, serving as the primary input for the Controller to enable fast reactive navigation.

Core Algorithm

At its core, LocalMapper uses the Bresenham line drawing algorithm in C++ to efficiently update an occupancy grid from incoming LaserScan data. This approach ensures fast and accurate raycasting to determine free and occupied cells in the local grid.

To maximize performance and adaptability, the implementation supports both CPU and GPU execution:

  • SYCL GPU Acceleration - GPU acceleration is implemented using SYCL, making it vendor-agnostic—compatible with Nvidia, AMD, Intel, and any other GPGPU-capable devices.

  • Multi-Threaded CPU - , If no GPU is available, it automatically falls back to a highly optimized multi-threaded CPU implementation capable of handling dense scan rates or high-frequency updates.

Supported Data

Currently supports LaserScan and PointCloud2 data to create 2D Occupancy Grids. Support for 3D local maps and semantic layers is planned for an upcoming releases.

Interface

Inputs

Key Name

Allowed Types

Number

Default

sensor_data

sensor_msgs.msg.LaserScan, std_msgs.msg.Float64, sensor_msgs.msg.PointCloud2

1

/scan (LaserScan)

location

nav_msgs.msg.Odometry, geometry_msgs.msg.PoseStamped, geometry_msgs.msg.Pose

1

/odom (Odometry)

Outputs

Key Name

Allowed Types

Number

Default

local_map

nav_msgs.msg.OccupancyGrid

1

/local_map/occupancy_layer

Usage Example

from kompass_core.mapping import LocalMapperConfig, MapperConfig
from kompass.components import LocalMapper

# 1. Define Map Dimensions
# Create a 5m x 5m rolling window around the robot with 20cm resolution
map_params = MapperConfig(
    width=5.0,
    height=5.0,
    resolution=0.2
)

# 2. Configure Component
my_config = LocalMapperConfig(
    loop_rate=10.0,       # Update at 10Hz
    map_params=map_params
)

# 3. Instantiate
my_mapper = LocalMapper(component_name="mapper", config=my_config)

See Next

The Local Mapper feeds directly into the Controller for obstacle avoidance, while the Map Server provides the global context.

Controller

Real-Time Control Learn how to use the generated local map for dynamic obstacle avoidance.

Controller
Map Server

Global Context Learn how to manage and serve the static global map.

Map Server