Skip to content

Commit

Permalink
Merge pull request #14 from FabioBergonti/adjoint
Browse files Browse the repository at this point in the history
Implement adjoint transform method
  • Loading branch information
Giulero authored Jun 19, 2024
2 parents 234f242 + 0811733 commit 08c8c13
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/liecasadi/se3.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ def as_matrix(self) -> Matrix:
cs.horzcat([0, 0, 0, 1]).T,
)

def as_adjoint_transform(self) -> Matrix:
R = SO3(self.xyzw).as_matrix()
p = self.pos
return cs.vertcat(
cs.horzcat(R, cs.skew(p) @ R), cs.horzcat(np.zeros((3, 3)), R)
)

def as_coadjoint_transform(self) -> Matrix:
R = SO3(self.xyzw).as_matrix()
p = self.pos
return cs.vertcat(
cs.horzcat(R, np.zeros((3, 3))), cs.horzcat(cs.skew(p) @ R, R)
)

@staticmethod
def from_position_quaternion(xyz: Vector, xyzw: Vector) -> "SE3":
assert xyz.shape in [(3,), (3, 1)]
Expand Down

0 comments on commit 08c8c13

Please sign in to comment.