$ show leggedrobotics/elevation_mapping_cupy
Elevation Mapping CuPy is a GPU-accelerated elevation mapping system for legged robots, integrating point cloud registration, ray casting, multi-modal semantic fusion (geometry, RGB, semantics, deep features), and convex plane decomposition. It is built as a ROS Noetic package (ROS1) with a mixture of C++ (using pybind11) and Python (CuPy) nodes. The system ingests point clouds and images, processes them through configurable fusion algorithms, and outputs elevation maps with multiple layers (elevation, variance, traversability, semantic classes). It also includes a learning-based traversability filter supporting both Chainer and PyTorch backends, and a plane segmentation pipeline (CGAL/RANSAC) that converts elevation maps into planar terrain regions for motion planning. The architecture is modular with a plugin system for post-processing filters and a fusion manager for multiple data sources. While the core is tightly integrated with ROS1 and CUDA, several components (plugin manager, fusion framework, CuPy kernel compilation pattern, traversability filter) exhibit high craftsmanship and potential for reuse in other GPU-accelerated robotics projects. The codebase is well-tested and documented, but its dependency on ROS Noetic and specific CUDA versions limits portability and creates medium technical drift.
The LLM identified 4 files worth highlighting for reuse:
Provides a configurable plugin system for modular post-processing of elevation maps. Plugins (erosion, inpainting, smoothing, etc.) are defined in YAML and dynamically loaded. Supports enabling/disabling, parameterization, and multiple instances. This pattern is easily extractable and reusable for any grid-map or image pipeline requiring customizable filters.
Implements a fusion framework for combining multiple data sources (point clouds, images) into the elevation map. Supports various algorithms (average, Bayesian, class-based, color) and handles both geometry and semantics. The FusionManager dispatches to concrete FusionBase subclasses. This decoupled design can be reused in any multi-modal mapping or sensor fusion system.
Compiles custom CuPy elementwise kernels on-the-fly for GPU-accelerated operations like ray casting, drift compensation, and morphological filters. The compile_kernels function uses string substitution for parameterization. This pattern demonstrates efficient GPU kernel management and is reusable for any project requiring custom CUDA kernels via CuPy without compiling separate .cu files.
Traversability filter that classifies elevation map cells as traversable or not using a neural network. Supports switching between Chainer and PyTorch backends via a configuration parameter. Weights are loaded from a .dat file. The backend abstraction pattern is clean and could be reused in other ML inference pipelines where framework flexibility is needed.