Skip to content

Commit 66f69bc

Browse files
Test: enable vision drive command
Enable vision drive command in autonomous for testing purposes. - Weston J
1 parent 4a5bfe5 commit 66f69bc

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/main/java/frc/robot/Robot.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import frc.robot.lib.config.ConfigTable;
2020
import frc.robot.lib.config.TomlConfigLoader;
2121
import frc.robot.subsystems.drive.Drivetrain;
22+
import frc.robot.subsystems.vision.*;
23+
import frc.robot.commands.visionDriveCommand.*;
2224

2325
/**
2426
* The VM is configured to automatically run this class, and to call the functions corresponding to
@@ -34,6 +36,10 @@ public class Robot extends TimedRobot {
3436

3537
private Drivetrain kDrivetrain = null;
3638

39+
private Vision kVisionSubsystem = null;
40+
41+
private VisionDriveCommand kVisionDriveCommand = null;
42+
3743
/**
3844
* This function is run when the robot is first started up and should be used for any
3945
* initialization code.
@@ -53,7 +59,10 @@ public void robotInit() {
5359
throw new Error("Unable to find config table 'drivetrain' ");
5460
}
5561

56-
kDrivetrain = new Drivetrain(table.get());
62+
kDrivetrain = new Drivetrain(table.get());
63+
64+
kVisionSubsystem = new Vision();
65+
kVisionDriveCommand = new VisionDriveCommand(kVisionSubsystem, kDrivetrain, 1, Units.Milliseconds.of(20.0));
5766

5867
m_chooser.setDefaultOption("Default Auto", kDefaultAuto);
5968
m_chooser.addOption("My Auto", kCustomAuto);
@@ -70,6 +79,9 @@ public void robotInit() {
7079
@Override
7180
public void robotPeriodic() {
7281
CommandScheduler.getInstance().run();
82+
// update the kVisionSubsytem
83+
kVisionSubsystem.updateLimelight();
84+
kVisionSubsystem.updateSmartDashboard();
7385
}
7486

7587
/**
@@ -87,6 +99,11 @@ public void autonomousInit() {
8799
m_autoSelected = m_chooser.getSelected();
88100
// m_autoSelected = SmartDashboard.getString("Auto Selector", kDefaultAuto);
89101
System.out.println("Auto selected: " + m_autoSelected);
102+
103+
CommandScheduler.getInstance().schedule(
104+
kVisionDriveCommand
105+
);
106+
90107
}
91108

92109
/** This function is called periodically during autonomous. */

0 commit comments

Comments
 (0)