Skip to content

Commit

Permalink
Added Feeder IO File
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingMaster121 committed Jan 10, 2024
1 parent b3917e9 commit 9f55d22
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ dependencies {

implementation 'org.jetbrains.kotlin:kotlin-test-junit5'
implementation 'com.github.team4099:FalconUtils:1.1.26'
implementation 'org.apache.commons:commons-collections4:4.0'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'com.google.code.gson:gson:2.10.1'
implementation "io.javalin:javalin:5.3.2"
implementation 'io.javalin:javalin:5.4.2'

// We need to add the Kotlin stdlib in order to use most Kotlin language features.
// compile "org.jetbrains.kotlin:kotlin-stdlib"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.team4099.robot2023.subsystems.feeder

import org.littletonrobotics.junction.LogTable
import org.littletonrobotics.junction.inputs.LoggableInputs
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

interface FeederIO {
class FeederIOInputs: LoggableInputs {
var floorAppliedVoltage = 0.0.volts
var floorStatorCurrent = 0.0.amps
var floorSupplyCurrent = 0.0.amps
var floorTemp = 0.0.celsius
var verticalAppliedVoltage = 0.0.volts
var verticalStatorCurrent = 0.0.amps
var verticalSupplyCurrent = 0.0.amps
var verticalTemp = 0.0.celsius

var isSimulated = false

override fun toLog(table: LogTable?) {
table?.put("floorAppliedVoltage", floorAppliedVoltage.inVolts)
table?.put("floorStatorCurrent", floorStatorCurrent.inAmperes)
table?.put("floorSupplyCurrent", floorSupplyCurrent.inAmperes)
table?.put("floorTempCelcius", floorTemp.inCelsius)
table?.put("verticalAppliedVoltage", verticalAppliedVoltage.inVolts)
table?.put("verticalStatorCurrent", verticalStatorCurrent.inAmperes)
table?.put("verticalSupplyCurrent", verticalSupplyCurrent.inAmperes)
table?.put("verticalTempCelcius", verticalTemp.inCelsius)
}

override fun fromLog(table: LogTable?) {
table?.getDouble("floorAppliedVoltage", floorAppliedVoltage.inVolts)?.let {
floorAppliedVoltage = it.volts
}
table?.getDouble("floorStatorCurrent", floorStatorCurrent.inAmperes)?.let {
floorStatorCurrent = it.amps
}
table?.getDouble("floorSupplyCurrent", floorSupplyCurrent.inAmperes)?.let {
floorSupplyCurrent = it.amps
}
table?.getDouble("floorTempCelcius", floorTemp.inCelsius)?.let { floorTemp = it.celsius }
table?.getDouble("verticalAppliedVoltage", verticalAppliedVoltage.inVolts)?.let {
verticalAppliedVoltage = it.volts
}
table?.getDouble("verticalStatorCurrent", verticalStatorCurrent.inAmperes)?.let {
verticalStatorCurrent = it.amps
}
table?.getDouble("verticalSupplyCurrent", verticalSupplyCurrent.inAmperes)?.let {
verticalSupplyCurrent = it.amps
}
table?.getDouble("verticalTempCelcius", verticalTemp.inCelsius)?.let { verticalTemp = it.celsius }
}

fun updateInputs(inputs: FeederIOInputs) {}

fun setFloorVoltage(voltage: ElectricalPotential) {}

fun setVerticalVoltage(voltage: ElectricalPotential) {}
}
}

0 comments on commit 9f55d22

Please sign in to comment.