Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
vision code not finished
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluewaves54 committed Jan 13, 2024
1 parent aea93a7 commit 2c8f5b2
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import com.pathplanner.lib.util.ReplanningConfig;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.button.CommandPS4Controller;
import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
import frc.robot.commands.drive.DriveCommandFactory;
import frc.robot.commands.drive.FeedForwardCharacterization;
import frc.robot.constants.Constants;
Expand All @@ -25,7 +24,7 @@ public class RobotContainer {
private final DriveBase m_drive;

// Controller
private final CommandPS4Controller controller = new CommandPS4Controller(0);
private final CommandJoystick controller = new CommandJoystick(0);

// Dashboard inputs
private final LoggedDashboardChooser<Command> autoChooser;
Expand Down Expand Up @@ -129,11 +128,11 @@ private void configureButtonBindings() {
m_drive.setDefaultCommand(
DriveCommandFactory.joystickDrive(
m_drive,
() -> -controller.getLeftY(),
() -> -controller.getLeftX(),
() -> -controller.getRightX(),
() -> -controller.getY(),
() -> -controller.getX(),
() -> -controller.getZ(),
0.1));
controller.cross().onTrue(Commands.runOnce(m_drive::stopWithX, m_drive));
// controller.cross().onTrue(Commands.runOnce(m_drive::stopWithX, m_drive));
}

public Command getAutonomousCommand() {
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/frc/robot/subsystems/vision/VisionBase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package frc.robot.subsystems.vision;

import edu.wpi.first.wpilibj2.command.SubsystemBase;

import edu.wpi.first.apriltag.AprilTagFieldLayout;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Transform2d;
import frc.robot.subsystems.drive.DriveBase;
import org.photonvision.PhotonPoseEstimator.PoseStrategy;

public class VisionBase {
public VisionIO m_io;
public DriveBase m_drive;
public VisionInputsAutoLogged m_inputs;
public Pose2d lastPose2d;

public VisionBase(
VisionIO io,
Transform2d cameraToRobot,
DriveBase drive
) {
m_io = io;
m_inputs = new VisionInputsAutoLogged();
}

public void periodic() {
}
}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/subsystems/vision/VisionIO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package frc.robot.subsystems.vision;

public interface VisionIO extends LoggedIO<VisionInputs>{

}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/subsystems/vision/VisionIOCamera.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package frc.robot.subsystems.vision;

public class VisionIOCamera implements VisionIO {

}
57 changes: 57 additions & 0 deletions vendordeps/photonlib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"fileName": "photonlib.json",
"name": "photonlib",
"version": "v2024.1.2",
"uuid": "515fe07e-bfc6-11fa-b3de-0242ac130004",
"frcYear": "2024",
"mavenUrls": [
"https://maven.photonvision.org/repository/internal",
"https://maven.photonvision.org/repository/snapshots"
],
"jsonUrl": "https://maven.photonvision.org/repository/internal/org/photonvision/PhotonLib-json/1.0/PhotonLib-json-1.0.json",
"jniDependencies": [],
"cppDependencies": [
{
"groupId": "org.photonvision",
"artifactId": "photonlib-cpp",
"version": "v2024.1.2",
"libName": "photonlib",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxathena",
"linuxx86-64",
"osxuniversal"
]
},
{
"groupId": "org.photonvision",
"artifactId": "photontargeting-cpp",
"version": "v2024.1.2",
"libName": "photontargeting",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxathena",
"linuxx86-64",
"osxuniversal"
]
}
],
"javaDependencies": [
{
"groupId": "org.photonvision",
"artifactId": "photonlib-java",
"version": "v2024.1.2"
},
{
"groupId": "org.photonvision",
"artifactId": "photontargeting-java",
"version": "v2024.1.2"
}
]
}

0 comments on commit 2c8f5b2

Please sign in to comment.