-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Robot configuration #24
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package frc.robot; | ||
|
||
import frc.robot.Constants.ChassisMode; | ||
import frc.robot.Constants.DriveMode; | ||
|
||
public class RobotConfiguration { | ||
|
||
private DriveMode driveMode; | ||
private ChassisMode chassisMode; | ||
private boolean armEnabled; | ||
|
||
public RobotConfiguration(ChassisMode chassisConfig, DriveMode driveConfig) { | ||
this.driveMode = driveConfig; | ||
this.chassisMode = chassisConfig; | ||
|
||
armEnabled = (chassisConfig == ChassisMode.B_TEAM); | ||
|
||
} | ||
|
||
public DriveMode driveConfig() { | ||
return driveMode; | ||
} | ||
|
||
public ChassisMode chassisConfig() { | ||
return chassisMode; | ||
} | ||
|
||
|
||
public boolean armEnabled() { | ||
return armEnabled; | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
package frc.robot.subsystems; | ||
package frc.robot.subsystems.drive; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import frc.robot.Constants; | ||
import frc.robot.Constants.DriveConstants; | ||
import frc.robot.Constants.B_Configs; | ||
import frc.robot.Constants.C_Configs; | ||
import frc.robot.Constants.DriveMode; | ||
import frc.robot.Constants.ChassisMode;; | ||
|
||
public class DriveSubsystem extends SubsystemBase{ | ||
|
||
public enum ChassisMode { | ||
B_TEAM, | ||
C_TEAM | ||
} | ||
|
||
public enum DriveMode { | ||
TANKDRIVE, | ||
ARCADEDRIVE | ||
} | ||
|
||
private DriveHardware driveHardware; | ||
|
||
|
@@ -25,9 +18,9 @@ public enum DriveMode { | |
|
||
public DriveSubsystem(ChassisMode chassisMode, DriveMode driveMode) { | ||
if (chassisMode == ChassisMode.B_TEAM) { | ||
driveHardware = new DriveSparkMAX(DriveConstants.frontLeftID, DriveConstants.frontRightID, DriveConstants.backLeftID, DriveConstants.backRightID); | ||
driveHardware = new DriveSparkMAX(B_Configs.frontLeftID, B_Configs.frontRightID, B_Configs.backLeftID, B_Configs.backRightID); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't all these configs be passed in via the robot configuration class rather than these constants There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the DriveSubsystem constructor have all of the motor controller ids then? |
||
} else { | ||
driveHardware = new DriveTalon(DriveConstants.frontLeftID, DriveConstants.frontRightID, DriveConstants.backLeftID, DriveConstants.backRightID); | ||
driveHardware = new DriveTalon(C_Configs.frontLeftID, C_Configs.frontRightID, C_Configs.backLeftID, C_Configs.backRightID); | ||
} | ||
mode = driveMode; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default command should match the drive mode