Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/roboticstoolbox/ets/ETS.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,10 @@ def partial_fkine0(self, q: ArrayLike, n: int) -> NDArray:
where the Jacobian is the first partial derivative and the Hessian is the
second.

The result has shape ``(self.n,) * (n - 1) + (6, self.n)``. Each
leading axis differentiates with respect to a joint in sequence order;
the last two axes have the same ordering as :meth:`jacob0`.

.. rubric:: Examples

The following example makes a ``Panda`` robot object, and solves for the
Expand Down Expand Up @@ -1135,6 +1139,11 @@ def add_pdi(pdi: Any) -> Any:
rot = np.zeros(3)
trn = np.zeros(3)

# H[k, :3, j] = w[min(j, k)] x v[max(j, k)].
# H[k, 3:, j] = w[k] x w[j] only when k precedes j:
# a downstream joint cannot change an upstream joint axis.
first, last = sorted(count[:2])

# This loop calculates a single column ([trn, rot])
# of the tensor for dT(x)
for j in range(len(indices)):
Expand All @@ -1158,11 +1167,14 @@ def add_pdi(pdi: Any) -> Any:
col0_rot = pdr0[tuple(idx0_slices) + (slice(3, 6), idx0_n)]
col1_rot = pdr1[tuple(idx1_slices) + (slice(3, 6), idx1_n)]

# Use our indices to select the translational column from pdr1
col1_trn = pdr1[tuple(idx1_slices) + (slice(0, 3), idx1_n)]

# Perform the cross product as described in the maths above
rot += np.cross(col0_rot, col1_rot)
if count[1] < count[0]:
rot += np.cross(col0_rot, col1_rot)

# Apply the same product rule to the ordered translational
# Hessian factors, retaining each factor's derivative indices.
col0_rot = pdr0[tuple(idx0_slices) + (slice(3, 6), first)]
col1_trn = pdr1[tuple(idx1_slices) + (slice(0, 3), last)]
trn += np.cross(col0_rot, col1_trn)

pd[tuple(np.flip(count[1:])) + (slice(0, 3), count[0])] = trn
Expand Down
Loading
Loading