-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/redshiftrobotics/crescendo-…
- Loading branch information
Showing
11 changed files
with
220 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.arm.Arm; | ||
|
||
public class ArmRotateBy extends Command { | ||
|
||
private final Rotation2d dSetpoint; | ||
private final Arm arm; | ||
|
||
public ArmRotateBy(Arm arm, Rotation2d dRotation) { | ||
this.dSetpoint = dRotation; | ||
this.arm = arm; | ||
|
||
addRequirements(arm); | ||
} | ||
|
||
public ArmRotateBy(Arm arm, double dDegrees) { | ||
this(arm, Rotation2d.fromDegrees(dDegrees)); | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
arm.setSetpoint(arm.getArmPosition().plus(dSetpoint)); | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
// return arm.isAtDesiredPosition(); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package frc.robot.subsystems; | ||
|
||
import com.revrobotics.CANSparkLowLevel; | ||
import com.revrobotics.CANSparkMax; | ||
import edu.wpi.first.wpilibj.motorcontrol.Talon; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import frc.robot.Constants.IntakeShooterConstants; | ||
|
||
/** | ||
* The intake & shooter system (mounted to the end of the arm) | ||
* | ||
* Other proposed names for this class were: | ||
* The Relocator | ||
* Non-Linear Accelarator | ||
* I. C. E. | ||
* Throngler | ||
* | ||
* @author Aceius E. | ||
*/ | ||
public class IntakeShooter extends SubsystemBase { | ||
/* | ||
* 2 motors for flywheel | ||
* 2 for intake | ||
* neo550s, 2 sim motors, | ||
*/ | ||
|
||
private final Talon flywheel1; // AndyMark CIM, doublecheck this | ||
private final Talon flywheel2; | ||
private final CANSparkMax intake1; | ||
private final CANSparkMax intake2; // might not exist | ||
|
||
public IntakeShooter(int flywheel1id, int flywheel2id, int intake1id, int intake2id) { | ||
this.flywheel1 = new Talon(flywheel1id); | ||
this.flywheel2 = new Talon(flywheel2id); | ||
|
||
flywheel1.setInverted(IntakeShooterConstants.FLYWHEEL_REVERSE); | ||
flywheel1.setInverted(IntakeShooterConstants.FLYWHEEL_REVERSE); | ||
|
||
this.intake1 = new CANSparkMax(intake1id, CANSparkLowLevel.MotorType.kBrushless); | ||
this.intake2 = new CANSparkMax(intake2id, CANSparkLowLevel.MotorType.kBrushless); | ||
|
||
intake1.setInverted(IntakeShooterConstants.INTAKE_REVERSE); | ||
intake2.setInverted(IntakeShooterConstants.INTAKE_REVERSE); | ||
} | ||
|
||
public void startFlyWheels() { | ||
flywheel1.set(1); | ||
flywheel2.set(1); | ||
} | ||
|
||
public void stopFlywheels() { | ||
flywheel1.stopMotor(); | ||
flywheel2.stopMotor(); | ||
} | ||
|
||
public void intake() { | ||
intake1.set(1); | ||
intake1.set(1); | ||
} | ||
|
||
public void intakeReverse() { | ||
intake1.set(-1); | ||
intake1.set(-1); | ||
} | ||
|
||
public void stopIntake() { | ||
intake1.stopMotor(); | ||
intake1.stopMotor(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package frc.robot.subsystems.arm; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
import frc.robot.Constants.ArmConstants; | ||
|
||
/** | ||
* This interface represnets the arm. This interface is implemented by the | ||
* RealArm (formerly known as Arm) class. | ||
*/ | ||
public abstract class Arm extends SubsystemBase { | ||
|
||
public abstract void setSetpoint(double degrees); | ||
|
||
public void setSetpoint(Rotation2d rotation) { | ||
setSetpoint(rotation.getDegrees()); | ||
} | ||
|
||
public abstract boolean isAtDesiredPosition(); | ||
|
||
public abstract Rotation2d getArmPosition(); | ||
|
||
|
||
public void setArmToAmpPosition() { | ||
setSetpoint(ArmConstants.ARM_AMP_SHOOTING_DEGREES); | ||
} | ||
|
||
public void setArmToSpeakerPosition() { | ||
setSetpoint(ArmConstants.ARM_SPEAKER_SHOOTING_DEGREES); | ||
} | ||
|
||
public void setArmToIntakePosition() { | ||
setSetpoint(ArmConstants.ARM_INTAKE_DEGREES); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.