-
Notifications
You must be signed in to change notification settings - Fork 3
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
e0e2400
commit d0701ef
Showing
11 changed files
with
241 additions
and
14 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 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 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
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/frc/team449/robot2024/constants/subsystem/FeederConstants.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,12 @@ | ||
package frc.team449.robot2024.constants.subsystem | ||
|
||
object FeederConstants { | ||
const val MOTOR_ID = 7 | ||
const val FOLLOLWER_ID = 55 | ||
const val FOLLOWER_INV = false | ||
const val INVERTED = true | ||
const val CURRENT_LIM = 15 | ||
|
||
const val INTAKE_VOLTAGE = 8.0 | ||
const val REVERSE_VOLTAGE = -5.0 | ||
} |
57 changes: 57 additions & 0 deletions
57
src/main/kotlin/frc/team449/robot2024/subsystems/Feeder.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,57 @@ | ||
package frc.team449.robot2024.subsystems | ||
|
||
import com.revrobotics.CANSparkMax | ||
import edu.wpi.first.util.sendable.SendableBuilder | ||
import edu.wpi.first.wpilibj2.command.Command | ||
import edu.wpi.first.wpilibj2.command.SubsystemBase | ||
import frc.team449.robot2024.constants.subsystem.FeederConstants | ||
import frc.team449.system.encoder.NEOEncoder | ||
import frc.team449.system.motor.WrappedMotor | ||
import frc.team449.system.motor.createSparkMax | ||
|
||
class Feeder( | ||
val motor: WrappedMotor | ||
) : SubsystemBase() { | ||
|
||
fun intake(): Command { | ||
return this.runOnce { | ||
motor.setVoltage(FeederConstants.INTAKE_VOLTAGE) | ||
motor.stopMotor(); | ||
} | ||
} | ||
|
||
fun outtake(): Command { | ||
return this.runOnce { | ||
motor.setVoltage(FeederConstants.REVERSE_VOLTAGE) | ||
} | ||
} | ||
|
||
fun stop(): Command { | ||
return this.runOnce { | ||
motor.stopMotor() | ||
} | ||
} | ||
|
||
override fun initSendable(builder: SendableBuilder) { | ||
builder.publishConstString("1.0", "Motor Voltages") | ||
builder.addDoubleProperty("1.1 Last Voltage", { motor.lastVoltage }, null) | ||
} | ||
|
||
companion object { | ||
fun createProtoUndertaker(): Feeder { | ||
val motor = createSparkMax( | ||
"ProtoUndertaker Motor", | ||
FeederConstants.MOTOR_ID, | ||
NEOEncoder.creator( | ||
1.0, | ||
1.0 | ||
), | ||
inverted = FeederConstants.INVERTED, | ||
currentLimit = FeederConstants.CURRENT_LIM, | ||
slaveSparks = mapOf(Pair(FeederConstants.FOLLOLWER_ID, FeederConstants.FOLLOWER_INV)) | ||
) | ||
|
||
return Feeder(motor) | ||
} | ||
} | ||
} |