-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ede5af
commit 4865e59
Showing
3 changed files
with
160 additions
and
24 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
35 changes: 35 additions & 0 deletions
35
src/main/java/frc/robot/commands/autonomous/AutoNoteShoot.java
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 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands.autonomous; | ||
|
||
import java.util.function.DoubleSupplier; | ||
|
||
import edu.wpi.first.wpilibj2.command.InstantCommand; | ||
import edu.wpi.first.wpilibj2.command.RunCommand; | ||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; | ||
import edu.wpi.first.wpilibj2.command.WaitCommand; | ||
import frc.robot.commands.Shooter.ShooterSetDegree; | ||
import frc.robot.subsystems.FeederSubsystem; | ||
import frc.robot.subsystems.ShooterSubsystem; | ||
|
||
// NOTE: Consider using this command inline, rather than writing a subclass. For more | ||
// information, see: | ||
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html | ||
public class AutoNoteShoot extends SequentialCommandGroup { | ||
/** Creates a new AutoNoteShoot. */ | ||
public AutoNoteShoot(ShooterSubsystem m_shooter, FeederSubsystem m_feeder, DoubleSupplier degree) { | ||
// Add your commands in the addCommands() call, e.g. | ||
// addCommands(new FooCommand(), new BarCommand()); | ||
addCommands( | ||
new ShooterSetDegree(m_shooter, degree). | ||
withTimeout(1). | ||
alongWith(new InstantCommand(() -> m_shooter.ShooterThrowMotorOutput(-0.6)) | ||
.andThen(new WaitCommand(0.6)) | ||
.andThen(new InstantCommand(() -> m_feeder.backward()).withTimeout(0.5))) | ||
.andThen(new InstantCommand(() -> m_shooter.ShooterThrowMotorOutput(0)) | ||
.andThen(new InstantCommand(() -> m_feeder.stop()))) | ||
); | ||
} | ||
} |
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,56 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.subsystems; | ||
|
||
import com.revrobotics.CANSparkMax; | ||
import com.revrobotics.CANSparkBase.IdleMode; | ||
import com.revrobotics.CANSparkLowLevel.MotorType; | ||
|
||
import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
||
public class ArmSubsystem extends SubsystemBase { | ||
CANSparkMax armleft = new CANSparkMax(16, MotorType.kBrushless); | ||
CANSparkMax armright = new CANSparkMax(13, MotorType.kBrushless); | ||
|
||
public ArmSubsystem() { | ||
armleft.setIdleMode(IdleMode.kBrake); | ||
armright.setIdleMode(IdleMode.kBrake); | ||
|
||
} | ||
|
||
|
||
public void rightarmup(){ | ||
armright.set(0.6); | ||
} | ||
|
||
public void rightarmdown(){ | ||
armright.set(-0.6); | ||
|
||
} | ||
|
||
public void leftarmup(){ | ||
armleft.set(-0.6); | ||
|
||
} | ||
|
||
public void leftarmdown(){ | ||
armleft.set(0.6); | ||
|
||
} | ||
public void leftarmstop(){ | ||
armleft.set(0); | ||
|
||
} | ||
public void rightarmstop(){ | ||
armright.set(0); | ||
|
||
} | ||
|
||
|
||
@Override | ||
public void periodic() { | ||
// This method will be called once per scheduler run | ||
} | ||
} |