mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 08:48:01 -06:00
sdfghl
This commit is contained in:
@@ -25,10 +25,10 @@ public class ShootFireGroup extends ParallelRaceGroup {
|
||||
*/
|
||||
public ShootFireGroup(Shooter m_shooter, ShooterAim m_shooterAim, Storage m_storage) {
|
||||
addCommands(
|
||||
new RunCommand(() -> m_shooter.runDrumShooterVelocityPID(7000, m_shooter.m_shooterFalcon.getSelectedSensorVelocity())),
|
||||
new RunCommand(() -> m_shooter.runDrumShooterVelocityPID(m_shooter.addFireVel(), m_shooter.m_shooterFalcon.getSelectedSensorVelocity())),
|
||||
new RunCommand(() -> m_shooter.runAngleAdjustPID(m_shooter.addFireAngle())),
|
||||
new HoldTarget(m_shooter, m_shooterAim)
|
||||
//new StorageRun(m_storage)
|
||||
new HoldTarget(m_shooter, m_shooterAim),
|
||||
new StorageRun(m_storage)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ public class ShootPrepGroup extends ParallelCommandGroup {
|
||||
public ShootPrepGroup(Shooter m_shooter, ShooterAim m_shooterAim, Storage m_storage) {
|
||||
addCommands(
|
||||
new TrackTarget(m_shooter, m_shooterAim),
|
||||
new ShooterVelocityControlPID(m_shooter)
|
||||
//new StoragePrepAim(m_storage)
|
||||
new ShooterVelocityControlPID(m_shooter),
|
||||
new StoragePrepAim(m_storage)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ShooterVelocityControlPID extends CommandBase {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
m_shooter.runDrumShooterVelocityPID(7000, m_shooter.m_shooterFalcon.getSelectedSensorVelocity());
|
||||
m_shooter.runDrumShooterVelocityPID(m_shooter.addFireVel(), m_shooter.m_shooterFalcon.getSelectedSensorVelocity());
|
||||
m_shooter.runAngleAdjustPID(m_shooter.addFireAngle());
|
||||
}
|
||||
|
||||
|
||||
@@ -38,12 +38,11 @@ public class StorageIntake extends CommandBase {
|
||||
public void execute() {
|
||||
|
||||
if (m_storage.getBeam(0)){
|
||||
m_storage.setStoragePID(m_storage.getEncoderPos() + StorageConstants.STORAGE_PARTIAL_BALL);
|
||||
m_intake.runExtender(-IntakeConstants.EXTENDER_SPEED);
|
||||
m_storage.runStorage(StorageConstants.STORAGE_SPEED);
|
||||
intook = true;
|
||||
}
|
||||
else{
|
||||
m_intake.runExtender(IntakeConstants.EXTENDER_SPEED);
|
||||
m_storage.runStorage(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +54,7 @@ public class StorageIntake extends CommandBase {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
if (!m_storage.getBeam(0) && m_storage.getBeam(1) && intook){
|
||||
if (!m_storage.getBeam(0) && intook){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package frc4388.robot.commands;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc4388.robot.Constants.StorageConstants;
|
||||
import frc4388.robot.subsystems.Storage;
|
||||
|
||||
public class StorageIntakeFinal extends CommandBase {
|
||||
Storage m_storage;
|
||||
/**
|
||||
* Creates a new StorageIntakeFinal.
|
||||
*/
|
||||
public StorageIntakeFinal(Storage subsystem) {
|
||||
m_storage = subsystem;
|
||||
addRequirements(m_storage);
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if (m_storage.getBeam(1)){
|
||||
m_storage.setStoragePID(m_storage.getEncoderPos() + StorageConstants.STORAGE_FULL_BALL);
|
||||
}
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package frc4388.robot.commands;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
import frc4388.robot.subsystems.Intake;
|
||||
import frc4388.robot.subsystems.Storage;
|
||||
|
||||
// NOTE: Consider using this command inline, rather than writing a subclass. For more
|
||||
// information, see:
|
||||
// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
|
||||
public class StorageIntakeGroup extends SequentialCommandGroup {
|
||||
/**
|
||||
* Creates a new StorageIntakeGroup.
|
||||
*/
|
||||
public StorageIntakeGroup(Intake m_intake, Storage m_storage) {
|
||||
addCommands(
|
||||
new StoragePrepIntake(m_intake, m_storage),
|
||||
new StorageIntake(m_intake, m_storage),
|
||||
new StorageIntakeFinal(m_storage)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class StoragePrepAim extends CommandBase {
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
if (m_storage.getBeam(2) == false){
|
||||
if (m_storage.getBeam(1) == false){
|
||||
m_storage.runStorage(StorageConstants.STORAGE_SPEED);
|
||||
}
|
||||
else{
|
||||
@@ -45,7 +45,7 @@ public class StoragePrepAim extends CommandBase {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
if (m_storage.getBeam(2)){
|
||||
if (m_storage.getBeam(1)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -15,6 +15,7 @@ import frc4388.robot.subsystems.Storage;
|
||||
public class StoragePrepIntake extends CommandBase {
|
||||
public Intake m_intake;
|
||||
public Storage m_storage;
|
||||
public double startTime;
|
||||
|
||||
/**
|
||||
* Creates a new StoragePrepIntake.
|
||||
@@ -29,12 +30,13 @@ public class StoragePrepIntake 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.
|
||||
@Override
|
||||
public void execute() {
|
||||
if (m_storage.getBeam(1) == false){
|
||||
if (!m_storage.getBeam(0) && System.currentTimeMillis() < startTime + 3000){ //If the bottom beam is broken, or 3 seconds have passed
|
||||
m_storage.runStorage(-StorageConstants.STORAGE_SPEED);
|
||||
}
|
||||
else{
|
||||
@@ -50,7 +52,7 @@ public class StoragePrepIntake extends CommandBase {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
if (m_storage.getBeam(1)){
|
||||
if (m_storage.getBeam(0)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class TrackTarget extends CommandBase {
|
||||
} else if (turnAmount < 0 && turnAmount > -VisionConstants.MOTOR_DEAD_ZONE) {
|
||||
turnAmount = -VisionConstants.MOTOR_DEAD_ZONE;
|
||||
}
|
||||
m_shooterAim.runShooterWithInput(turnAmount / 3);
|
||||
m_shooterAim.runShooterWithInput(turnAmount);
|
||||
|
||||
// Finding Distance
|
||||
distance = VisionConstants.TARGET_HEIGHT / Math.tan((VisionConstants.LIME_ANGLE + yAngle) * (Math.PI / 180));
|
||||
|
||||
Reference in New Issue
Block a user