Skip to content

Webcams#9

Merged
zachwaffle4 merged 30 commits into
NextFTC:developfrom
28shettr:webcams
Jul 1, 2026
Merged

Webcams#9
zachwaffle4 merged 30 commits into
NextFTC:developfrom
28shettr:webcams

Conversation

@28shettr

Copy link
Copy Markdown

Wrapper for Limelight and Husky lens


/** Returns the straight-line distance (hypotenuse) from the robot to the AprilTag matching [id] (or any visible tag if [id] is null) in the given [unit]. */
@JvmOverloads
fun getDistance(unit: DistanceUnit = DistanceUnit.INCH, id: Int? = null): Double {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Use NextFTC units as opposed to SDK units.

Comment thread hardware/src/main/kotlin/dev/nextftc/hardware/webcams/NextLimelight.kt Outdated
val rawXMeters = botpose.getPosition().x
val rawYMeters = botpose.getPosition().y

val inchX = Inches.fromBaseUnits(rawYMeters)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since Limelight returns things in meters, just use rawXMeters.meters, etc.

}

/** Returns the robot's field position from the latest Limelight result in Pedro coordinates, or `null` if no valid pose is available. */
fun getPedroPoseFromLimelight(): Pose2d? {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would recommend removing the FromLimelight part of these method names (because they are methods of the Limelight class). Also, I recommend simply calling getPose here and transforming it instead of duplicating most of it's logic.

@zachwaffle4 zachwaffle4 merged commit 6f9fe8c into NextFTC:develop Jul 1, 2026
2 checks passed
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.

2 participants