-
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.
refactor and instantiate intake class
- Loading branch information
Showing
21 changed files
with
206 additions
and
101 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
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/main/kotlin/frc/team449/subsystems/intake/IntakeConstants.kt
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
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
2 changes: 1 addition & 1 deletion
2
.../subsystems/elevator/ElevatorConstants.kt → ...erstructure/elevator/ElevatorConstants.kt
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
4 changes: 2 additions & 2 deletions
4
...ubsystems/elevator/ElevatorFeedForward.kt → ...structure/elevator/ElevatorFeedForward.kt
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
2 changes: 1 addition & 1 deletion
2
...eam449/subsystems/elevator/ElevatorSim.kt → ...ms/superstructure/elevator/ElevatorSim.kt
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
2 changes: 1 addition & 1 deletion
2
.../subsystems/elevator/TiltedElevatorSim.kt → ...erstructure/elevator/TiltedElevatorSim.kt
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
72 changes: 72 additions & 0 deletions
72
src/main/kotlin/frc/team449/subsystems/superstructure/intake/Intake.kt
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,72 @@ | ||
package frc.team449.subsystems.superstructure.intake | ||
|
||
import com.ctre.phoenix6.hardware.TalonFX | ||
import edu.wpi.first.units.Units.Seconds | ||
import edu.wpi.first.wpilibj2.command.Command | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase | ||
import frc.team449.system.motor.createKraken | ||
|
||
// TODO(the entire class bru) | ||
class Intake( | ||
private val frontMotor: TalonFX, | ||
private val backMotor: TalonFX | ||
) : SubsystemBase() { | ||
|
||
fun intakeCoral(): Command { | ||
return runOnce { | ||
frontMotor.setVoltage(IntakeConstants.CORAL_INTAKE_VOLTAGE) | ||
backMotor.setVoltage(-IntakeConstants.CORAL_INTAKE_VOLTAGE) | ||
} | ||
} | ||
|
||
fun outtakeCoral(): Command { | ||
return runOnce { | ||
frontMotor.setVoltage(IntakeConstants.CORAL_OUTTAKE_VOLTAGE) | ||
backMotor.setVoltage(-IntakeConstants.CORAL_OUTTAKE_VOLTAGE) | ||
} | ||
} | ||
|
||
fun intakeAlgae(): Command { | ||
return runOnce { | ||
frontMotor.setVoltage(-IntakeConstants.ALGAE_INTAKE_VOLTAGE) | ||
backMotor.setVoltage(IntakeConstants.ALGAE_INTAKE_VOLTAGE) | ||
} | ||
} | ||
|
||
fun outtakeAlgae(): Command { | ||
return runOnce { | ||
frontMotor.setVoltage(-IntakeConstants.ALGAE_OUTTAKE_VOLTAGE) | ||
backMotor.setVoltage(IntakeConstants.ALGAE_OUTTAKE_VOLTAGE) | ||
} | ||
} | ||
|
||
fun stop(): Command { | ||
return runOnce { | ||
frontMotor.stopMotor() | ||
backMotor.stopMotor() | ||
} | ||
} | ||
|
||
companion object { | ||
fun createIntake(): Intake { | ||
val frontMotor = createKraken( | ||
id = IntakeConstants.FRONT_MOTOR_ID, | ||
inverted = IntakeConstants.FRONT_MOTOR_INVERTED, | ||
statorCurrentLimit = IntakeConstants.STATOR_LIMIT, | ||
burstCurrentLimit = IntakeConstants.SUPPLY_LIMIT, | ||
burstTimeLimit = Seconds.of(0.0), | ||
updateFrequency = IntakeConstants.VALUE_UPDATE_FREQ | ||
) | ||
|
||
val backMotor = createKraken( | ||
id = IntakeConstants.BACK_MOTOR_ID, | ||
inverted = IntakeConstants.BACK_MOTOR_INVERTED, | ||
statorCurrentLimit = IntakeConstants.STATOR_LIMIT, | ||
burstCurrentLimit = IntakeConstants.SUPPLY_LIMIT, | ||
burstTimeLimit = Seconds.of(0.0), | ||
updateFrequency = IntakeConstants.VALUE_UPDATE_FREQ | ||
) | ||
return Intake(frontMotor, backMotor) | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/frc/team449/subsystems/superstructure/intake/IntakeConstants.kt
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,22 @@ | ||
package frc.team449.subsystems.superstructure.intake | ||
|
||
import edu.wpi.first.units.Units.Amps | ||
import edu.wpi.first.units.Units.Hertz | ||
|
||
object IntakeConstants { | ||
const val FRONT_MOTOR_ID = 10 // TODO(Change motor ID.) | ||
const val BACK_MOTOR_ID = 11 // TODO(Change motor ID.) | ||
|
||
val STATOR_LIMIT = Amps.of(60.0) | ||
val SUPPLY_LIMIT = Amps.of(30.0) | ||
|
||
val VALUE_UPDATE_FREQ = Hertz.of(10.0) | ||
|
||
const val FRONT_MOTOR_INVERTED = false | ||
const val BACK_MOTOR_INVERTED = true | ||
|
||
const val CORAL_INTAKE_VOLTAGE = 3.0 | ||
const val CORAL_OUTTAKE_VOLTAGE = -2.0 | ||
const val ALGAE_INTAKE_VOLTAGE = 7.0 | ||
const val ALGAE_OUTTAKE_VOLTAGE = -10.0 | ||
} |
2 changes: 1 addition & 1 deletion
2
...eam449/subsystems/pivot/LengthPivotSim.kt → ...ms/superstructure/pivot/LengthPivotSim.kt
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
2 changes: 1 addition & 1 deletion
2
...lin/frc/team449/subsystems/pivot/Pivot.kt → .../subsystems/superstructure/pivot/Pivot.kt
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
2 changes: 1 addition & 1 deletion
2
...eam449/subsystems/pivot/PivotConstants.kt → ...ms/superstructure/pivot/PivotConstants.kt
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
6 changes: 3 additions & 3 deletions
6
...m449/subsystems/pivot/PivotFeedForward.kt → .../superstructure/pivot/PivotFeedForward.kt
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.
8a46426
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also added k-means clustering to find the low section of the abs enc wobble for rev quad encoder calibration instead of just looking up the 90th percentile data point.