Commit 6f99f084 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[Doc] add figure for the influence of security_margin and break_distance parameters.

parent de6a4365
import matplotlib.pyplot as plt
import numpy as np
from math import sqrt
interactive = False
m = 1.
b = 1.2
mb = m+b
X = np.array([ -mb/2, 0, m, mb, 2*mb ])
#X = np.linspace(-1, 4., 21)
def dlb(d):
if d<0: return None
if d > mb:
u = d-mb
return mb-m + u / 2
return d-m
plt.figure(figsize=(9, 3.5))
#plt.plot(X, X-m, ":k")
#plt.plot([m+b, X[-1]], [b, b], ":k")
plt.fill_between([m+b, X[-1]], [b, b], [b, X[-1]-m], alpha=0.2, hatch="|", facecolor="g", label="Distance lower band area")
plt.plot(X, [ dlb(x) for x in X ], "-g", label="distance lower bound")
#plt.plot([X[0], m, m, X[-1]], [0, 0, b, b], ":k")
plt.axvspan(X[0], m, alpha=0.5, hatch="\\", facecolor="r", label="Collision area")
ax = plt.gca()
ax.set_xlabel("Object distance")
ax.set_xticks([0, m, mb])
ax.set_xticklabels(["0", "security margin", "security margin\n+ break distance"])
ax.set_yticks([0, b])
ax.set_yticklabels(["0", "break distance"])
ax.grid(which="major", ls="solid")
ax.grid(which="minor", ls="dashed")
plt.axvline(0, ls="solid")
#plt.axvline(m, ls="dashed", label="margin")
#plt.axvline(mb, ls="dashed")
plt.axhline(0., ls="solid")
plt.title("Collision and distance lower band")
plt.legend(loc="lower right")
if interactive:
plt.show()
else:
import os.path as path
dir_path = path.dirname(path.realpath(__file__))
plt.savefig(path.join(dir_path, "distance_computation.png"),
bbox_inches="tight",
orientation="landscape")
......@@ -164,10 +164,12 @@ struct CollisionRequest
/// @brief the gjk intial guess set by user
Vec3f cached_gjk_guess;
/// @brief Distance below which objects are considered in collision
/// @brief Distance below which objects are considered in collision.
/// See \ref hpp_fcl_collision_and_distance_lower_bound_computation
FCL_REAL security_margin;
/// @brief Distance below which bounding volumes are break down
/// @brief Distance below which bounding volumes are broken down.
/// See \ref hpp_fcl_collision_and_distance_lower_bound_computation
FCL_REAL break_distance;
explicit CollisionRequest(size_t num_max_contacts_,
......@@ -213,8 +215,10 @@ private:
public:
Vec3f cached_gjk_guess;
/// Lower bound on distance between objects if they are disjoint
/// @note computed only on request.
/// Lower bound on distance between objects if they are disjoint.
/// See \ref hpp_fcl_collision_and_distance_lower_bound_computation
/// @note computed only on request (or if it does not add any computational
/// overhead).
FCL_REAL distance_lower_bound;
public:
......
......@@ -32,10 +32,15 @@
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
namespace hpp
{
namespace fcl
{
/// \mainpage
/// \anchor hpp_fcl_documentation
///
/// \par Introduction
/// \section hpp_fcl_introduction Introduction
///
/// hpp-fcl is a modified version the FCL libraries.
///
......@@ -49,3 +54,22 @@
/// The main entry points to the library are functions
/// \li hpp::fcl::collide(const CollisionObject*, const CollisionObject*, const CollisionRequest&, CollisionResult&)
/// \li hpp::fcl::distance(const CollisionObject*, const CollisionObject*, const DistanceRequest&, DistanceResult&)
///
/// \section hpp_fcl_collision_and_distance_lower_bound_computation Collision detection and distance lower bound
///
/// Collision queries can return a distance lower bound between the two objects,
/// which is computationally cheaper than computing the real distance.
/// The following figure shows the returned result in
/// CollisionResult::distance_lower_bound and DistanceResult::min_distance,
/// with respect to the objects real distance.
///
/// \image html doc/distance_computation.png
///
/// The two parameters refer to CollisionRequest::security_margin and
/// CollisionRequest::break_distance.
/// \note In the green hatched area, the distance lower bound is not known. It
/// is only guaranted that it will be inferior to
/// <em>distance - security_margin</em> and superior to \em break_distance.
} // namespace fcl
} // namespace hpp
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment