Extremum-Sum Potential¶
ESP Parameters¶
- class ipctk.ESPParameters¶
Bases:
pybind11_objectPublic Data Attributes:
Public Methods:
__init__(self, dhat[, dbar_factor, ...])Construct parameter set for ESP contact.
Private Methods:
_pybind11_conduit_v1_
- class IntegrationType¶
Bases:
pybind11_objectMembers:
BRUTE_FORCE : Integrate all pairs with no obstacle filtering
NORMAL : Filter obstacle-obstacle pairs; skip primitives with only obstacle candidates
NO_OBST : Skip obstacle sources entirely, may miss collisions!
-
BRUTE_FORCE =
<IntegrationType.BRUTE_FORCE: 0>¶
-
NORMAL =
<IntegrationType.NORMAL: 1>¶
-
NO_OBST =
<IntegrationType.NO_OBST: 2>¶
-
__members__ =
{'BRUTE_FORCE': <IntegrationType.BRUTE_FORCE: 0>, 'NORMAL': <IntegrationType.NORMAL: 1>, 'NO_OBST': <IntegrationType.NO_OBST: 2>}¶
- property name : str¶
- property value : int¶
-
BRUTE_FORCE =
-
__init__(self, dhat: SupportsFloat, dbar_factor: SupportsFloat =
0.2, quad_order: SupportsInt =1, area_weights: bool =True, integration_type: ipctk.ESPParameters.IntegrationType =IntegrationType.NORMAL)¶ Construct parameter set for ESP contact.
- Parameters:¶
- dhat: SupportsFloat¶
Activation distance of the barrier.
- dbar_factor: SupportsFloat =
0.2¶ Near/far split parameter dbar / dhat, in [0, 2]. The far part vanishes identically at 2; the edge-edge weights use the support min(dbar, dhat); 0 disables edge-edge contact.
- quad_order: SupportsInt =
1¶ Gauss-Lobatto edge quadrature order (2D).
- area_weights: bool =
True¶ Whether to weight the quadrature by area.
- integration_type: ipctk.ESPParameters.IntegrationType =
IntegrationType.NORMAL¶ Which obstacle primitives to integrate.
- Raises:¶
ValueError – If dhat is not positive and finite, dbar_factor is not in [0, 2], or quad_order is negative.
- property area_weights : bool¶
- property dbar : float¶
- property dhat : float¶
- property integration_type : ipctk.ESPParameters.IntegrationType¶
- property quad_order : int¶
ESP Collisions¶
- class ipctk.ESPCollisions¶
Bases:
pybind11_objectPublic Methods:
__init__(self)build(self, mesh, vertices, param[, broad_phase])Initialize the set of collisions used to compute the potential.
compute_minimum_distance(self, mesh, vertices)Computes the minimum squared distance over the collision candidates found by build().
__len__(self)Get the number of collisions.
empty(self)Get if the collision set is empty.
clear(self)Clear the collision set.
to_string(self, mesh, vertices, param)n_candidates(self)Get the number of candidates.
Private Methods:
_pybind11_conduit_v1_
-
build(self, mesh: ipctk.CollisionMesh, vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous'], param: ipctk.ESPParameters, broad_phase: ipctk.BroadPhase =
None) None¶ Initialize the set of collisions used to compute the potential.
- Parameters:¶
- mesh: ipctk.CollisionMesh¶
The collision mesh.
- vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous']¶
Vertices of the collision mesh.
- param: ipctk.ESPParameters¶
ESPParameters.
- broad_phase: ipctk.BroadPhase =
None¶ Broad phase method.
- compute_minimum_distance(self, mesh: ipctk.CollisionMesh, vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous']) float¶
Computes the minimum squared distance over the collision candidates found by build().
- Parameters:¶
- mesh: ipctk.CollisionMesh¶
The collision mesh.
- vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous']¶
Vertices of the collision mesh.
- Returns:¶
The minimum squared distance, or inf if there are no candidates.
- to_string(self, mesh: ipctk.CollisionMesh, vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous'], param: ipctk.ESPParameters) str¶
-
build(self, mesh: ipctk.CollisionMesh, vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous'], param: ipctk.ESPParameters, broad_phase: ipctk.BroadPhase =
ESP Potential¶
- class ipctk.ESPPotential¶
Bases:
pybind11_objectPublic Methods:
__init__(self, param[, use_near_far])Construct an Extremum Sum Potential (ESP).
__call__(self, collisions, mesh, vertices)Compute the barrier potential for a set of collisions.
gradient(self, collisions, mesh, vertices)Compute the gradient of the barrier potential.
hessian(self, collisions, mesh, vertices[, ...])Compute the hessian of the barrier potential.
Private Methods:
_pybind11_conduit_v1_
- __call__(self, collisions: ipctk.ESPCollisions, mesh: ipctk.CollisionMesh, vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous']) float¶
Compute the barrier potential for a set of collisions.
- Parameters:¶
- collisions: ipctk.ESPCollisions¶
The set of collisions.
- mesh: ipctk.CollisionMesh¶
The collision mesh.
- vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous']¶
Vertices of the collision mesh.
- Returns:¶
The sum of all barrier potentials (not scaled by the barrier stiffness).
-
__init__(self, param: ipctk.ESPParameters, use_near_far: bool =
True)¶ Construct an Extremum Sum Potential (ESP).
- Parameters:¶
- param: ipctk.ESPParameters¶
A set of parameters.
- use_near_far: bool =
True¶ Whether to normalize the quadrature weights so they sum to 1, splitting near and far contributions when 0 < dbar_factor <= 2 (the far part vanishes at 2).
- gradient(self, collisions: ipctk.ESPCollisions, mesh: ipctk.CollisionMesh, vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous']) Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]']¶
Compute the gradient of the barrier potential.
- Parameters:¶
- collisions: ipctk.ESPCollisions¶
The set of collisions.
- mesh: ipctk.CollisionMesh¶
The collision mesh.
- vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous']¶
Vertices of the collision mesh.
- Returns:¶
The gradient of all barrier potentials (not scaled by the barrier stiffness). This will have a size of |vertices|.
-
hessian(self, collisions: ipctk.ESPCollisions, mesh: ipctk.CollisionMesh, vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous'], project_hessian_to_psd: ipctk.PSDProjectionMethod =
PSDProjectionMethod.NONE) scipy.sparse.csc_matrix[numpy.float64]¶ Compute the hessian of the barrier potential.
- Parameters:¶
- collisions: ipctk.ESPCollisions¶
The set of collisions.
- mesh: ipctk.CollisionMesh¶
The collision mesh.
- vertices: Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]', 'flags.f_contiguous']¶
Vertices of the collision mesh.
- project_hessian_to_psd: ipctk.PSDProjectionMethod =
PSDProjectionMethod.NONE¶ Make sure the hessian is positive semi-definite. With normalized weights and edge-edge terms, each face’s block is projected as a whole.
- Returns:¶
The hessian of all barrier potentials (not scaled by the barrier stiffness). This will have a size of |vertices|x|vertices|.