-
Notifications
You must be signed in to change notification settings - Fork 0
Manipulator #1
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
Closed
Closed
Manipulator #1
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
44aea03
added intake motors
LoganCHS 1b57b48
added outtake motors with pid
LoganCHS c97015e
wip pid revisions/testing
DriverStationComputer 471b830
wip commands readded after bug deleted them
DriverStationComputer a1b6fe5
outtake finished, pid will need to be tuned
DriverStationComputer b7bfd6d
revisions and clean up, will at intake deployment soon
LoganCHS 0318a07
merging outtake an origin/outtake (?)
LoganCHS 97149f3
OUTTAKE_SPEED is now OUTTAKE_RPM in ShootBalls (wonder why this didnt…
LoganCHS 3a517fc
revisions
LoganCHS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
41 changes: 41 additions & 0 deletions
41
src/main/java/org/carlmontrobotics/commands/ManipulatorCommands/IntakeBalls.java
This file contains hidden or 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,41 @@ | ||
| // 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 org.carlmontrobotics.commands.ManipulatorCommands; | ||
|
|
||
| import edu.wpi.first.wpilibj2.command.Command; | ||
|
|
||
| import org.carlmontrobotics.subsystems.Intake; | ||
| import org.carlmontrobotics.Constants.IntakeC; | ||
|
|
||
| /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ | ||
| public class IntakeBalls extends Command { | ||
| Intake intake; | ||
| /** Creates a new IntakeBalls. */ | ||
| public IntakeBalls(Intake intake) { | ||
| addRequirements(this.intake = intake); | ||
| } | ||
|
|
||
| // Called when the command is initially scheduled. | ||
| @Override | ||
| public void initialize() { | ||
| intake.spinIntake(IntakeC.INTAKE_SPEED); | ||
| } | ||
|
|
||
| // Called every time the scheduler runs while the command is scheduled. | ||
| @Override | ||
| public void execute() {} | ||
|
|
||
| // Called once the command ends or is interrupted. | ||
| @Override | ||
| public void end(boolean interrupted) { | ||
| intake.spinIntake(0); | ||
| } | ||
|
|
||
| // Returns true when the command should end. | ||
| @Override | ||
| public boolean isFinished() { | ||
| return false; | ||
| } | ||
| } |
53 changes: 53 additions & 0 deletions
53
src/main/java/org/carlmontrobotics/commands/ManipulatorCommands/ShootBalls.java
This file contains hidden or 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,53 @@ | ||
| // 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 org.carlmontrobotics.commands.ManipulatorCommands; | ||
|
|
||
| import edu.wpi.first.wpilibj2.command.Command; | ||
| import edu.wpi.first.wpilibj.Timer; | ||
|
|
||
| import org.carlmontrobotics.subsystems.Outtake; | ||
|
|
||
| import org.carlmontrobotics.Constants.OuttakeC; | ||
|
|
||
| /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ | ||
| public class ShootBalls extends Command { | ||
| Outtake outtake; | ||
| Outtake feeder; | ||
| Timer timer = new Timer(); | ||
| /** Creates a new OuttakeBalls. */ | ||
| public ShootBalls(Outtake outtake, Outtake feeder) { | ||
| addRequirements(this.outtake = outtake); | ||
| addRequirements(this.feeder = feeder); | ||
| // Use addRequirements() here to declare subsystem dependencies. | ||
| } | ||
|
|
||
| // Called when the command is initially scheduled. | ||
| @Override | ||
| public void initialize() { | ||
| timer.start(); | ||
| feeder.spinFeeder(OuttakeC.FEEDER_SPEED); | ||
| } | ||
|
|
||
| // Called every time the scheduler runs while the command is scheduled. | ||
| @Override | ||
| public void execute() { | ||
| if(timer.get() > OuttakeC.DELAY){ | ||
| outtake.spinOuttake(OuttakeC.OUTTAKE_RPM); | ||
| } | ||
| } | ||
|
|
||
| // Called once the command ends or is interrupted. | ||
| @Override | ||
| public void end(boolean interrupted) { | ||
| outtake.outtake.set(0); | ||
| outtake.feeder.set(0); | ||
| } | ||
|
|
||
| // Returns true when the command should end. | ||
| @Override | ||
| public boolean isFinished() { | ||
| return false; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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,41 @@ | ||
| // 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 org.carlmontrobotics.subsystems; | ||
|
|
||
| import org.carlmontrobotics.lib199.MotorControllerFactory; | ||
|
|
||
| import org.carlmontrobotics.Constants.IntakeC; | ||
|
|
||
| import edu.wpi.first.wpilibj2.command.SubsystemBase; | ||
|
|
||
| import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
|
|
||
| import com.revrobotics.PersistMode; | ||
| import com.revrobotics.ResetMode; | ||
| import com.revrobotics.spark.SparkFlex; | ||
| import com.revrobotics.spark.config.SparkBaseConfig.IdleMode; | ||
| import com.revrobotics.spark.config.SparkFlexConfig; | ||
|
|
||
| public class Intake extends SubsystemBase { | ||
| SparkFlex intake; | ||
| /** Creates a new Intake. */ | ||
| public Intake() { | ||
| intake = MotorControllerFactory.createSparkFlex(IntakeC.INTAKE_ID); | ||
|
|
||
| final SparkFlexConfig intakeConfig = new SparkFlexConfig(); | ||
| intakeConfig.idleMode(IdleMode.kCoast); | ||
| intake.configure(intakeConfig, ResetMode.kNoResetSafeParameters, PersistMode.kPersistParameters); | ||
| } | ||
|
|
||
| public void spinIntake(double intakeSpeed) { | ||
| intake.set(intakeSpeed); | ||
| } | ||
|
|
||
| @Override | ||
| public void periodic() { | ||
| // This method will be called once per scheduler run | ||
| SmartDashboard.putNumber("Intake Speed", intake.get()); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.