Skip to content

Commit

Permalink
update proximal algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Jax922 committed Nov 14, 2023
1 parent fb6b2ce commit 894c02a
Show file tree
Hide file tree
Showing 14 changed files with 584 additions and 563 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
conda install -c anaconda ipython_genutils
conda install -c conda-forge meshplot
conda install numba
pip install networkx
conda install -c anaconda networkx
pip install usd-core
coverage run -m unittest python/unit_tests/test_*.py
coverage report
Expand Down
14 changes: 9 additions & 5 deletions python/rainbow/simulators/prox_rigid_bodies/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import rainbow.geometry.surface_mesh as MESH
import rainbow.simulators.prox_rigid_bodies.mass as MASS
import rainbow.simulators.prox_rigid_bodies.collision_detection as CD
import rainbow.simulators.prox_rigid_bodies.gauss_seidel as GS
import rainbow.simulators.proximal_contact.prox_solvers as CONTACT_SOLVERS
from rainbow.simulators.prox_rigid_bodies.types import *
from rainbow.util.timer import Timer
import numpy as np
Expand Down Expand Up @@ -421,8 +421,10 @@ def apply_post_stabilization(J, WJT, x, engine, stats: dict, debug_on) -> dict:
if not g.any():
return stats
mu = np.zeros(K, dtype=np.float64)
sol, stats = GS.solve(
J, WJT, g, mu, GS.prox_origin, engine, stats, debug_on, "post_stabilization_"
sol, stats = CONTACT_SOLVERS.solve(
J, WJT, g, mu, CONTACT_SOLVERS.prox_origin, engine, stats, debug_on,
prefix="post_stabilization_",
scheme=engine.params.proximal_solver
)
vector_positional_update = WJT.dot(sol)
position_update(x, vector_positional_update, 1, engine)
Expand Down Expand Up @@ -537,8 +539,10 @@ def step(self, dt: float, engine: Engine, debug_on: bool) -> None:

mu = get_friction_coefficient_vector(engine)
b = np.multiply(1 + e, v) + J.dot(du_ext) + g
sol, stats = GS.solve(
J, WJT, b, mu, GS.prox_sphere, engine, stats, debug_on, ""
sol, stats = CONTACT_SOLVERS.solve(
J, WJT, b, mu, CONTACT_SOLVERS.prox_sphere, engine, stats, debug_on,
prefix="",
scheme=engine.params.proximal_solver
)
du_contact = WJT.dot(sol)

Expand Down
1 change: 1 addition & 0 deletions python/rainbow/simulators/prox_rigid_bodies/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ def __init__(self):
self.resolution = (
64 # The number of grid cells along each axis in the signed distance fields
)
self.proximal_solver = "gauss_seidel" # or "gauss_seidel", "parallel_gauss_seidel", "parallel_jacobi", "parallel_jacboi_hybrid"


class Engine:
Expand Down
Loading

0 comments on commit 894c02a

Please sign in to comment.