Skip to content

Commit

Permalink
Completed FeederIO
Browse files Browse the repository at this point in the history
  • Loading branch information
lakelandspark committed Jan 21, 2024
1 parent 8ad5d8d commit f309b35
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.team4099.robot2023.subsystems.feeder

import com.team4099.robot2023.subsystems.superstructure.Request
import org.littletonrobotics.junction.LogTable
import org.littletonrobotics.junction.inputs.LoggableInputs
import org.team4099.lib.units.*
import org.team4099.lib.units.base.amps
import org.team4099.lib.units.base.celsius
import org.team4099.lib.units.base.inAmperes
import org.team4099.lib.units.base.inCelsius
import org.team4099.lib.units.derived.ElectricalPotential
import org.team4099.lib.units.derived.inVolts
import org.team4099.lib.units.derived.volts
import org.team4099.lib.units.derived.*

interface FeederIO {
class FeederIOInputs: LoggableInputs {
var feederVelocity = 0.0.rotations.perMinute
var feederAppliedVoltage = 0.0.volts
var feederStatorCurrent = 0.0.amps
var feederSupplyCurrent = 0.0.amps
Expand All @@ -20,13 +21,18 @@ interface FeederIO {
var isSimulated = false

override fun toLog(table: LogTable?) {
table?.put("feederVelocity", feederVelocity.inRadiansPerSecond)
table?.put("feederAppliedVoltage", feederAppliedVoltage.inVolts)
table?.put("feederStatorCurrent", feederStatorCurrent.inAmperes)
table?.put("feederSupplyCurrent", feederSupplyCurrent.inAmperes)
table?.put("feederTempCelcius", feederTemp.inCelsius)
}

override fun fromLog(table: LogTable?) {
table?.get("feederVelocity", feederVelocity.inRadiansPerSecond)?.let {
feederVelocity = it.radians.perSecond
}

table?.get("feederAppliedVoltage", feederAppliedVoltage.inVolts)?.let {
feederAppliedVoltage = it.volts
}
Expand All @@ -49,6 +55,12 @@ interface FeederIO {

fun setFeederVoltage(voltage: ElectricalPotential) {}

fun setFeederVelocity(velocity: AngularVelocity, feedforward: ElectricalPotential) {}

fun setFeederBrakeMode(brake: Boolean) {}

fun configPID(kP: ProportionalGain<Velocity<Radian>, Volt>, kI: IntegralGain<Velocity<Radian>, Volt>, kD: DerivativeGain<Velocity<Radian>, Volt>) {}

// fun setFloorVoltage(voltage: ElectricalPotential) {}

// fun setVerticalVoltage(voltage: ElectricalPotential) {}
Expand Down

0 comments on commit f309b35

Please sign in to comment.