Skip to content

Commit

Permalink
Add AbstractSysID class
Browse files Browse the repository at this point in the history
  • Loading branch information
anivanchen committed Jan 24, 2024
1 parent 21a9858 commit 77944c2
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/main/java/com/stuypulse/robot/RobotContainer.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
/************************ PROJECT PHIL ************************/
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved.*/
/* This work is licensed under the terms of the MIT license. */
/**************************************************************/
/************************ PROJECT SYSID ************************/
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* Use of this source code is governed by an MIT-style license */
/* that can be found in the repository LICENSE file. */
/***************************************************************/

package com.stuypulse.robot;

import com.stuypulse.robot.commands.auton.DoNothingAuton;
import com.stuypulse.robot.constants.Ports;
import com.stuypulse.stuylib.input.Gamepad;
import com.stuypulse.stuylib.input.gamepads.AutoGamepad;

import com.stuypulse.robot.commands.auton.DoNothingAuton;
import com.stuypulse.robot.constants.Ports;
import com.stuypulse.robot.subsystems.AbstractSysID;

import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;

public class RobotContainer {

public final AbstractSysID sysid = AbstractSysID.getInstance();

// Gamepads
public final Gamepad driver = new AutoGamepad(Ports.Gamepad.DRIVER);
public final Gamepad operator = new AutoGamepad(Ports.Gamepad.OPERATOR);

// Subsystem

// Autons
Expand Down Expand Up @@ -51,6 +56,10 @@ private void configureButtonBindings() {}

public void configureAutons() {
autonChooser.setDefaultOption("Do Nothing", new DoNothingAuton());
autonChooser.addOption("Quasistatic Forward", sysid.quasistaticForward());
autonChooser.addOption("Quasistatic Reverse", sysid.quasistaticReverse());
autonChooser.addOption("Dynamic Forward", sysid.dynamicForward());
autonChooser.addOption("Dynamic Reverse", sysid.dynamicReverse());

SmartDashboard.putData("Autonomous", autonChooser);
}
Expand Down
46 changes: 46 additions & 0 deletions src/main/java/com/stuypulse/robot/subsystems/AbstractSysID.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/************************ PROJECT SYSID ************************/
/* Copyright (c) 2024 StuyPulse Robotics. All rights reserved. */
/* Use of this source code is governed by an MIT-style license */
/* that can be found in the repository LICENSE file. */
/***************************************************************/

package com.stuypulse.robot.subsystems;

import static com.stuypulse.robot.constants.Settings.Routine.*;

import com.stuypulse.robot.subsystems.swerve.SwerveDriveSysID;
import com.stuypulse.robot.subsystems.swerve.SwerveTurnSysID;

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

public abstract class AbstractSysID extends SubsystemBase {

public static final AbstractSysID instance;

static {
switch (ROUTINE) {
case SWERVE_DRIVE:
instance = new SwerveDriveSysID();
break;
case SWERVE_TURN:
instance = new SwerveTurnSysID();
break;
default:
instance = null;
break;
}
}

public static AbstractSysID getInstance() {
return instance;
}

public abstract Command quasistaticForward();

public abstract Command quasistaticReverse();

public abstract Command dynamicForward();

public abstract Command dynamicReverse();
}

0 comments on commit 77944c2

Please sign in to comment.