Percepto is a C++-based LiDAR ray tracing simulator designed to simulate realistic LiDAR scans using triangle meshes. It is built for robotics applications requiring high-performance, customizable scanning simulations, and will integrate cleanly with real-world SLAM, perception, and visualization pipelines.
- Triangle Loading from CSV: A simple, functional loader to ingest triangle mesh data from standard CSV files.
- Azimuth and Elevation Scanning: Core logic for firing rays in a precise pattern, replicating a real LiDAR scan.
- Basic Ray-Triangle Intersection: The foundational algorithm for detecting hits between a ray and a scene object.
- Simple Scene Parsing: The ability to load and process scenes from a file, with basic console output for verification.
This forms a solid MVP for custom scan simulation.
This roadmap outlines the steps to evolve Percepto from a functional MVP into a production-grade, high-performance tool. The following tasks are prioritized to ensure a performance-first approach.
Objective: Establish a performance baseline to guide future optimizations.
- Action: Implement comprehensive timers and logging using
std::chronoto measure total scan time per frame, per-ray cost, and Rays-Per-Second (RPS). - Benefit: Provides quantifiable metrics to validate the impact of all subsequent optimizations.
Objective: Significantly reduce scan time by leveraging multi-core processors.
- Action: Parallelize the core scan loop using modern C++ concurrency features (
std::thread,std::async). - Benefit: Turns a computationally-bound process into a scalable one, drastically improving performance for complex scenes.
Objective: Enable external tool integration and provide detailed, actionable feedback.
- Action: Implement structured logging to print scan summaries (hits, runtime, RPS) and enable output of point clouds in standard formats (e.g., CSV, PCD).
- Benefit: This step is critical for integrating with robotics pipelines like PCL, ROS, and visualization tools, making the simulator practical for real-world applications.
Objective: Accelerate geometric computations at the instruction level.
- Action: Vectorize key ray-math routines (dot/cross products) using SIMD intrinsics or a library like Eigen.
- Benefit: Further optimizes the most frequently executed code path, providing substantial speed gains.
Objective: Transform the ray-tracing algorithm from linear to logarithmic time complexity.
- Action: Implement a Bounding Volume Hierarchy (BVH) to reduce the number of intersection tests from O(N) to O(log N).
- Benefit: The single most impactful performance optimization for complex scenes.
- Implement Benchmarking: Add a dedicated benchmarking suite to measure performance metrics.
- Parallelize Scan Loop: Use
std::asyncorstd::threadto parallelize the ray-firing process. - Output Point Clouds: Create a module to output XYZ data in a CSV format for external analysis.
- Detailed Scan Summary: Refine the console output to include a comprehensive summary of the simulation results.
The project is built using CMake, a cross-platform build system, with a Makefile for simplified command-line operations. The following instructions guide you through building and managing the project.
Before building, ensure you have the following installed on your system:
- CMake: Version 3.10 or higher.
- A C++ Compiler: A modern C++ compiler that supports C++17, such as GCC, Clang, or MSVC.
- Git: For cloning the repository.
make: The build automation tool.clang-format: For code formatting (recommended).
-
Clone the Repository: First, get the source code from GitHub.
git clone <repository_url> cd percepto
-
Configure the Project: Run the
configuretarget in theMakefile. This creates thebuilddirectory and generates the necessary build files for a Debug configuration.make configure
-
Build the Project: To compile the code, use the
buildtarget. The-jflag enables parallel compilation for faster build times.make build
The provided Makefile includes several convenient targets to streamline your workflow:
make allormake build: Compiles the project.make configure: Configures the CMake project for a Debug build.make rebuild: Cleans the project, reconfigures it, and builds it from scratch.make test: Runs all tests defined in the project.make format: Automatically formats the C++ source code usingclang-format.make clean: Removes thebuilddirectory to start fresh.
Percepto uses CMake's FetchContent module to handle external dependencies, such as tinyobjloader, to ensure a streamlined build process. This means you do not need to manually install these libraries, as CMake will automatically download and configure them during the build process.
