mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-26 01:51:40 +00:00
Upgrade to wpilib alpha-6 (#2434)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ryanforce08 <rradtke1208@gmail.com> Co-authored-by: PJ Reiniger <pj.reiniger@gmail.com> Co-authored-by: Jade Turner <spacey-sooty@proton.me> Co-authored-by: Matt Morley <matthew.morley.ca@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from typing import Self
|
||||
|
||||
from wpimath.geometry import Pose3d, Rotation3d, Transform3d, Translation3d
|
||||
from wpimath import Pose3d, Rotation3d, Transform3d, Translation3d
|
||||
|
||||
|
||||
class RotTrlTransform3d:
|
||||
@@ -22,7 +22,7 @@ class RotTrlTransform3d:
|
||||
|
||||
def inverse(self) -> Self:
|
||||
"""The inverse of this transformation. Applying the inverse will "undo" this transformation."""
|
||||
invRot = -self.rot
|
||||
invRot = self.rot.inverse()
|
||||
invTrl = -(self.trl.rotateBy(invRot))
|
||||
return type(self)(invRot, invTrl)
|
||||
|
||||
@@ -42,7 +42,7 @@ class RotTrlTransform3d:
|
||||
return trlToApply.rotateBy(self.rot) + self.trl
|
||||
|
||||
def applyRotation(self, rotToApply: Rotation3d) -> Rotation3d:
|
||||
return rotToApply + self.rot
|
||||
return rotToApply.rotateBy(self.rot)
|
||||
|
||||
def applyPose(self, poseToApply: Pose3d) -> Pose3d:
|
||||
return Pose3d(
|
||||
@@ -68,7 +68,9 @@ class RotTrlTransform3d:
|
||||
@classmethod
|
||||
def makeBetweenPoses(cls, initial: Pose3d, last: Pose3d) -> Self:
|
||||
return cls(
|
||||
last.rotation() - initial.rotation(),
|
||||
last.rotation().relativeTo(initial.rotation()),
|
||||
last.translation()
|
||||
- initial.translation().rotateBy(last.rotation() - initial.rotation()),
|
||||
- initial.translation().rotateBy(
|
||||
last.rotation().relativeTo(initial.rotation())
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user