Skip to content

Commit

Permalink
features
Browse files Browse the repository at this point in the history
  • Loading branch information
dannynotsmart committed May 11, 2024
1 parent e9064e4 commit fa438f0
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 66 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Our robot code is centered around [Robot.java](src/main/java/org/sciborgs1155/ro

This project currently contains drive, vision, and autos. You are expected to add/modify code supporting existing files and new subsystems when using this template. Some of these files include but are not limited to:
- **[Autos.java](src/main/java/org/sciborgs1155/robot/commands/Autos.java)** Add code for new subsystems in `configureAutos`, such as commands for `NamedCommands`
- **[VisionConstants.java](src/main/java/org/sciborgs1155/robot/vision/VisionConstants.java)** Add new `CameraConfig` objects representing cameras on the robot in the field `CAMERAS`. Also modify any camera configurations or constants if needed.
- **[VisionConstants.java](src/main/java/org/sciborgs1155/robot/vision/VisionConstants.java)** Add new `CameraConfig` fields representing cameras on the robot, and change the `create` method in [Vision](src/main/java/org/sciborgs1155/robot/vision/Vision.java). Also modify any camera configurations or constants if needed.
- **[Constants.java](src/main/java/org/sciborgs1155/robot/Constants.java)** Modify the class `Field` to be updated for each year's game, and any other constants if needed.
- **[Ports.java](src/main/java/org/sciborgs1155/robot/Ports.java)** Modify existing OI and drive ports, as well as adding new ports.
- **[Robot.java](src/main/java/org/sciborgs1155/robot/Robot.java)** A lot needs to be added/modified in this file, self-explanatory.
Expand Down
39 changes: 0 additions & 39 deletions src/main/java/org/sciborgs1155/lib/FakePDH.java

This file was deleted.

1 change: 0 additions & 1 deletion src/main/java/org/sciborgs1155/lib/FaultLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ public static void register(CANSparkBase spark) {
"motor above 100°C",
FaultType.WARNING);
// TODO actually fix PDH (this is cursed)
FakePDH.register(spark);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/sciborgs1155/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import monologue.Monologue;
import org.littletonrobotics.urcl.URCL;
import org.sciborgs1155.lib.CommandRobot;
import org.sciborgs1155.lib.FakePDH;
import org.sciborgs1155.lib.FaultLogger;
import org.sciborgs1155.lib.InputStream;
import org.sciborgs1155.lib.SparkUtils;
Expand Down Expand Up @@ -71,7 +70,6 @@ private void configureGameBehavior() {
SmartDashboard.putData(CommandScheduler.getInstance());
// Log PDH
// SmartDashboard.putData("PDH", new PowerDistribution());
addPeriodic(() -> log("current", FakePDH.update()), PERIOD.in(Seconds));

// Configure pose estimation updates every tick
addPeriodic(() -> drive.updateEstimates(vision.getEstimatedGlobalPoses()), PERIOD.in(Seconds));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/sciborgs1155/robot/vision/Vision.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.sciborgs1155.robot.vision;

import static org.sciborgs1155.robot.Constants.*;
import static org.sciborgs1155.robot.vision.VisionConstants.*;

import edu.wpi.first.math.Matrix;
Expand All @@ -25,7 +26,6 @@
import org.photonvision.targeting.PhotonPipelineResult;
import org.photonvision.targeting.PhotonTrackedTarget;
import org.sciborgs1155.lib.FaultLogger;
import org.sciborgs1155.robot.Constants.Field;
import org.sciborgs1155.robot.Robot;

public class Vision implements Logged {
Expand All @@ -41,7 +41,7 @@ public static record PoseEstimate(EstimatedRobotPose estimatedPose, Matrix<N3, N

/** A factory to create new vision classes with our two configured cameras */
public static Vision create() {
return new Vision(CAMERAS);
return new Vision(BACK_LEFT_CAMERA, BACK_RIGHT_CAMERA);
}

public Vision(CameraConfig... configs) {
Expand Down
45 changes: 24 additions & 21 deletions src/main/java/org/sciborgs1155/robot/vision/VisionConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,30 @@ public class VisionConstants {

/* The front of the robot is defined at the intake */

public static final CameraConfig[] CAMERAS = {
new CameraConfig(
"back left",
new Transform3d(
new Translation3d(Inches.of(-10.74), Inches.of(11.617), Inches.of(17.25)),
new Rotation3d(0, -Math.PI / 6, 5 * Math.PI / 6))),
new CameraConfig(
"back right",
new Transform3d(
new Translation3d(Inches.of(-10.74), Inches.of(-11.617), Inches.of(17.25)),
new Rotation3d(0, -Math.PI / 6, -5 * Math.PI / 6))),
new CameraConfig(
"front left",
new Transform3d(
new Translation3d(-0.089, 0.3, 0.46),
new Rotation3d(Math.PI, -Math.PI / 6, Math.PI / 6))),
new CameraConfig(
"front right",
new Transform3d(
new Translation3d(-0.273, -0.3, 0.485), new Rotation3d(0, -Math.PI / 6, -Math.PI / 6)))
};
public static final CameraConfig BACK_LEFT_CAMERA =
new CameraConfig(
"back left",
new Transform3d(
new Translation3d(Inches.of(-10.74), Inches.of(11.617), Inches.of(17.25)),
new Rotation3d(0, -Math.PI / 6, 5 * Math.PI / 6)));
public static final CameraConfig BACK_RIGHT_CAMERA =
new CameraConfig(
"back right",
new Transform3d(
new Translation3d(Inches.of(-10.74), Inches.of(-11.617), Inches.of(17.25)),
new Rotation3d(0, -Math.PI / 6, -5 * Math.PI / 6)));
public static final CameraConfig FRONT_LEFT_CAMERA =
new CameraConfig(
"front left",
new Transform3d(
new Translation3d(-0.089, 0.3, 0.46),
new Rotation3d(Math.PI, -Math.PI / 6, Math.PI / 6)));
public static final CameraConfig FRONT_RIGHT_CAMERA =
new CameraConfig(
"front right",
new Transform3d(
new Translation3d(-0.273, -0.3, 0.485),
new Rotation3d(0, -Math.PI / 6, -Math.PI / 6)));

// OV9281 constants for our configuration
public static final int WIDTH = 1280;
Expand Down

0 comments on commit fa438f0

Please sign in to comment.