Skip to content

0xphen/Percepto

Repository files navigation

Percepto Logo

Percepto: High-Performance LiDAR Ray Tracer Simulator 🚧

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.


⚙️ Core Features (Foundation Layer)

  • 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.


🚀 The Path to Production: Roadmap & Priorities

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.

1. 📊 Benchmarking (Immediate)

Objective: Establish a performance baseline to guide future optimizations.

  • Action: Implement comprehensive timers and logging using std::chrono to 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.

2. ⚡ Parallelization

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.

3. ☁️ Output & Logging

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.

4. 🧠 SIMD Acceleration

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.

5. 🌲 BVH Acceleration Structure

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.

🛠 To-Do List (High-Priority)

  • Implement Benchmarking: Add a dedicated benchmarking suite to measure performance metrics.
  • Parallelize Scan Loop: Use std::async or std::thread to 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.

🏗️ Building Percepto

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.

Prerequisites

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).

Build Process

  1. Clone the Repository: First, get the source code from GitHub.

    git clone <repository_url>
    cd percepto
  2. Configure the Project: Run the configure target in the Makefile. This creates the build directory and generates the necessary build files for a Debug configuration.

    make configure
  3. Build the Project: To compile the code, use the build target. The -j flag enables parallel compilation for faster build times.

    make build

Makefile Commands

The provided Makefile includes several convenient targets to streamline your workflow:

  • make all or make 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 using clang-format.
  • make clean: Removes the build directory to start fresh.

Dependency Management

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.

About

A high-performance LiDAR ray tracing simulator designed for robotics applications.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published