Convert Figma logo to code with AI

OctoMap logooctomap

An Efficient Probabilistic 3D Mapping Framework Based on Octrees. Contains the main OctoMap library, the viewer octovis, and dynamicEDT3D.

1,924
658
1,924
107

Top Related Projects

Universal grid map library for mobile robotic mapping

Robot-centric elevation mapping for rough terrain navigation

An optimization-based multi-sensor state estimator

ROS 2 Navigation Framework and System

Quick Overview

OctoMap is an efficient probabilistic 3D mapping framework based on octrees. It provides data structures and mapping algorithms to create three-dimensional occupancy maps, which are particularly useful for robotics and computer vision applications. OctoMap is designed to be memory-efficient, updatable, and flexible for various environments.

Pros

  • Memory-efficient representation of 3D environments
  • Probabilistic occupancy estimation for handling sensor noise and dynamics
  • Supports multi-resolution queries and map compression
  • Open-source with a well-documented API

Cons

  • Can be computationally intensive for large-scale environments
  • Limited support for dynamic environments
  • Requires careful parameter tuning for optimal performance
  • May not be suitable for all types of 3D mapping scenarios

Code Examples

  1. Creating an OctoMap and inserting point cloud data:
#include <octomap/octomap.h>
#include <octomap/OcTree.h>

octomap::OcTree tree(0.1);  // Create an OcTree with 0.1m resolution
octomap::point3d sensorOrigin(0.0, 0.0, 0.0);

for (const auto& point : pointCloud) {
    tree.updateNode(octomap::point3d(point.x, point.y, point.z), true);
}
tree.updateInnerOccupancy();
  1. Querying occupancy and retrieving free space:
octomap::point3d query(1.0, 2.0, 3.0);
octomap::OcTreeNode* result = tree.search(query);

if (result) {
    double occupancy = result->getOccupancy();
    std::cout << "Occupancy at query point: " << occupancy << std::endl;
}

octomap::point3d min(-1.0, -1.0, -1.0);
octomap::point3d max(1.0, 1.0, 1.0);
std::vector<octomap::point3d> freeSpace;
tree.getUnknownLeafCenters(freeSpace, min, max);
  1. Saving and loading OctoMap:
tree.writeBinary("map.bt");

octomap::OcTree loadedTree("map.bt");

Getting Started

To use OctoMap in your project:

  1. Install OctoMap:

    git clone https://github.com/OctoMap/octomap.git
    cd octomap
    mkdir build && cd build
    cmake ..
    make
    sudo make install
    
  2. Include OctoMap in your C++ project:

    #include <octomap/octomap.h>
    #include <octomap/OcTree.h>
    
  3. Link against OctoMap in your CMakeLists.txt:

    find_package(octomap REQUIRED)
    include_directories(${OCTOMAP_INCLUDE_DIRS})
    target_link_libraries(your_target ${OCTOMAP_LIBRARIES})
    

Competitor Comparisons

Universal grid map library for mobile robotic mapping

Pros of grid_map

  • Specialized for 2D grid maps, offering efficient operations for terrain representation
  • Provides a rich set of tools for map manipulation, including iterators and filters
  • Supports multi-layered maps for storing various data types per cell

Cons of grid_map

  • Limited to 2D representations, lacking the volumetric capabilities of octomap
  • May require more memory for large maps compared to octomap's octree structure
  • Less suitable for 3D environment modeling and obstacle avoidance in robotics

Code Comparison

grid_map example:

grid_map::GridMap map({"elevation", "normal_x", "normal_y", "normal_z"});
map.setGeometry(grid_map::Length(1.0, 1.0), 0.01);
map["elevation"].setConstant(0.0);

octomap example:

octomap::OcTree tree(0.1);
octomap::point3d sensor_origin(0.0, 0.0, 0.0);
tree.insertPointCloud(point_cloud, sensor_origin);
tree.updateInnerOccupancy();

The grid_map code focuses on creating a 2D grid with multiple layers, while the octomap code demonstrates creating a 3D octree and inserting point cloud data.

Robot-centric elevation mapping for rough terrain navigation

Pros of elevation_mapping

  • Specialized for 2.5D terrain mapping, ideal for ground robots
  • Supports multi-layered maps for richer terrain representation
  • Efficient updates and fusion of new sensor data

Cons of elevation_mapping

  • Limited to 2.5D representations, not suitable for full 3D environments
  • May require more memory for storing multiple layers
  • Less widespread adoption compared to octomap

Code Comparison

elevation_mapping:

grid_map::GridMap map;
map.add("elevation", Matrix::Zero(rows, cols));
map.add("variance", Matrix::Constant(rows, cols, 0.01));

octomap:

