feat: add AllianceTranslation class and restore Intake initialization#16
feat: add AllianceTranslation class and restore Intake initialization#16YehudaRothstein wants to merge 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an alliance-aware wrapper for Translation2d (similar to the existing AlliancePose) and adjusts the AlliancePose API surface.
Changes:
- Introduced
AllianceTranslationto convertTranslation2dcoordinates based on current alliance. - Removed the
AlliancePose(double degrees)constructor.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public AlliancePose(Translation2d translation, Rotation2d rotation) { | ||
| this.pose = new Pose2d(translation, rotation); | ||
| } | ||
|
|
||
| public AlliancePose(double degrees) { | ||
| this.pose = new Pose2d(0, 0, Rotation2d.fromDegrees(degrees)); | ||
| } | ||
|
|
||
| public Pose2d get() { |
There was a problem hiding this comment.
AlliancePose(double degrees) was removed. Since AlliancePose is public, removing a public constructor is a source/binary breaking API change for any downstream consumers. If this wasn’t intentional, consider restoring it (or keeping it as a deprecated overload that delegates to the existing constructors).
| private final Translation2d translation2d; | ||
|
|
||
| public AllianceTranslation(double x, double y) { | ||
| this.translation2d = new Translation2d(x, y); | ||
| } | ||
|
|
||
| public AllianceTranslation() { | ||
| this.translation2d = new Translation2d(); | ||
| } | ||
|
|
||
| public AllianceTranslation(Translation2d translation) { | ||
| this.translation2d = translation; | ||
| } | ||
|
|
||
| public Translation2d get() { | ||
| return toAlliancePose(translation2d); |
There was a problem hiding this comment.
In AllianceTranslation, the field name translation2d is redundant with the type and inconsistent with AlliancePose's pose field naming. Renaming it to something like translation would improve readability and reduce noise in later usage.
| private final Translation2d translation2d; | |
| public AllianceTranslation(double x, double y) { | |
| this.translation2d = new Translation2d(x, y); | |
| } | |
| public AllianceTranslation() { | |
| this.translation2d = new Translation2d(); | |
| } | |
| public AllianceTranslation(Translation2d translation) { | |
| this.translation2d = translation; | |
| } | |
| public Translation2d get() { | |
| return toAlliancePose(translation2d); | |
| private final Translation2d translation; | |
| public AllianceTranslation(double x, double y) { | |
| this.translation = new Translation2d(x, y); | |
| } | |
| public AllianceTranslation() { | |
| this.translation = new Translation2d(); | |
| } | |
| public AllianceTranslation(Translation2d translation) { | |
| this.translation = translation; | |
| } | |
| public Translation2d get() { | |
| return toAlliancePose(translation); |
No description provided.