Skip to content

Commit 61ce1c8

Browse files
committed
init
1 parent b9e9659 commit 61ce1c8

File tree

8 files changed

+44
-48
lines changed

8 files changed

+44
-48
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ dependencies {
8888
simulationRelease wpi.sim.enableRelease()
8989

9090
implementation 'com.google.code.gson:gson:2.10.1'
91-
implementation 'com.github.Programming-TRIGON:TRIGONLib:2024.2.13'
91+
implementation 'com.github.Programming-TRIGON:TRIGONLib:v2024.2.13'
9292

9393
def akitJson = new groovy.json.JsonSlurper().parseText(new File(projectDir.getAbsolutePath() + "/vendordeps/AdvantageKit.json").text)
9494
annotationProcessor "org.littletonrobotics.akit.junction:junction-autolog:$akitJson.version"

src/main/java/frc/trigon/robot/RobotContainer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import frc.trigon.robot.commands.factories.AutonomousCommands;
1515
import frc.trigon.robot.commands.factories.GeneralCommands;
1616
import frc.trigon.robot.commands.factories.ShootingCommands;
17-
import frc.trigon.robot.constants.CameraConstants;
1817
import frc.trigon.robot.constants.OperatorConstants;
1918
import frc.trigon.robot.poseestimation.poseestimator.PoseEstimator;
2019
import frc.trigon.robot.subsystems.MotorSubsystem;
@@ -32,8 +31,8 @@
3231

3332
public class RobotContainer {
3433
public static final PoseEstimator POSE_ESTIMATOR = new PoseEstimator(
35-
CameraConstants.FRONT_TAG_CAMERA,
36-
CameraConstants.REAR_TAG_CAMERA
34+
// CameraConstants.FRONT_TAG_CAMERA,
35+
// CameraConstants.REAR_TAG_CAMERA
3736
);
3837
public static final Swerve SWERVE = new Swerve();
3938
public static final Intake INTAKE = new Intake();

src/main/java/frc/trigon/robot/commands/AlignToNoteCommand.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
import edu.wpi.first.math.geometry.Rotation2d;
55
import edu.wpi.first.wpilibj2.command.Command;
66
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
7-
import edu.wpi.first.wpilibj2.command.RunCommand;
87
import frc.trigon.robot.RobotContainer;
98
import frc.trigon.robot.commands.factories.GeneralCommands;
10-
import frc.trigon.robot.constants.CameraConstants;
119
import frc.trigon.robot.constants.OperatorConstants;
12-
import frc.trigon.robot.misc.objectdetectioncamera.ObjectDetectionCamera;
1310
import frc.trigon.robot.subsystems.intake.IntakeConstants;
1411
import frc.trigon.robot.subsystems.ledstrip.LEDStrip;
1512
import frc.trigon.robot.subsystems.ledstrip.LEDStripCommands;
@@ -18,16 +15,16 @@
1815
import org.trigon.utilities.mirrorable.MirrorableRotation2d;
1916

2017
public class AlignToNoteCommand extends ParallelCommandGroup {
21-
private static final ObjectDetectionCamera CAMERA = CameraConstants.NOTE_DETECTION_CAMERA;
18+
// private static final ObjectDetectionCamera CAMERA = CameraConstants.NOTE_DETECTION_CAMERA;
2219
private static final PIDController Y_PID_CONTROLLER = RobotHardwareStats.isSimulation() ?
2320
new PIDController(0.0075, 0, 0) :
2421
new PIDController(0.0002, 0, 0);
2522

2623
public AlignToNoteCommand() {
2724
addCommands(
2825
getSetCurrentLEDColorCommand(),
29-
GeneralCommands.getContinuousConditionalCommand(getDriveWhileAligningToNoteCommand(), GeneralCommands.duplicate(CommandConstants.FIELD_RELATIVE_DRIVE_COMMAND), this::shouldAlignToNote).asProxy(),
30-
new RunCommand(CAMERA::trackObject)
26+
GeneralCommands.getContinuousConditionalCommand(getDriveWhileAligningToNoteCommand(), GeneralCommands.duplicate(CommandConstants.FIELD_RELATIVE_DRIVE_COMMAND), this::shouldAlignToNote).asProxy()
27+
// new RunCommand(CAMERA::trackObject)
3128
);
3229
}
3330

@@ -49,14 +46,16 @@ private Command getSetCurrentLEDColorCommand() {
4946
IntakeConstants.ALIGN_TO_NOTE_BREATHING_IS_INVERTED,
5047
LEDStrip.LED_STRIPS
5148
),
52-
CAMERA::hasTargets
49+
() -> false
50+
// CAMERA::hasTargets
5351
).asProxy();
5452
}
5553

5654
private Command getDriveWhileAligningToNoteCommand() {
5755
return SwerveCommands.getClosedLoopSelfRelativeDriveCommand(
5856
() -> fieldRelativePowersToSelfRelativeXPower(OperatorConstants.DRIVER_CONTROLLER.getLeftY(), OperatorConstants.DRIVER_CONTROLLER.getLeftX()),
59-
() -> -Y_PID_CONTROLLER.calculate(CAMERA.getTrackedObjectYaw().getDegrees()),
57+
() -> 0,
58+
// () -> -Y_PID_CONTROLLER.calculate(CAMERA.getTrackedObjectYaw().getDegrees()),
6059
this::getTargetAngle
6160
);
6261
}
@@ -71,10 +70,10 @@ private double fieldRelativePowersToSelfRelativeXPower(double xPower, double yPo
7170

7271
private MirrorableRotation2d getTargetAngle() {
7372
final Rotation2d currentRotation = RobotContainer.POSE_ESTIMATOR.getCurrentEstimatedPose().getRotation();
74-
return new MirrorableRotation2d(currentRotation.plus(CAMERA.getTrackedObjectYaw()), false);
73+
return new MirrorableRotation2d(currentRotation.plus(new Rotation2d()), false);
7574
}
7675

7776
private boolean shouldAlignToNote() {
78-
return CAMERA.hasTargets() && !RobotContainer.INTAKE.isEarlyNoteCollectionDetected();
77+
return false && !RobotContainer.INTAKE.isEarlyNoteCollectionDetected();
7978
}
8079
}

src/main/java/frc/trigon/robot/commands/factories/AutonomousCommands.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
1111
import frc.trigon.robot.RobotContainer;
1212
import frc.trigon.robot.constants.AutonomousConstants;
13-
import frc.trigon.robot.constants.CameraConstants;
1413
import frc.trigon.robot.constants.ShootingConstants;
15-
import frc.trigon.robot.misc.objectdetectioncamera.ObjectDetectionCamera;
1614
import frc.trigon.robot.subsystems.intake.IntakeCommands;
1715
import frc.trigon.robot.subsystems.intake.IntakeConstants;
1816
import frc.trigon.robot.subsystems.ledstrip.LEDStrip;
@@ -29,7 +27,7 @@
2927
* A class that contains commands that are used during the 15-second autonomous period at the start of each match.
3028
*/
3129
public class AutonomousCommands {
32-
private static final ObjectDetectionCamera NOTE_DETECTION_CAMERA = CameraConstants.NOTE_DETECTION_CAMERA;
30+
// private static final ObjectDetectionCamera NOTE_DETECTION_CAMERA = CameraConstants.NOTE_DETECTION_CAMERA;
3331
private static boolean IS_ALIGNING_TO_NOTE = false;
3432

3533
public static Command getResetPoseToAutoPoseCommand(Supplier<String> pathName) {
@@ -61,7 +59,7 @@ public static Command getFeedNoteCommand() {
6159
public static Command getAlignToNoteCommand() {
6260
return new InstantCommand(
6361
() -> {
64-
NOTE_DETECTION_CAMERA.startTrackingBestObject();
62+
// NOTE_DETECTION_CAMERA.startTrackingBestObject();
6563
overrideRotation(AutonomousCommands::calculateRotationOverride);
6664
IS_ALIGNING_TO_NOTE = true;
6765
}
@@ -100,13 +98,14 @@ public static Command getPrepareShooterCommand(double targetVelocityRotationsPer
10098
}
10199

102100
private static Optional<Rotation2d> calculateRotationOverride() {
103-
NOTE_DETECTION_CAMERA.trackObject();
104-
if (RobotContainer.INTAKE.hasNote() || !NOTE_DETECTION_CAMERA.hasTargets())
105-
return Optional.empty();
106-
107-
final Rotation2d currentRotation = RobotContainer.POSE_ESTIMATOR.getCurrentEstimatedPose().getRotation();
108-
final Rotation2d targetRotation = NOTE_DETECTION_CAMERA.getTrackedObjectYaw().minus(currentRotation);
109-
return Optional.of(targetRotation);
101+
// NOTE_DETECTION_CAMERA.trackObject();
102+
// if (RobotContainer.INTAKE.hasNote() || !NOTE_DETECTION_CAMERA.hasTargets())
103+
// return Optional.empty();
104+
//
105+
// final Rotation2d currentRotation = RobotContainer.POSE_ESTIMATOR.getCurrentEstimatedPose().getRotation();
106+
// final Rotation2d targetRotation = NOTE_DETECTION_CAMERA.getTrackedObjectYaw().minus(currentRotation);
107+
// return Optional.of(targetRotation);
108+
return null;
110109
}
111110

112111
private static void overrideRotation(Supplier<Optional<Rotation2d>> rotationOverride) {
@@ -117,7 +116,7 @@ private static Command getSetCurrentLEDColorCommand() {
117116
return GeneralCommands.getContinuousConditionalCommand(
118117
LEDStripCommands.getStaticColorCommand(IntakeConstants.NOTE_DETECTION_CAMERA_HAS_TARGETS_BREATHING_LEDS_COLOR, LEDStrip.LED_STRIPS),
119118
LEDStripCommands.getStaticColorCommand(IntakeConstants.NOTE_DETECTION_CAMERA_HAS_NO_TARGETS_BREATHING_LEDS_COLOR, LEDStrip.LED_STRIPS),
120-
NOTE_DETECTION_CAMERA::hasTargets
119+
() -> false
121120
).asProxy().until(() -> !IS_ALIGNING_TO_NOTE);
122121
}
123122
}

src/main/java/frc/trigon/robot/constants/CameraConstants.java

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
import edu.wpi.first.math.geometry.Transform3d;
55
import edu.wpi.first.math.geometry.Translation3d;
66
import edu.wpi.first.math.util.Units;
7-
import frc.trigon.robot.misc.objectdetectioncamera.ObjectDetectionCamera;
8-
import frc.trigon.robot.poseestimation.apriltagcamera.AprilTagCamera;
9-
import frc.trigon.robot.poseestimation.apriltagcamera.AprilTagCameraConstants;
107
import org.trigon.hardware.RobotHardwareStats;
118

129
public class CameraConstants {
@@ -24,21 +21,21 @@ public class CameraConstants {
2421
new Rotation3d(Math.PI - Units.degreesToRadians(0), Units.degreesToRadians(-33), Math.PI + Units.degreesToRadians(0))
2522
);
2623

27-
public static final AprilTagCamera
28-
FRONT_TAG_CAMERA = new AprilTagCamera(
29-
AprilTagCameraConstants.AprilTagCameraType.PHOTON_CAMERA,
30-
"FrontTagCamera",
31-
FRONT_CENTER_TO_CAMERA,
32-
THETA_STD_EXPONENT,
33-
TRANSLATIONS_STD_EXPONENT
34-
),
35-
REAR_TAG_CAMERA = new AprilTagCamera(
36-
AprilTagCameraConstants.AprilTagCameraType.PHOTON_CAMERA,
37-
"RearTagCamera",
38-
REAR_CENTER_TO_CAMERA,
39-
THETA_STD_EXPONENT,
40-
TRANSLATIONS_STD_EXPONENT
41-
);
42-
43-
public static final ObjectDetectionCamera NOTE_DETECTION_CAMERA = new ObjectDetectionCamera("NoteDetectionCamera");
24+
// public static final AprilTagCamera
25+
// FRONT_TAG_CAMERA = new AprilTagCamera(
26+
// AprilTagCameraConstants.AprilTagCameraType.PHOTON_CAMERA,
27+
// "FrontTagCamera",
28+
// FRONT_CENTER_TO_CAMERA,
29+
// THETA_STD_EXPONENT,
30+
// TRANSLATIONS_STD_EXPONENT
31+
// ),
32+
// REAR_TAG_CAMERA = new AprilTagCamera(
33+
// AprilTagCameraConstants.AprilTagCameraType.PHOTON_CAMERA,
34+
// "RearTagCamera",
35+
// REAR_CENTER_TO_CAMERA,
36+
// THETA_STD_EXPONENT,
37+
// TRANSLATIONS_STD_EXPONENT
38+
// );
39+
//
40+
// public static final ObjectDetectionCamera NOTE_DETECTION_CAMERA = new ObjectDetectionCamera("NoteDetectionCamera");
4441
}

src/main/java/frc/trigon/robot/constants/RobotConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class RobotConstants {
88
private static final RobotHardwareStats.ReplayType REPLAY_TYPE = RobotHardwareStats.ReplayType.NONE;
99
private static final double PERIODIC_TIME_SECONDS = 0.02;
10-
public static final String CANIVORE_NAME = "CANivore";
10+
public static final String CANIVORE_NAME = "SwerveCANivore";
1111
public static final String LOGGING_PATH = Robot.IS_REAL ? "/media/sda1/akitlogs/" : FilesHandler.DEPLOY_PATH + "logs/";
1212

1313
public static void init() {

src/main/java/frc/trigon/robot/constants/ShootingConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ShootingConstants {
1414
SPEAKER_SHOT_STANDING_EXTRA_VELOCITY_BUFFER_ROTATIONS_PER_SECOND = 3;
1515

1616
public static final double
17-
CLOSE_SHOT_VELOCITY_ROTATIONS_PER_SECOND = 45,
17+
CLOSE_SHOT_VELOCITY_ROTATIONS_PER_SECOND = 25,
1818
AMP_SHOOTING_VELOCITY_ROTATIONS_PER_SECOND = 37,
1919
MANUAL_LOW_DELIVERY_SHOOTING_VELOCITY_ROTATIONS_PER_SECOND = 45,
2020
EJECT_FROM_SHOOTER_VELOCITY_ROTATIONS_PER_SECOND = 10,

src/main/java/frc/trigon/robot/subsystems/intake/IntakeConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ private static void configureMasterMotor() {
121121
config.Audio.BeepOnConfig = false;
122122

123123
config.HardwareLimitSwitch.ReverseLimitEnable = false;
124+
config.HardwareLimitSwitch.ForwardLimitEnable = false;
124125

125126
config.Feedback.SensorToMechanismRatio = GEAR_RATIO;
126127

@@ -142,6 +143,7 @@ private static void configureFollowerMotor() {
142143
config.Audio.BeepOnConfig = false;
143144

144145
config.HardwareLimitSwitch.ReverseLimitEnable = false;
146+
config.HardwareLimitSwitch.ForwardLimitEnable = false;
145147

146148
FOLLOWER_MOTOR.applyConfiguration(config);
147149

0 commit comments

Comments
 (0)