Skip to content

Commit 47e3491

Browse files
committed
Fix bug in implementation of potential_energy_fn for planar_pcs system
1 parent 8065b56 commit 47e3491

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ name = "jsrm" # Required
1717
#
1818
# For a discussion on single-sourcing the version, see
1919
# https://packaging.python.org/guides/single-sourcing-package-version/
20-
version = "0.0.8" # Required
20+
version = "0.0.9" # Required
2121

2222
# This is a one-line description or tagline of what your project does. This
2323
# corresponds to the "Summary" metadata field:

src/jsrm/systems/planar_pcs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ def select_params_for_lambdify(params: Dict[str, Array]) -> List[Array]:
111111
G_lambda = sp.lambdify(
112112
params_syms_cat + sym_exps["state_syms"]["xi"], sym_exps["exps"]["G"], "jax"
113113
)
114+
U_lambda = sp.lambdify(
115+
params_syms_cat + sym_exps["state_syms"]["xi"], sym_exps["exps"]["U"], "jax"
116+
)
114117

115118
compute_stiffness_matrix_for_all_segments_fn = vmap(
116119
compute_planar_stiffness_matrix, in_axes=(0, 0, 0, 0), out_axes=0
@@ -300,9 +303,8 @@ def potential_energy_fn(params: Dict[str, Array], q: Array, eps: float = 1e4 * g
300303
U_K = (xi - xi_eq).T @ K @ (xi - xi_eq) # evaluate K(xi) = K @ xi
301304

302305
# gravitational potential energy
303-
U_G = sp.Matrix([[0]])
304306
params_for_lambdify = select_params_for_lambdify(params)
305-
U_G = G_lambda(*params_for_lambdify, *xi_epsed).squeeze() @ xi_epsed
307+
U_G = U_lambda(*params_for_lambdify, *xi_epsed)
306308

307309
# total potential energy
308310
U = (U_G + U_K).squeeze()

0 commit comments

Comments
 (0)