Skip to content

Commit

Permalink
Finished IO File
Browse files Browse the repository at this point in the history
  • Loading branch information
SirBeans committed Jan 10, 2024
1 parent 21f0652 commit a1f5cc8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,67 @@
package com.team4099.robot2023.subsystems.Shooter

interface ShooterIO () {
import org.littletonrobotics.junction.LogTable
import org.littletonrobotics.junction.inputs.LoggableInputs
import org.team4099.lib.units.base.*
import org.team4099.lib.units.derived.*
import org.team4099.lib.units.inRadiansPerSecond
import org.team4099.lib.units.perMinute
import org.team4099.lib.units.perSecond

interface ShooterIO {
class ShooterIOInputs : LoggableInputs {
var rollerVelocity = 0.rotations.perMinute
var rollerAppliedVoltage = 0.volts
var rollerStatorCurrent = 0.amps
var rollerSupplyCurrent = 0.amps
var rollerTempreature = 0.celsius
}
fun toLog(table:LogTable){
table?.put("rollerVelocityRPM", rollerVelocity.inRadians.perSecond)
table?.put("rollerAppliedVoltage", rollerAppliedVoltage.inVolts)
table?.put("rollerStatorCurrent", rollerStatorCurrent.inamps)
table?.put("rollerVelocityRPM", rollerSupplyCurrent.inamps)
table?.put("rollerTempreature", rollerTempreature.celsisus)

}
fun fromLog(table:LogTable){
table?.getDouble("rollerVelocityRPM", rollerVelocityRPM.inRadiansPerSecond)?.let{
rollerVelocity = it.radians.perSecond
}
table?.getDouble("rollerAppliedVoltage", rollerAppliedVoltage.involts)?.let {
rollerAppliedVoltage = it.volts
override fun toLog(table: LogTable) {
table?.put("rollerVelocityRPM", rollerVelocity.inRadiansPerSecond)
table?.put("rollerAppliedVoltage", rollerAppliedVoltage.inVolts)
table?.put("rollerStatorCurrent", rollerStatorCurrent.inAmperes)
table?.put("rollerSupplyCurrent", rollerSupplyCurrent.inAmperes)
table?.put("rollerTempreature", rollerTempreature.inCelsius)

}
table?.getDouble("rollerStatorCurrent", rollerStatorCurrent.inRadiansPerSecond)?.let{

override fun fromLog(table: LogTable) {
table?.get("rollerVelocityRPM", rollerVelocity.inRadiansPerSecond)?.let {
rollerVelocity = it.radians.perSecond
}
table?.get("rollerAppliedVoltage", rollerAppliedVoltage.inVolts)?.let {
rollerAppliedVoltage = it.volts
}
table?.get("rollerStatorCurrent", rollerStatorCurrent.inAmperes)?.let {
rollerStatorCurrent = it.amps
}
table?.get("rollerSupplyCurrent", rollerSupplyCurrent.inAmperes)?.let {
rollerSupplyCurrent = it.amps

}

table?.get("rollerTempreature", rollerTempreature.inCelsius)?.let {
rollerTempreature = it.celsius
}


}
table?.getDouble("rollerVelocityRPM", rollerVelocityRPM.inRadiansPerSecond)
table?.getDouble("rollerVelocityRPM", rollerVelocityRPM.inRadiansPerSecond)
}

fun updateInputs(inputs: ShooterIOInputs)
fun setRollerPower (voltage: ElectricalPotential){

}
fun setRollerBrakeMode (brake: Boolean){

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

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.team4099.robot2023.subsystems.Shooter

class ShooterIONeo {
val
}

0 comments on commit a1f5cc8

Please sign in to comment.