Skip to content

Commit 62a7aa4

Browse files
committed
Creation of a test file for planar_pcs_num.py
Corrected documentation Removal of unnecessary imports Ready to merge
1 parent 81e5895 commit 62a7aa4

File tree

10 files changed

+531
-2652
lines changed

10 files changed

+531
-2652
lines changed

examples/benchmark_planar_pcs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import matplotlib.pyplot as plt
1010
import numpy as onp
1111
from pathlib import Path
12-
from typing import Callable, Dict
12+
from typing import Callable, Dict, Optional, Literal
1313

1414
import jsrm
1515
from jsrm import ode_factory
@@ -23,10 +23,10 @@
2323

2424
def simulate_planar_pcs_value_eval(
2525
num_segments: int,
26-
type_of_derivation: str = "symbolic",
27-
type_of_integration: str = "gauss-legendre",
26+
type_of_derivation: Optional[Literal["symbolic", "numeric"]] = "symbolic",
27+
type_of_integration: Optional[Literal["gauss-legendre", "gauss-kronrad", "trapezoid"]] = "gauss-legendre",
2828
param_integration: int = None,
29-
type_of_jacobian: str = "explicit",
29+
type_of_jacobian: Optional[Literal["explicit", "autodiff"]] = "explicit",
3030
robot_params: Dict[str, Array] = None,
3131
strain_selector: Array = None,
3232
q0: Array = None,

src/jsrm/systems/planar_pcs.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ def actuation_mapping_fn(
261261
return A
262262

263263
def forward_kinematics_fn(
264-
params: Dict[str, Array], q: Array, s: Array, eps: float = global_eps
264+
params: Dict[str, Array],
265+
q: Array,
266+
s: Array,
267+
eps: float = global_eps
265268
) -> Array:
266269
"""
267270
Evaluate the forward kinematics the tip of the links
@@ -294,7 +297,10 @@ def forward_kinematics_fn(
294297
return chi
295298

296299
def jacobian_fn(
297-
params: Dict[str, Array], q: Array, s: Array, eps: float = global_eps
300+
params: Dict[str, Array],
301+
q: Array,
302+
s: Array,
303+
eps: float = global_eps
298304
) -> Array:
299305
"""
300306
Evaluate the forward kinematics the tip of the links
@@ -329,7 +335,10 @@ def jacobian_fn(
329335
return J
330336

331337
def dynamical_matrices_fn(
332-
params: Dict[str, Array], q: Array, q_d: Array, eps: float = 1e4 * global_eps
338+
params: Dict[str, Array],
339+
q: Array,
340+
q_d: Array,
341+
eps: float = 1e4 * global_eps
333342
) -> Tuple[Array, Array, Array, Array, Array, Array]:
334343
"""
335344
Compute the dynamical matrices of the system.
@@ -377,7 +386,11 @@ def dynamical_matrices_fn(
377386

378387
return B, C, G, K, D, alpha
379388

380-
def kinetic_energy_fn(params: Dict[str, Array], q: Array, q_d: Array) -> Array:
389+
def kinetic_energy_fn(
390+
params: Dict[str, Array],
391+
q: Array,
392+
q_d: Array
393+
) -> Array:
381394
"""
382395
Compute the kinetic energy of the system.
383396
Args:

0 commit comments

Comments
 (0)