Tesseract 0.28.4
Loading...
Searching...
No Matches
implicit_sdf_collision_solver.cpp File Reference

Backend-neutral collision queries between implicit signed-distance shapes. More...

#include <tesseract/collision/implicit_sdf_collision_solver.h>
#include <tesseract/geometry/geometries.h>
#include <tesseract/geometry/impl/signed_distance_field.h>
#include <algorithm>
#include <array>
#include <cmath>
#include <limits>
#include <stdexcept>
#include <utility>

Functions

std::vector< ImplicitSDFContacttesseract::collision::collideImplicitSDF (const ImplicitSDFShape &shape0, const ImplicitSDFShape &shape1, const ImplicitSDFCollisionConfig &config={})
 Find contacts between two implicit signed-distance shapes.
 
ImplicitSDFShape tesseract::collision::makeImplicitSDFShape (const tesseract::geometry::Geometry &geometry, const Eigen::Isometry3d &pose)
 Create a world-coordinate implicit representation of a supported Tesseract geometry.
 

Detailed Description

Backend-neutral collision queries between implicit signed-distance shapes.

The multi-start optimization strategy is adapted from MuJoCo's SDF collision implementation: https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_collision_sdf.c MuJoCo is licensed under the Apache License, Version 2.0.

License
Software License Agreement (Apache License)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Function Documentation

◆ collideImplicitSDF()

std::vector< ImplicitSDFContact > tesseract::collision::collideImplicitSDF ( const ImplicitSDFShape shape0,
const ImplicitSDFShape shape1,
const ImplicitSDFCollisionConfig config = {} 
)

Find contacts between two implicit signed-distance shapes.

This adapts MuJoCo's multi-start SDF collision strategy: deterministic Halton seeds are optimized over the overlap of the shapes' margin-expanded AABBs using a composite collision objective and backtracking gradient descent. Contact distance and nearest points are then recovered by projecting the converged point onto both zero level sets.

Parameters
shape0First implicit shape
shape1Second implicit shape
configSolver configuration
Returns
Contacts with normals directed from shape0 toward shape1
Exceptions
std::invalid_argumentIf either shape or any solver configuration value is invalid

◆ makeImplicitSDFShape()

ImplicitSDFShape tesseract::collision::makeImplicitSDFShape ( const tesseract::geometry::Geometry geometry,
const Eigen::Isometry3d &  pose 
)

Create a world-coordinate implicit representation of a supported Tesseract geometry.

Supported geometries are box, sphere, cylinder, cone, capsule, and signed distance field. This adapter is backend-neutral and is used by FCL; other backends may provide callbacks around their native distance representations and call collideImplicitSDF directly.

Parameters
geometryGeometry to represent
poseGeometry pose in world coordinates
Returns
A valid implicit shape when the geometry is supported, otherwise an invalid shape
Exceptions
std::invalid_argumentIf the pose or supported geometry data is invalid, or if an SDF has nonuniform scale

Variable Documentation

◆ gradient

two_spheres gradient
Initial value:
= [center0, center1](const Eigen::Vector3d& point) {
const Eigen::Vector3d offset0 = point - center0;
const Eigen::Vector3d offset1 = point - center1;
return (offset0.squaredNorm() < offset1.squaredNorm()) ? offset0.normalized() : offset1.normalized();
}