Skip to content

Commit

Permalink
Feeder Constants and Subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
adorobantu2008 committed Jan 25, 2024
1 parent e0e2400 commit d0701ef
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 14 deletions.
22 changes: 22 additions & 0 deletions .run/Build & Deploy Robot for Debugging.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,26 @@
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Build &amp; Deploy Robot for Debugging" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-PdebugMode=true" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="deploy" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
30 changes: 26 additions & 4 deletions .run/Build & Deploy Robot.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Build &amp; Deploy Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -40,7 +40,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Build &amp; Deploy Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -62,7 +62,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Build &amp; Deploy Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -84,7 +84,29 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Build &amp; Deploy Robot" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="deploy" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
22 changes: 22 additions & 0 deletions .run/Build Robot.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,26 @@
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="build" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
23 changes: 23 additions & 0 deletions .run/Clean Build & Deploy Robot for Debugging.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,27 @@
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build &amp; Deploy Robot for Debugging" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-PdebugMode=true" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="clean" />
<option value="deploy" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
23 changes: 23 additions & 0 deletions .run/Clean Build & Deploy Robot.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,27 @@
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build &amp; Deploy Robot" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="clean" />
<option value="deploy" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
39 changes: 31 additions & 8 deletions .run/Clean Build Robot.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -42,7 +42,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -65,7 +65,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -88,7 +88,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -111,7 +111,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -134,7 +134,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -157,7 +157,7 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
Expand All @@ -180,7 +180,30 @@
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean Build Robot" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="clean" />
<option value="build" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
22 changes: 22 additions & 0 deletions .run/Clean.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,26 @@
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
<configuration default="false" name="Clean" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="clean" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id "java"
id "idea"
id "org.jetbrains.kotlin.jvm" version "1.8.20"
id "edu.wpi.first.GradleRIO" version "2024.1.1"
id "edu.wpi.first.GradleRIO" version "2024.2.1"
id "org.jlleitschuh.gradle.ktlint" version "11.6.1"
id "org.jetbrains.dokka" version "1.8.10"
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/frc/team449/RobotLoop.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import monologue.Monologue
import org.littletonrobotics.urcl.URCL
import kotlin.jvm.optionals.getOrNull

/** The main class of the robot, constructs all the subsystems and initializes default commands. */
/** The main class of the robot, constructs all the subsystems and initializes default commands . */
class RobotLoop : TimedRobot(), Logged {

@Log.NT
Expand All @@ -41,6 +41,7 @@ class RobotLoop : TimedRobot(), Logged {
private var routineMap = hashMapOf<String, Command>()
private val controllerBinder = ControllerBindings(robot.driveController, robot.mechController, robot)


override fun robotInit() {
// Yes this should be a print statement, it's useful to know that robotInit started.
println("Started robotInit.")
Expand Down
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 src/main/kotlin/frc/team449/robot2024/subsystems/Feeder.kt
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)
}
}
}

0 comments on commit d0701ef

Please sign in to comment.