Skip to content

Commit

Permalink
Jurrasic Marsh Day 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Tategami99 committed Aug 26, 2023
1 parent dd1ca2b commit 567619b
Show file tree
Hide file tree
Showing 3 changed files with 845 additions and 5 deletions.
52 changes: 52 additions & 0 deletions src/main/java/frc/robot/subsystems/vision/LimelightHelperUser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.subsystems.vision;

import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

import frc.robot.subsystems.vision.LimelightHelpers;

public class LimelightHelperUser extends SubsystemBase {
String limelightName = "limelight";

/** Creates a new ExampleSubsystem. */
public LimelightHelperUser(String limelightName) {
this.limelightName = limelightName;
}

/**
* Example command factory method.
*
* @return a command
*/
public CommandBase exampleMethodCommand() {
// Inline construction of command goes here.
// Subsystem::RunOnce implicitly requires `this` subsystem.
return runOnce(
() -> {
/* one-time action goes here */
});
}

public Pose3d getPose3d() {
return LimelightHelpers.getLatestResults(limelightName).targetingResults.getBotPose3d();
}

public double getX() {
return getPose3d().getX();
}

public double getY() {
return getPose3d().getY();
}

public void reportToSmartDashboard() {
SmartDashboard.putNumber("Vision Robot X", getX());
SmartDashboard.putNumber("Vision Robot Y", getY());
}
}
Loading

0 comments on commit 567619b

Please sign in to comment.