-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alliance transform utils. Still definitely a WIP. Only quarter done
- Loading branch information
1 parent
55b8edd
commit e397cb1
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import wpilib | ||
from wpilib import DriverStation | ||
from hal import AllianceStationID | ||
|
||
from wpimath.geometry import Pose2d, Rotation2d, Transform2d, Translation2d | ||
from wpimath.geometry import Pose2d, Rotation2d, Transform2d, Translation2d | ||
from wpimath.geometry import Pose2d, Rotation2d, Transform2d, Translation2d | ||
from wpimath.geometry import Pose2d, Rotation2d, Transform2d, Translation2d | ||
from wpimath.geometry import Pose2d, Rotation2d, Transform2d, Translation2d | ||
|
||
""" | ||
Utilities to help transform from blue alliance to red if needed | ||
We went rogue and chose a coordinate system where the origin is always in the | ||
bottom left on the blue alliance | ||
""" | ||
class AllianceTransformUtils: | ||
@staticmethod | ||
def transformX(in): | ||
if DriverStation.getAlliance() == AllianceStationID.Red: | ||
return Constants.FIELD_LENGTH_M - in | ||
else: | ||
return in | ||
|
||
def transformY(in): | ||
return in | ||
|