-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8e32bb
commit 0de21ac
Showing
7 changed files
with
137 additions
and
21 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,70 @@ | ||
{ | ||
"name": "4467 Tethys", | ||
"sourceUrl": "https://cad.onshape.com/documents/7bc29be4342772fc741ea201/w/72d85fa68f0e9d0ce28c624b/e/033aff10bbfab8525e72a496", | ||
"rotations": [ | ||
{ | ||
"axis": "x", | ||
"degrees": 0 | ||
}, | ||
{ | ||
"axis" : "y", | ||
"degrees": 0 | ||
}, | ||
{ | ||
"axis": "z", | ||
"degrees": 180 | ||
} | ||
], | ||
"position": [ | ||
0.3302, | ||
0.3302, | ||
-0.0254 | ||
], | ||
"cameras": [], | ||
"components": [ | ||
{ | ||
"zeroedRotations": [ | ||
{ | ||
"axis": "x", | ||
"degrees": 0 | ||
}, | ||
{ | ||
"axis": "y", | ||
"degrees": 0 | ||
}, | ||
{ | ||
"axis": "z", | ||
"degrees": 0 | ||
} | ||
], | ||
|
||
"zeroedPosition": [ | ||
0.0, | ||
0.0, | ||
0.0 | ||
] | ||
}, | ||
{ | ||
"zeroedRotations": [ | ||
{ | ||
"axis": "y", | ||
"degrees": 0 | ||
}, | ||
{ | ||
"axis": "x", | ||
"degrees": 0 | ||
}, | ||
{ | ||
"axis": "z", | ||
"degrees": 0 | ||
} | ||
], | ||
|
||
"zeroedPosition": [ | ||
0.0, | ||
0.0, | ||
0.0 | ||
] | ||
} | ||
] | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
61 changes: 61 additions & 0 deletions
61
src/main/java/frc/robot/subsystems/intake/IntakeVisualizer.java
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,61 @@ | ||
package frc.robot.subsystems.intake; | ||
|
||
import edu.wpi.first.math.geometry.Pose3d; | ||
import edu.wpi.first.math.geometry.Rotation3d; | ||
import edu.wpi.first.math.geometry.Transform3d; | ||
import edu.wpi.first.math.geometry.Translation3d; | ||
import edu.wpi.first.math.util.Units; | ||
import org.littletonrobotics.junction.Logger; | ||
|
||
public class IntakeVisualizer { | ||
private final double xOffsetIntake = Units.inchesToMeters(10.75); | ||
private final double yOffsetIntake = Units.inchesToMeters(9.75); | ||
private final double xOffsetCoral = Units.inchesToMeters(-7.5); | ||
private final double yOffsetCoral = Units.inchesToMeters(18.8); | ||
|
||
private final String key; | ||
|
||
public IntakeVisualizer(String key) { | ||
this.key = key; | ||
} | ||
|
||
public void updateVisualization(double intakeAngle, double coralAngle) { | ||
Pose3d intakePose = new Pose3d( | ||
new Translation3d( | ||
xOffsetIntake, | ||
0.3302, | ||
yOffsetIntake | ||
), | ||
new Rotation3d(0.0, Units.degreesToRadians(45 - intakeAngle), Units.degreesToRadians(180.0)) | ||
).transformBy( | ||
new Transform3d( | ||
new Translation3d( | ||
Units.inchesToMeters(2.3), | ||
0.0, | ||
Units.inchesToMeters(9.75) | ||
).unaryMinus(), | ||
new Rotation3d() | ||
)); | ||
|
||
Pose3d coralPose = new Pose3d( | ||
new Translation3d( | ||
xOffsetCoral, | ||
0.3302, | ||
yOffsetCoral | ||
), | ||
new Rotation3d(0.0, Units.degreesToRadians(coralAngle - 80), Units.degreesToRadians(180.0)) | ||
).transformBy( | ||
new Transform3d( | ||
new Translation3d( | ||
Units.inchesToMeters(20.5), | ||
0.0, | ||
Units.inchesToMeters(18.8) | ||
).unaryMinus(), | ||
new Rotation3d() | ||
)); | ||
|
||
Logger.recordOutput(key + "3D Pose", | ||
intakePose, | ||
coralPose); | ||
} | ||
} |