Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pose Estimation with Limelight #36

Draft
wants to merge 10 commits into
base: predcmp
Choose a base branch
from
Draft

Pose Estimation with Limelight #36

wants to merge 10 commits into from

Conversation

sswadkar
Copy link
Member

No description provided.

@sswadkar sswadkar marked this pull request as ready for review March 25, 2023 17:06
@sswadkar sswadkar marked this pull request as draft March 25, 2023 17:07
}

fun Pose3d.closerToInTranslation(pose1: Pose3d, pose2: Pose3d): Pose3d {
val distToPose1 =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this - pose1).translation.norm?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or (this.translation - pose1.translation).norm

return Pose3d(this.x, this.y, 0.0.meters, Rotation3d(0.0.degrees, 0.0.degrees, this.rotation))
}

fun Angle.rotateBy(angle: Angle): Angle {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between this and just adding two angles?

cameraTransform: Transform3d,
targetHeight: Length
): Pose3d {
val horizontalAngleFromRobot = tx + cameraTransform.rotation.x
Copy link
Member

@plusparth plusparth Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is cleaner to do all of the math from the camera's perspective then rotate by the camera transform in the end.

Also, tx and rotation about x are not describing the same thing (tx is rotation about Z I think because it is describing how far in the horizontal FOV the blob is)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also make sure your sign convention is what WPILib uses -- is limelight tx positive in the direction you expect?

val rotationFromTargetToRobot =
Rotation3d(0.0.degrees, verticalAngleFromRobot, horizontalAngleFromRobot)

val xDistanceFromTargetToRobot = (targetHeight - cameraTransform.x) / verticalAngleFromRobot.tan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cameraTransform.z?


return currentPose
.toPose3d()
.transformBy(cameraTransform)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do this if we already ended up in the robot coordinate frame earlier?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants