Skip to content

Commit

Permalink
Revert "NeuralNetwork support"
Browse files Browse the repository at this point in the history
This reverts commit c69dffa.
  • Loading branch information
cherriae committed Mar 20, 2024
1 parent 88a079b commit 5a1ff5c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 107 deletions.
75 changes: 0 additions & 75 deletions src/main/java/frc/robot/commands/auto/NoteAllign.java

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/frc/robot/subsystems/VisionSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
*/
public class VisionSubsystem extends SubsystemBase {
private final LimelightHelper _main = new LimelightHelper("main");
private final LimelightHelper _intake = new LimelightHelper("intake");


private final MedianFilter _xFilter = new MedianFilter(20); // TODO: change?
private final MedianFilter _yFilter = new MedianFilter(20);
Expand Down Expand Up @@ -176,11 +174,4 @@ public double[] tagAngleOffsets(int ID) {

return angles;
}

public double[] getNoteAngles() {
JsonNode target = _intake.getNeuralTarget();
double[] angles = {target.get("tx").asDouble(), target.get("ty").asDouble()};

return angles;
}
}
32 changes: 9 additions & 23 deletions src/main/java/frc/robot/utils/helpers/LimelightHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;

import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance;
Expand All @@ -30,33 +28,21 @@ public NetworkTableEntry getEntry(String name) {
return _limelight.getEntry(name);
}

/** Return json from limelight. */
public JsonNode getJson() {
String jsonString = getEntry("json").getString("");
try {
return _objectMapper.readTree(jsonString);
} catch (Exception e) {
throw new Error("Cannot Read JSON From Limelight.");
}
}

/**
* Returns the neural target from the limelight.
*
*/
public JsonNode getNeuralTarget() {
ArrayNode targets = (ArrayNode) getJson().get("Results").get("Detector");

return targets.get(0);
}

/**
* Returns a JsonNode array containing found tags and their info.
*
* @see JsonNode
*/
public JsonNode getTags() {
JsonNode tags = getJson().get("Results").get("Fiducial");
String jsonString = getEntry("json").getString("");

JsonNode tags;

try {
tags = _objectMapper.readTree(jsonString).get("Results").get("Fiducial");
} catch (Exception e) {
throw new Error("Cannot Read JSON From Limelight.");
}

return tags;
}
Expand Down

0 comments on commit 5a1ff5c

Please sign in to comment.