octomap::OcTree tree(resolution);
tree.updateNode(point3d(1.0, 2.0, 3.0), true);
tree.updateInnerOccupancy();

Key Differences

  • elevation_mapping focuses on terrain representation, while octomap is a general-purpose 3D mapping solution
  • octomap uses probabilistic occupancy grids, whereas elevation_mapping uses elevation and variance layers
  • elevation_mapping is better suited for ground robots, while octomap is more versatile for various robotic applications

Both libraries have their strengths and are valuable tools in robotics and mapping, with the choice depending on the specific application requirements and constraints.

An optimization-based multi-sensor state estimator

Pros of VINS-Fusion

  • Provides a complete visual-inertial state estimation system for various applications
  • Supports multiple sensors and fusion strategies
  • Offers real-time performance and high accuracy

Cons of VINS-Fusion

  • More complex setup and configuration compared to Octomap
  • Requires specific sensor inputs (visual and inertial data)
  • May have higher computational requirements

Code Comparison

VINS-Fusion (C++):

void System::ProcessIMU(double t, const Vector3d &linear_acceleration, const Vector3d &angular_velocity)
{
    if (!initial_alignment_flag)
        return;
    estimator.processIMU(t, linear_acceleration, angular_velocity);
}

Octomap (C++):

void OcTree::insertPointCloud(const Pointcloud& scan, const octomap::point3d& sensor_origin,
                              double maxrange, bool lazy_eval) {
  KeySet free_cells, occupied_cells;
  if (this->computeUpdate(scan, sensor_origin, free_cells, occupied_cells, maxrange)) {
    // insert data into tree  
    for (KeySet::iterator it = free_cells.begin(); it != free_cells.end(); ++it) {
      updateNode(*it, false, lazy_eval);
    }
    for (KeySet::iterator it = occupied_cells.begin(); it != occupied_cells.end(); ++it) {
      updateNode(*it, true, lazy_eval);
    }
  }
}

ROS 2 Navigation Framework and System

Pros of navigation2

  • Comprehensive navigation stack for ROS 2, including planning, control, and recovery behaviors
  • Modular architecture allowing easy customization and extension of navigation capabilities
  • Active development and community support within the ROS ecosystem

Cons of navigation2

  • Steeper learning curve due to its complexity and integration with ROS 2
  • Potentially higher computational requirements for full navigation stack

Code Comparison

octomap:

#include <octomap/octomap.h>

octomap::OcTree tree(0.1);  // Create an octree with resolution 0.1
tree.updateNode(point3d(1.0, 2.0, 3.0), true);  // Insert a point

navigation2:

#include "nav2_core/behavior_tree_navigator.hpp"

auto node = std::make_shared<rclcpp::Node>("nav2_node");
nav2_core::BehaviorTreeNavigator navigator(node);
navigator.followPath(path);  // Navigate along a given path

Summary

While octomap focuses on efficient 3D mapping and spatial representation, navigation2 provides a complete navigation solution for ROS 2-based robots. octomap excels in memory-efficient 3D environment modeling, while navigation2 offers a broader set of tools for robot navigation, including path planning and obstacle avoidance. The choice between them depends on the specific requirements of your robotics project and whether you need a full navigation stack or just efficient 3D mapping capabilities.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

OctoMap - An Efficient Probabilistic 3D Mapping Framework Based on Octrees.

http://octomap.github.io

Originally developed by Kai M. Wurm and Armin Hornung, University of Freiburg, Copyright (C) 2009-2014. Currently maintained by Armin Hornung. See the list of contributors for further authors.

License:

Download the latest releases: https://github.com/octomap/octomap/releases

API documentation: https://octomap.github.io/octomap/doc/

Build status: Build Status

Report bugs and request features in our tracker: https://github.com/OctoMap/octomap/issues

A list of changes is available in the octomap changelog

OVERVIEW

OctoMap consists of two separate libraries each in its own subfolder: octomap, the actual library, and octovis, our visualization libraries and tools. This README provides an overview of both, for details on compiling each please see octomap/README.md and octovis/README.md respectively. See http://www.ros.org/wiki/octomap and http://www.ros.org/wiki/octovis if you want to use OctoMap in ROS; there are pre-compiled packages available.

You can build each library separately with CMake by running it from the subdirectories, or build octomap and octovis together from this top-level directory. E.g., to only compile the library, run:

cd octomap
mkdir build
cd build
cmake ..
make

To compile the complete package, run:

cd build
cmake ..
make

Binaries and libs will end up in the directories bin and lib of the top-level directory where you started the build.

Alternatively, you can build and install octomap using vcpkg dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install octomap

The octomap port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

See octomap README and octovis README for further details and hints on compiling, especially under Windows.