Skip to content

Commit 3eb5391

Browse files
committed
Fix some bugs
1 parent 9baef51 commit 3eb5391

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/jsrm/systems/planar_pcs_num.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def stiffness_fn(
190190
S = B_xi.T @ S @ B_xi
191191

192192
return S
193-
if not isinstance(stiffness_fn, callable):
193+
if not callable(stiffness_fn):
194194
raise TypeError(f"stiffness_fn must be a callable, but got {type(stiffness_fn).__name__}")
195195

196196
# Actuation mapping function
@@ -219,7 +219,7 @@ def actuation_mapping_fn(
219219
A = B_xi.T @ jnp.identity(n_xi) @ B_xi
220220

221221
return A
222-
if not isinstance(actuation_mapping_fn, Callable):
222+
if not callable(actuation_mapping_fn):
223223
raise TypeError(f"actuation_mapping_fn must be a callable, but got {type(actuation_mapping_fn).__name__}")
224224

225225
if integration_type == "gauss-legendre":
@@ -369,7 +369,7 @@ def chi_i(
369369
dth = kappa * l_i # Angle increment for the current segment
370370
th = th_prev + dth
371371

372-
# Compute the integrals for the transformation matrix
372+
# Compute the integrals for the transformation matrix
373373
int_cos_th = jnp.where(
374374
jnp.abs(kappa) < eps,
375375
l_i * jnp.cos(th_prev),

tests/test_fwd_kine_eps_planar_pcs.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ def FwdKine_plot(eps_list, s, sigma_x, sigma_y, fig, axs):
8080
ax.set_ylabel("Fwd Kinematics components")
8181

8282
for i_eps, eps in enumerate(eps_list):
83+
FwdKine_kwargs = {"eps": eps} if eps is not None else {}
8384
FwdKine_auto, FwdKine_exp, FwdKine_symb = [], [], []
8485
for kappa in kappa_values:
8586
q = jnp.array([kappa, sigma_x, sigma_y - 1.0] * num_segments)
86-
FwdKine_auto.append(FwdKine_autodiff_fn(params, q, s, eps=eps))
87-
FwdKine_exp.append(FwdKine_explicit_fn(params, q, s, eps=eps))
88-
FwdKine_symb.append(FwdKine_symbolic_fn(params, q, s, eps=eps))
87+
FwdKine_auto.append(FwdKine_autodiff_fn(params, q, s, **FwdKine_kwargs))
88+
FwdKine_exp.append(FwdKine_explicit_fn(params, q, s, **FwdKine_kwargs))
89+
FwdKine_symb.append(FwdKine_symbolic_fn(params, q, s, **FwdKine_kwargs))
8990
FwdKine_auto, FwdKine_exp, FwdKine_symb = jnp.stack(FwdKine_auto), jnp.stack(FwdKine_exp), jnp.stack(FwdKine_symb)
9091

9192
for i in range(2):

0 commit comments

Comments
 (0)