Skip to content

Commit fc144e5

Browse files
committed
Documentation 3D-PCS
1 parent 9d81090 commit fc144e5

File tree

1 file changed

+13
-58
lines changed

1 file changed

+13
-58
lines changed

src/jsrm/systems/pcs.py

Lines changed: 13 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
scale_gaussian_quadrature,
1313
)
1414
from jsrm.math_utils import (
15-
blk_diag,
15+
blk_diag,
1616
compute_weighted_sums,
1717
)
1818
import jsrm.utils.lie_algebra as lie
@@ -88,13 +88,22 @@ def __init__(
8888
Defaults to all strains active (i.e. all True).
8989
xi_star (Optional[Array], optional):
9090
Rest strain of shape (6 * num_segments,).
91-
Defaults to 0.0 for bending and shear strains, and 1.0 for axial strain (along local y-axis).
91+
Defaults to 0.0 for bending and shear strains, and 1.0 for axial strain (along local z-axis).
9292
stiffness_fn (Optional[Callable], optional):
9393
Function to compute the stiffness matrix.
94-
Defaults to a function that computes the stiffness matrix based on the parameters.
94+
Defaults to :
95+
l_i * diag( E_i * Ib_i, # bending X
96+
E_i * Ib_i, # bending Y
97+
G_i * J_i, # torsion Z
98+
4/3 * A_i * G_i, # shear X
99+
4/3 * A_i * G_i, # shear Y
100+
A_i * E_i, # axial Z)
95101
actuation_mapping_fn (Optional[Callable], optional):
96102
Function to compute the actuation mapping.
97-
Defaults to identity mapping.
103+
This function needs to take as input:
104+
- q: generalized coordinates of shape (num_selected_strains,)
105+
- actuation_args: tuple containing the actuation parameters (e.g. torques (tau,)).
106+
Defaults to identity linear mapping. actuation_args = (tau,)
98107
99108
"""
100109
# Number of segments
@@ -358,7 +367,6 @@ def strain_fn(
358367

359368
return xi
360369

361-
# ===================================================================================================================
362370
def forward_kinematics_fn(
363371
self,
364372
q: Array,
@@ -413,59 +421,6 @@ def body_segment_i(g_base_i, i_segment):
413421

414422
return g_s
415423

416-
# def forward_kinematics_fn(
417-
# self,
418-
# q: Array,
419-
# s: Array,
420-
# ) -> Array:
421-
# """
422-
# Compute the forward kinematics of the robot at a point s along the robot.
423-
424-
# Args:
425-
# q (Array): generalized coordinates of shape (num_selected_strains,).
426-
# s (Array): point coordinate along the robot in the interval [0, L].
427-
428-
# Returns:
429-
# g_s (Array): forward kinematics of the robot at point s, shape (4, 4) :
430-
# [[ R, p],
431-
# [0, 0, 0, 1]] where R is the rotation matrix and p is the position vector.
432-
# """
433-
434-
# g_list = self.forward_kinematics_Gauss_fn(q) # shape (num_segments, num_gauss_points, 4, 4)
435-
436-
# # ================================================================================================
437-
# # Extract and interpolate the transformation at point s
438-
# segment_idx, s_local = self.classify_segment(s)
439-
440-
# L_i = self.L[segment_idx]
441-
442-
# # Normalized Gauss points (values in [0, 1]) multiplied by L_i
443-
# s_gauss = self.Xs * L_i # (num_gauss_points,)
444-
445-
# # Find the interval [s_gauss[j], s_gauss[j+1]] such that s_local ∈ [s_gauss[j], s_gauss[j+1]].
446-
# j_idx = jnp.searchsorted(s_gauss, s_local) - 1
447-
# j_idx = jnp.clip(j_idx, 0, self.num_gauss_points - 2)
448-
449-
# # Linear interpolation between the two transformations
450-
# g_list_i = g_list[segment_idx] # forme (num_gauss_points, 4, 4)
451-
# g_ji = g_list_i[j_idx]
452-
# g_jip1 = g_list_i[j_idx + 1]
453-
454-
# # Lengths between the two points
455-
# s_ji = s_gauss[j_idx]
456-
# s_jip1 = s_gauss[j_idx + 1]
457-
# alpha = (s_local - s_ji) / (s_jip1 - s_ji + 1e-10)
458-
459-
# # Interpolation in SE(3) via log-exp
460-
# xi_interp = lie.log_SE3(jnp.linalg.inv(g_ji) @ g_jip1, eps=self.global_eps)
461-
# g_interp = g_ji @ lie.exp_gn_SE3(alpha * xi_interp, eps=self.global_eps)
462-
463-
# g_s = g_interp
464-
465-
# return g_s
466-
467-
# ===================================================================================================================
468-
469424
def J_local_for_computation(self, q: Array, s: Array) -> Array:
470425
"""
471426
Compute the Jacobian of the forward kinematics at a point s along the robot.

0 commit comments

Comments
 (0)