Skip to content
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

use RequirementsSubsystemBase #11

Open
wants to merge 1 commit into
base: pre-comp-pleaseeeeeee
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.RamseteCommand;
import edu.wpi.first.wpilibj2.command.Subsystem;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class Chassis2023 extends WestCoastDrive {
public static final double RAMP_START_ANGLE = 9.0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package org.usfirst.frc4904.robot.subsystems;

import org.usfirst.frc4904.standard.subsystems.RequirementsSubsystemBase;
import org.usfirst.frc4904.standard.subsystems.motor.SparkMaxMotorSubsystem;

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

public class Intake extends SubsystemBase {
public class Intake extends RequirementsSubsystemBase {
public static int DEFAULT_INTAKE_SPEED = -1; // TODO: set value
public SparkMaxMotorSubsystem motors;
public Intake (SparkMaxMotorSubsystem motors){ //motors has leftmotor and rightmotot
super(motors);
this.motors = motors;
}
public Command setVoltage(double voltage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.opencv.core.Mat.Tuple2;
import org.usfirst.frc4904.standard.custom.motioncontrollers.ezControl;
import org.usfirst.frc4904.standard.custom.motioncontrollers.ezMotion;
import org.usfirst.frc4904.standard.subsystems.RequirementsSubsystemBase;
import org.usfirst.frc4904.standard.subsystems.motor.TalonMotorSubsystem;

import edu.wpi.first.math.Pair;
Expand All @@ -16,9 +17,8 @@
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class ArmExtensionSubsystem extends SubsystemBase {
public class ArmExtensionSubsystem extends RequirementsSubsystemBase {

private final TalonMotorSubsystem motor;
private final static double SPOOL_DIAMETER = Units.inchesToMeters(0.75);
Expand All @@ -44,6 +44,7 @@ public class ArmExtensionSubsystem extends SubsystemBase {
* @param motor the motor controller used to extend the arm
*/
public ArmExtensionSubsystem(TalonMotorSubsystem motor, DoubleSupplier angleDegreesDealer) {
super(motor);
this.motor = motor;
this.feedforward = new ArmFeedforward(kS, kG, kV);
this.angleDealer = angleDegreesDealer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
import org.opencv.core.Mat.Tuple2;
import org.usfirst.frc4904.standard.custom.motioncontrollers.ezControl;
import org.usfirst.frc4904.standard.custom.motioncontrollers.ezMotion;
import org.usfirst.frc4904.standard.subsystems.RequirementsSubsystemBase;
import org.usfirst.frc4904.standard.subsystems.motor.TalonMotorSubsystem;
import org.usfirst.frc4904.standard.subsystems.motor.TelescopingArmPivotFeedForward;

import edu.wpi.first.math.Pair;
import edu.wpi.first.math.controller.ArmFeedforward;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class ArmPivotSubsystem extends SubsystemBase {
public class ArmPivotSubsystem extends RequirementsSubsystemBase {
public static final double INITIAL_ARM_ANGLE = -38;
public static final double GEARBOX_RATIO = 48; //48:1, 48 rotations of motor = 360 degrees
public static final double GEARBOX_SLACK_DEGREES = 6;
Expand All @@ -41,6 +40,7 @@ public class ArmPivotSubsystem extends SubsystemBase {
private final EncoderWithSlack slackyEncoder;

public ArmPivotSubsystem(TalonMotorSubsystem armMotorGroup, DoubleSupplier extensionDealer) {
super(armMotorGroup);
this.armMotorGroup = armMotorGroup;
this.extensionDealer = extensionDealer;
this.feedforward = new TelescopingArmPivotFeedForward(kG_retracted, kG_extended, kS, kV, kA);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package org.usfirst.frc4904.robot.subsystems.arm;

import org.usfirst.frc4904.standard.subsystems.RequirementsSubsystemBase;

import edu.wpi.first.math.Pair;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import edu.wpi.first.wpilibj2.command.WaitCommand;

public class ArmSubsystem extends SubsystemBase {
public class ArmSubsystem extends RequirementsSubsystemBase {
public final ArmPivotSubsystem armPivotSubsystem;
public final ArmExtensionSubsystem armExtensionSubsystem;

Expand All @@ -18,6 +19,7 @@ public class ArmSubsystem extends SubsystemBase {
public static final double MAX_ACCEL_PIVOT = 0;

public ArmSubsystem(ArmPivotSubsystem armPivotSubsystem, ArmExtensionSubsystem armExtensionSubsystem) {
super(armPivotSubsystem, armExtensionSubsystem);
this.armPivotSubsystem = armPivotSubsystem;
this.armExtensionSubsystem = armExtensionSubsystem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import java.util.function.DoubleSupplier;

import org.usfirst.frc4904.standard.subsystems.RequirementsSubsystemBase;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class EncoderWithSlack extends SubsystemBase { // just extends SubsystemBase so we can have a periodic
public class EncoderWithSlack extends RequirementsSubsystemBase { // just extends SubsystemBase so we can have a periodic
public final DoubleSupplier encoderRevsDealer;
public final double slackWindow;
public final double unitsPerRevolution;
Expand Down