Skip to content
Open
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
13 changes: 9 additions & 4 deletions serl_robot_infra/franka_env/utils/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def construct_adjoint_matrix(tcp_pose):
)
adjoint_matrix = np.zeros((6, 6))
adjoint_matrix[:3, :3] = rotation
adjoint_matrix[:3, 3:] = skew_matrix @ rotation # linear components precede angular
adjoint_matrix[3:, 3:] = rotation
adjoint_matrix[3:, :3] = skew_matrix @ rotation
return adjoint_matrix


Expand All @@ -38,8 +38,13 @@ def construct_homogeneous_matrix(tcp_pose):

def construct_adjoint_matrix_from_euler(tcp_pose):
"""
Construct the adjoint matrix for a spatial velocity vector
:args: tcp_pose: (x, y, z, qx, qy, qz, qw)
Construct the adjoint matrix for a spatial velocity vector (twist ordered as [v, ω]).

Args:
tcp_pose (array-like): (x, y, z, roll, pitch, yaw)
Pose of the TCP, where rotation is represented by Euler angles (in radians, 'xyz' order).
Returns:
np.ndarray: (6, 6) adjoint transformation matrix.
"""
rotation = R.from_euler("xyz", tcp_pose[3:]).as_matrix()
translation = np.array(tcp_pose[:3])
Expand All @@ -52,8 +57,8 @@ def construct_adjoint_matrix_from_euler(tcp_pose):
)
adjoint_matrix = np.zeros((6, 6))
adjoint_matrix[:3, :3] = rotation
adjoint_matrix[:3, 3:] = skew_matrix @ rotation # linear components precede angular
adjoint_matrix[3:, 3:] = rotation
adjoint_matrix[3:, :3] = skew_matrix @ rotation
return adjoint_matrix


Expand Down