Skip to content

Software

Coal

By Coal, from github.com/coal-library/coal (opens in a new tab)

  • Robot arms and industry
  • Library
  • BSD-3-Clause

Coal is a C++ collision detection library, an extension of the Flexible Collision Library, with Python bindings. It computes collisions, distances and contacts between geometric shapes.

Facts

GitHub stars
671read on 27 Nov 2026
Last update
27 Nov 2026Newest commit on devel
Maintenance
Activea commit in the last 90 days
Difficulty
Advanced

Checked on GitHub on 28 Nov 2026.

Licenses

Code
BSD-3-Clause (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (BSD-3-Clause) at commit 0169562 (opens in a new tab), on 28 Nov 2026.

Commercial use
Yes

At a glance

What it is
  • Implements dedicated GJK and EPA algorithms instead of relying on libccd.
  • Supports safety margins for collision detection and lower bounds on distance when no collision is found.
  • Computes contact points and contact patches between objects.
  • Supports primitive shapes, convex meshes, BVHs, height fields and octrees, and has Python bindings.
  • Used by robotics frameworks such as Pinocchio, the Humanoid Path Planner and Simple.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
BSD-3-Clause. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Active, last commit on 27 Nov 2026.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 0169562

Robotheca read the repository at two versions: the summary at 6014b0c and the facts and the README at 0169562 (read on 28 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by Coal, at commit 0169562, under BSD-3-Clause (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

Coal — An extension of the Flexible Collision Library

FCL (opens in a new tab) was forked in 2015, creating a new project called HPP-FCL. Since then, a large part of the code has been rewritten or removed (unused and untested code), and new features have been introduced (see below). Due to these major changes, it was decided in 2024 to rename the HPP-FCL project to Coal.

If you use Coal in your projects and research papers, we would appreciate it if you would cite it (opens in a new tab).

Table of contents
New features

Compared to the original FCL (opens in a new tab) library, the main new features are:

  • dedicated and efficient implementations of the GJK and the EPA algorithms (we do not rely on libccd (opens in a new tab))
  • the support of safety margins for collision detection
  • an accelerated version of collision detection à la Nesterov, which leads to increased performance (up to a factor of 2). More details are available in this paper (opens in a new tab)
  • the computation of a lower bound of the distance between two objects when collision checking is performed, and no collision is found
  • the implementation of Python bindings for easy code prototyping
  • the support of new geometries such as height fields, capsules, ellipsoids, etc.
  • enhance reliability with the fix of a myriad of bugs
  • efficient computation of contact points and contact patches between objects
  • full support of object serialization via Boost.Serialization

Note: the broad phase was reintroduced by Justin Carpentier (opens in a new tab) in 2022, based on the FCL version 0.7.0.

This project is now used in several robotics frameworks such as Pinocchio (opens in a new tab), an open-source library which implements efficient and versatile rigid-body dynamics algorithms, the Humanoid Path Planner (opens in a new tab), an open-source library for Motion and Manipulation Planning. Coal has recently also been used to develop Simple (opens in a new tab), a new (differentiable) and efficient simulator for robotics and beyond.

A high-performance library

Unlike the original FCL library, Coal implements the well-established GJK algorithm (opens in a new tab) and its variants (opens in a new tab) for collision detection and distance computation. These implementations lead to state-of-the-art performance, as shown in the figures below.

On the one hand, we have benchmarked Coal against major state-of-the-art software alternatives:

  1. the Bullet simulator (opens in a new tab),
  2. the original FCL library (opens in a new tab) (used in the Drake framework (opens in a new tab)),
  3. the libccd library (opens in a new tab) (used in MuJoCo (opens in a new tab)).

The results are depicted in the following figure, which notably shows that the accelerated variants of GJK largely outperform by a large margin (from 5x up to 15x times faster). Please notice that the y-axis is in log scale.

Coal vs the rest of the world

On the other hand, why do we care about dedicated collision detection solvers like GJK for the narrow phase? Why can't we simply formulate the collision detection problem as a quadratic problem and call an off-the-shelf optimization solver like ProxQP (opens in a new tab))? Here is why:

Coal vs generic QP solvers

One can observe that GJK-based approaches largely outperform solutions based on classic optimization solvers (e.g., QP solver like ProxQP (opens in a new tab)), notably for large geometries composed of tens or hundreds of vertices.

Open-source projects relying on Coal
Installation
Conda

Coal can be installed from the conda-forge channel (opens in a new tab):

conda install coal -c conda-forge
Docker
docker run --rm -it ghcr.io/coal-library/coal:devel
C++ example

Both the C++ library and the python bindings can be installed as simply as conda -c conda-forge install coal. The .so library, include files and python bindings will then be installed under $CONDA_PREFIX/lib, $CONDA_PREFIX/include and $CONDA_PREFIX/lib/python3.XX/site-packages.

Here is an example of using Coal in C++:

#include "coal/math/transform.h"
#include "coal/mesh_loader/loader.h"
#include "coal/BVH/BVH_model.h"
#include "coal/collision.h"
#include "coal/collision_data.h"
#include <iostream>
#include <memory>

// Function to load a convex mesh from a `.obj`, `.stl` or `.dae` file.
//
// This function imports the object inside the file as a BVHModel, i.e. a point cloud
// which is hierarchically transformed into a tree of bounding volumes.
// The leaves of this tree are the individual points of the point cloud
// stored in the `.obj` file.
// This BVH can then be used for collision detection.
//
// For better computational efficiency, we sometimes prefer to work with
// the convex hull of the point cloud. This insures that the underlying object
// is convex and thus very fast collision detection algorithms such as
// GJK or EPA can be called with this object.
// Consequently, after creating the BVH structure from the point cloud, this function
// also computes its convex hull.
std::shared_ptr<coal::ConvexBase> loadConvexMesh(const std::string& file_name) {
  coal::NODE_TYPE bv_type = coal::BV_AABB;
  coal::MeshLoader loader(bv_type);
  coal::BVHModelPtr_t bvh = loader.load(file_name);
  bvh->buildConvexHull(true, "Qt");
  return bvh->convex;
}

int main() {
  // Create the coal shapes.
  // Coal supports many primitive shapes: boxes, spheres, capsules, cylinders, ellipsoids, cones, planes,
  // halfspace and convex meshes (i.e. convex hulls of clouds of points).
  // It also supports BVHs (bounding volumes hierarchies), height-fields and octrees.
  std::shared_ptr<coal::Ellipsoid> shape1 = std::make_shared<coal::Ellipsoid>(0.7, 1.0, 0.8);
  std::shared_ptr<coal::ConvexBase> shape2 = loadConvexMesh("../path/to/mesh/file.obj");

  // Define the shapes' placement in 3D space
  coal::Transform3s T1;
  T1.setQuatRotation(coal::Quaternion3f::UnitRandom());
  T1.setTranslation(coal::Vec3s::Random());
  coal::Transform3s T2 = coal::Transform3s::Identity();
  T2.setQuatRotation(coal::Quaternion3f::UnitRandom());
  T2.setTranslation(coal::Vec3s::Random());

  // Define collision requests and results.
  //
  // The collision request allows to set parameters for the collision pair.
  // For example, we can set a positive or negative security margin.
  // If the distance between the shapes is less than the security margin, the shapes
  // will be considered in collision.
  // Setting a positive security margin can be usefull in motion planning,
  // i.e to prevent shapes from getting too close to one another.
  // In physics simulation, allowing a negative security margin may be usefull to stabilize the simulation.
  coal::CollisionRequest col_req;
  col_req.security_margin = 1e-1;
  // A collision result stores the result of the collision test (signed distance between the shapes,
  // witness points location, normal etc.)
  coal::CollisionResult col_res;

  // Collision call
  coal::collide(shape1.get(), T1, shape2.get(), T2, col_req, col_res);

  // We can access the collision result once it has been populated
  std::cout << "Collision? " << col_res.isCollision() << "\n";
  if (col_res.isCollision()) {
    coal::Contact contact = col_res.getContact(0);
    // The penetration depth does **not** take into account the security margin.
    // Consequently, the penetration depth is the true signed distance which separates the shapes.
    // To have the distance which takes into account the security margin, we can simply add the two together.
    std::cout << "Penetration depth: " << contact.penetration_depth << "\n";
    std::cout << "Distance between the shapes including the security margin: " << contact.penetration_depth + col_req.security_margin << "\n";
    std::cout << "Witness point on shape1: " << contact.nearest_points[0].transpose() << "\n";
    std::cout << "Witness point on shape2: " << contact.nearest_points[1].transpose() << "\n";
    std::cout << "Normal: " << contact.normal.transpose() << "\n";
  }

  // Before calling another collision test, it is important to clear the previous results stored in the collision result.
  col_res.clear();

  return 0;
}
Python example

Here is the C++ example from above translated in python using the python bindings of Coal:

import numpy as np
import coal

# Optional:
# The Pinocchio library is a rigid body algorithms library and has a handy SE3 module.
# It can be installed as simply as `conda -c conda-forge install pinocchio`.
# Installing pinocchio also installs coal.
import pinocchio as pin


def loadConvexMesh(file_name: str):
    loader = coal.MeshLoader()
    bvh: coal.BVHModelBase = loader.load(file_name)
    bvh.buildConvexHull(True, "Qt")
    return bvh.convex


if __name__ == "__main__":
    # Create coal shapes
    shape1 = coal.Ellipsoid(0.7, 1.0, 0.8)
    shape2 = loadConvexMesh("../path/to/mesh/file.obj")

    # Define the shapes' placement in 3D space
    T1 = coal.Transform3s()
    T1.setTranslation(pin.SE3.Random().translation)
    T1.setRotation(pin.SE3.Random().rotation)
    T2 = coal.Transform3s()
    # Using np arrays also works
    T1.setTranslation(np.random.rand(3))
    T2.setRotation(pin.SE3.Random().rotation)

    # Define collision requests and results
    col_req = coal.CollisionRequest()
    col_res = coal.CollisionResult()

    # Collision call
    coal.collide(shape1, T1, shape2, T2, col_req, col_res)

    # Accessing the collision result once it has been populated
    print("Is collision? ", {col_res.isCollision()})
    if col_res.isCollision():
        contact: coal.Contact = col_res.getContact(0)
        print("Penetration depth: ", contact.penetration_depth)
        print(
            "Distance between the shapes including the security margin: ",
            contact.penetration_depth + col_req.security_margin,
        )
        print("Witness point shape1: ", contact.getNearestPoint1())
        print("Witness point shape2: ", contact.getNearestPoint2())
        print("Normal: ", contact.normal)

    # Before running another collision call, it is important to clear the old one
    col_res.clear()
Contribution

If you want to ask a question, report a bug, request a new feature or contribute with a pull request, please follow the contribution guideline (opens in a new tab).

Core-dev team

The currently active core developers of coal are:

Credits

In addition to the core dev team, the following people have also been involved in the development of coal and are warmly thanked for their contributions:

If you have participated in the development of coal, please add your name and contribution to this list.

Acknowledgments

The development of Coal is actively supported by the Gepetto team (opens in a new tab) @LAAS-CNRS (opens in a new tab), the Willow team (opens in a new tab) @INRIA (opens in a new tab) and, to some extent, Eureka Robotics (opens in a new tab).

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.