mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 00:38:00 -06:00
Conventions
No functional change
This commit is contained in:
@@ -11,6 +11,7 @@ import com.revrobotics.CANSparkMax.SoftLimitDirection;
|
||||
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc4388.robot.Constants.ShooterConstants;
|
||||
import frc4388.robot.subsystems.Shooter;
|
||||
import frc4388.robot.subsystems.ShooterAim;
|
||||
|
||||
@@ -18,7 +19,9 @@ public class CalibrateShooter extends CommandBase {
|
||||
Shooter m_shooter;
|
||||
ShooterAim m_shooterAim;
|
||||
/**
|
||||
* Creates a new CalibrateShooter.
|
||||
* Calibrates the turret by moving the hood all the way down and moving the turret all the way right, then reseting the encoders
|
||||
* @param shootSub The Shooter subsystem
|
||||
* @param aimSub The ShooterAim subsystem
|
||||
*/
|
||||
public CalibrateShooter(Shooter shootSub, ShooterAim aimSub) {
|
||||
m_shooter = shootSub;
|
||||
@@ -37,12 +40,12 @@ public class CalibrateShooter extends CommandBase {
|
||||
m_shooter.m_angleAdjustMotor.enableSoftLimit(SoftLimitDirection.kForward, false);
|
||||
m_shooter.m_angleAdjustMotor.enableSoftLimit(SoftLimitDirection.kReverse, false);
|
||||
m_shooter.m_angleEncoder.setPosition(0);
|
||||
m_shooter.m_angleAdjustMotor.set(-0.1);
|
||||
m_shooter.m_angleAdjustMotor.set(-ShooterConstants.HOOD_CALIBRATE_SPEED);
|
||||
|
||||
m_shooterAim.m_shooterRotateMotor.enableSoftLimit(SoftLimitDirection.kForward, false);
|
||||
m_shooterAim.m_shooterRotateMotor.enableSoftLimit(SoftLimitDirection.kReverse, false);
|
||||
m_shooterAim.m_shooterRotateEncoder.setPosition(0);
|
||||
m_shooterAim.m_shooterRotateMotor.set(0.075);
|
||||
m_shooterAim.m_shooterRotateMotor.set(ShooterConstants.TURRET_CALIBRATE_SPEED);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
|
||||
@@ -40,6 +40,8 @@ public class HoldTarget extends CommandBase {
|
||||
|
||||
/**
|
||||
* Uses the Limelight to track the target
|
||||
* @param shooterSubsystem The Shooter subsystem
|
||||
* @param aimSubsystem The ShooterAim subsystem
|
||||
*/
|
||||
public HoldTarget(Shooter shooterSubsystem, ShooterAim aimSubsystem) {
|
||||
m_shooterAim = aimSubsystem;
|
||||
|
||||
@@ -9,6 +9,7 @@ package frc4388.robot.commands;
|
||||
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc4388.robot.Constants.ShooterConstants;
|
||||
import frc4388.robot.subsystems.Shooter;
|
||||
|
||||
public class HoodPositionPID extends CommandBase {
|
||||
@@ -30,7 +31,9 @@ public class HoodPositionPID extends CommandBase {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
firingAngle = (-0.47*m_shooter.addFireAngle())+40.5;
|
||||
double slope = ShooterConstants.HOOD_CONVERT_SLOPE;
|
||||
double b = ShooterConstants.HOOD_CONVERT_B;
|
||||
firingAngle = (-slope*m_shooter.addFireAngle())+b;
|
||||
SmartDashboard.putNumber("Shoot Angle From Equation", m_shooter.addFireAngle());
|
||||
SmartDashboard.putNumber("Fire Angle", firingAngle);
|
||||
m_shooter.runAngleAdjustPID(firingAngle);
|
||||
|
||||
@@ -18,7 +18,7 @@ import frc4388.robot.subsystems.Storage;
|
||||
// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
|
||||
public class ShootPrepGroup extends ParallelCommandGroup {
|
||||
/**
|
||||
* Preps the Shooter to be fired
|
||||
* Prepares the Shooter to be fired
|
||||
* @param m_shooter The Shooter subsytem
|
||||
* @param m_shooterAim The ShooterAim subsystem
|
||||
* @param m_storage The Storage subsytem
|
||||
|
||||
@@ -9,6 +9,7 @@ package frc4388.robot.commands;
|
||||
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc4388.robot.Constants.ShooterConstants;
|
||||
import frc4388.robot.subsystems.Shooter;
|
||||
|
||||
public class ShooterVelocityControlPID extends CommandBase {
|
||||
@@ -16,9 +17,8 @@ public class ShooterVelocityControlPID extends CommandBase {
|
||||
double m_targetVel;
|
||||
double m_actualVel;
|
||||
/**
|
||||
* Creates a new ShooterVelocityControlPID.
|
||||
* Runs the drum at a velocity
|
||||
* @param subsystem The Shooter subsytem
|
||||
* @param targetVel The target velocity
|
||||
*/
|
||||
public ShooterVelocityControlPID(Shooter subsystem) {
|
||||
m_shooter = subsystem;
|
||||
@@ -48,9 +48,9 @@ public class ShooterVelocityControlPID extends CommandBase {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
//Tells wether the target velocity has been reached
|
||||
double upperBound = m_targetVel + 300;
|
||||
double lowerBound = m_targetVel - 300;
|
||||
//Tells whether the target velocity has been reached
|
||||
double upperBound = m_targetVel + ShooterConstants.DRUM_VELOCITY_BOUND;
|
||||
double lowerBound = m_targetVel - ShooterConstants.DRUM_VELOCITY_BOUND;
|
||||
if (m_actualVel < upperBound && m_actualVel > lowerBound){
|
||||
SmartDashboard.putBoolean("ShooterVelocityPID Finished", true);
|
||||
return true;
|
||||
|
||||
@@ -18,7 +18,9 @@ public class StorageIntake extends CommandBase {
|
||||
public Storage m_storage;
|
||||
public boolean intook;
|
||||
/**
|
||||
* Creates a new storageIntake.
|
||||
* Runs the Storage in for intaking
|
||||
* @param inSub The Intake subsystem
|
||||
* @param storeSub The Storage subsytem
|
||||
*/
|
||||
public StorageIntake(Intake inSub, Storage storeSub) {
|
||||
m_intake = inSub;
|
||||
|
||||
@@ -14,7 +14,8 @@ import frc4388.robot.subsystems.Storage;
|
||||
public class StorageOutake extends CommandBase {
|
||||
Storage m_storage;
|
||||
/**
|
||||
* Creates a new storageOutake.
|
||||
* Runs the Storage out for outaking
|
||||
* @param storeSub The Storage subsystem
|
||||
*/
|
||||
public StorageOutake(Storage storeSub) {
|
||||
m_storage = storeSub;
|
||||
|
||||
@@ -15,7 +15,8 @@ public class StoragePositionPID extends CommandBase {
|
||||
public Storage m_storage;
|
||||
double startPos;
|
||||
/**
|
||||
* Creates a new StoragePositionPID.
|
||||
* Moves the storage a number of rotations
|
||||
* @param subsystem The Storage subsystem
|
||||
*/
|
||||
public StoragePositionPID(Storage subsystem) {
|
||||
m_storage = subsystem;
|
||||
|
||||
@@ -14,8 +14,10 @@ import frc4388.robot.subsystems.Storage;
|
||||
|
||||
public class StoragePrepAim extends CommandBase {
|
||||
Storage m_storage;
|
||||
double startTime;
|
||||
/**
|
||||
* Creates a new storagePrepAim.
|
||||
* Prepares the Storage for aiming
|
||||
* @param storeSub The Storage subsystem
|
||||
*/
|
||||
public StoragePrepAim(Storage storeSub) {
|
||||
m_storage = storeSub;
|
||||
@@ -25,6 +27,7 @@ public class StoragePrepAim extends CommandBase {
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@@ -46,7 +49,7 @@ public class StoragePrepAim extends CommandBase {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
if (!m_storage.getBeam(1)){
|
||||
if (!m_storage.getBeam(1) || startTime + StorageConstants.STORAGE_TIMEOUT <= System.currentTimeMillis()){
|
||||
SmartDashboard.putBoolean("StoragePrepAim Finished", true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@ public class StoragePrepIntake extends CommandBase {
|
||||
public double startTime;
|
||||
|
||||
/**
|
||||
* Creates a new StoragePrepIntake.
|
||||
* Prepares the Storage for intaking
|
||||
* @param inSub The Intake subsystem
|
||||
* @param storeSub the Storage subsystem
|
||||
*/
|
||||
public StoragePrepIntake(Intake inSub, Storage storeSub) {
|
||||
m_intake = inSub;
|
||||
@@ -52,7 +54,7 @@ public class StoragePrepIntake extends CommandBase {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
if (!m_storage.getBeam(0) || startTime + 2000 <= System.currentTimeMillis()){
|
||||
if (!m_storage.getBeam(0) || startTime + StorageConstants.STORAGE_TIMEOUT <= System.currentTimeMillis()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -29,7 +29,6 @@ public class StorageRun extends CommandBase {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
System.err.println("oiudhgisbjkljasbhfkofhdnsekdfjbsjfvsdkcfbsdjhfgvsdkjfbsd");
|
||||
m_storage.runStorage(StorageConstants.STORAGE_SPEED);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ public class TrackTarget extends CommandBase {
|
||||
|
||||
/**
|
||||
* Uses the Limelight to track the target
|
||||
* @param shooterSubsystem The Shooter subsystem
|
||||
* @param aimSubsystem The ShooterAim subsystem
|
||||
*/
|
||||
public TrackTarget(Shooter shooterSubsystem, ShooterAim aimSubsystem) {
|
||||
m_shooterAim = aimSubsystem;
|
||||
|
||||
@@ -23,7 +23,8 @@ public class TrimShooter extends CommandBase {
|
||||
|
||||
public Shooter m_shooter;
|
||||
/**
|
||||
* Creates a new TrimShooter.
|
||||
* Trims the shooter based on the D-Pad inputs
|
||||
* @param shootSub The Shooter subsytems
|
||||
*/
|
||||
public TrimShooter(Shooter shootSub) {
|
||||
m_shooter = shootSub;
|
||||
|
||||
Reference in New Issue
Block a user