Skip to content

Commit cdba7b4

Browse files
author
Shaunak Kumar
committed
hoopin while they all at prom
1 parent d679b0c commit cdba7b4

6 files changed

Lines changed: 20 additions & 35 deletions

File tree

src/main/kotlin/com/team4099/lib/math/MathUtil.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package com.team4099.lib.math
22

33
import org.team4099.lib.units.UnitKey
44
import org.team4099.lib.units.Value
5-
import org.team4099.lib.units.base.Ampere
6-
import org.team4099.lib.units.base.Current
75

86
fun <T : UnitKey> clamp(input: Value<T>, lowerBound: Value<T>, upperBound: Value<T>): Value<T> {
97
return maxOf(lowerBound, minOf(input, upperBound))

src/main/kotlin/com/team4099/robot2026/config/constants/HopperConstants.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import org.team4099.lib.units.kilo
99
object HopperConstants {
1010
const val GEAR_RATIO: Double = 1.0 / 27.0
1111

12-
val STATOR_CURRENT_LIMIT = 20.amps
13-
val SUPPLY_CURRENT_LIMIT = 20.amps
12+
val STATOR_CURRENT_LIMIT = 60.amps
13+
val SUPPLY_CURRENT_LIMIT = 60.amps
1414

1515
val VOLTAGE_COMPENSATION = 12.volts
1616

src/main/kotlin/com/team4099/robot2026/subsystems/superstructure/hopper/Hopper.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.team4099.robot2026.subsystems.superstructure.hopper
22

33
import com.team4099.robot2026.config.constants.HopperConstants
4-
import com.team4099.robot2026.subsystems.superstructure.hopper.HopperIO
54
import com.team4099.robot2026.subsystems.superstructure.Request.HopperRequest
65
import com.team4099.robot2026.util.ControlledByStateMachine
76
import com.team4099.robot2026.util.CustomLogger

src/main/kotlin/com/team4099/robot2026/subsystems/superstructure/hopper/HopperIO.kt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,38 @@ import org.team4099.lib.units.base.amps
66
import org.team4099.lib.units.base.celsius
77
import org.team4099.lib.units.base.inAmperes
88
import org.team4099.lib.units.base.inCelsius
9-
import org.team4099.lib.units.derived.*
10-
import org.team4099.lib.units.inDegreesPerSecond
11-
import org.team4099.lib.units.inDegreesPerSecondPerSecond
9+
import org.team4099.lib.units.derived.ElectricalPotential
10+
import org.team4099.lib.units.derived.inVolts
11+
import org.team4099.lib.units.derived.rotations
12+
import org.team4099.lib.units.derived.volts
13+
import org.team4099.lib.units.inRotationsPerMinute
1214
import org.team4099.lib.units.perMinute
13-
import org.team4099.lib.units.perSecond
1415

1516
interface HopperIO {
1617
class HopperIOInputs : LoggableInputs {
1718
// Hopper Inputs
18-
var hopperAngularVelocity = 0.0.degrees.perSecond
19-
var hopperAngularAcceleration = 0.0.rotations.perMinute.perMinute
19+
var hopperAngularVelocity = 0.0.rotations.perMinute
20+
var hopperAngularAcceleration = 0.0.rotations.perMinute
2021
var hopperAppliedVoltage = 0.0.volts
2122
var hopperStatorCurrent = 0.0.amps
2223
var hopperSupplyCurrent = 0.0.amps
2324
var hopperTemp = 0.0.celsius
2425

2526
override fun toLog(table: LogTable) {
26-
table.put("hopperVelocityPerSecond", hopperAngularVelocity.inDegreesPerSecond)
27-
table.put("hopperAccelerationDPSPS", hopperAngularAcceleration.inDegreesPerSecondPerSecond)
27+
table.put("hopperVelocityRPM", hopperAngularVelocity.inRotationsPerMinute)
28+
table.put("hopperAccelerationRPM", hopperAngularAcceleration.inRotationsPerMinute)
2829
table.put("hopperAppliedVoltage", hopperAppliedVoltage.inVolts)
2930
table.put("hopperStatorCurrent", hopperStatorCurrent.inAmperes)
3031
table.put("hopperSupplyCurrent", hopperSupplyCurrent.inAmperes)
3132
table.put("hopperTemp", hopperTemp.inCelsius)
3233
}
3334

3435
override fun fromLog(table: LogTable) {
35-
table.get("hopperDPS", hopperAngularVelocity.inDegreesPerSecond).let {
36-
hopperAngularVelocity = it.degrees.perSecond
37-
}
38-
table.get("hopperAcceleration", hopperAngularAcceleration.inDegreesPerSecondPerSecond).let {
39-
hopperAngularAcceleration = it.degrees.perSecond.perSecond
36+
table
37+
.get("HopperVelocityRotationsPerMinuite", hopperAngularVelocity.inRotationsPerMinute)
38+
.let { hopperAngularVelocity = it.rotations.perMinute }
39+
table.get("hopperAcceleration", hopperAngularAcceleration.inRotationsPerMinute).let {
40+
hopperAngularAcceleration = it.rotations.perMinute
4041
}
4142
table.get("hopperAppliedVoltage", hopperAppliedVoltage.inVolts).let {
4243
hopperAppliedVoltage = it.volts

src/main/kotlin/com/team4099/robot2026/subsystems/superstructure/hopper/HopperIOSim.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,12 @@ import org.team4099.lib.math.clamp
99
import org.team4099.lib.units.base.amps
1010
import org.team4099.lib.units.base.celsius
1111
import org.team4099.lib.units.base.inSeconds
12-
import org.team4099.lib.units.derived.DegreesPerSecondPerDegreesPerSecond
1312
import org.team4099.lib.units.derived.ElectricalPotential
1413
import org.team4099.lib.units.derived.inKilogramsMeterSquared
1514
import org.team4099.lib.units.derived.inVolts
16-
import org.team4099.lib.units.derived.radians
1715
import org.team4099.lib.units.derived.rotations
1816
import org.team4099.lib.units.derived.volts
19-
import org.team4099.lib.units.perSecond
20-
import org.team4099.lib.units.inRotationsPerMinute
21-
import org.team4099.lib.units.inRotationsPerMinutePerMinute
2217
import org.team4099.lib.units.perMinute
23-
import org.team4099.lib.units.derived.rotations
24-
import org.team4099.lib.units.derived.degrees
2518

2619
object HopperIOSim : HopperIO {
2720
private var appliedVoltage = 0.0.volts
@@ -39,7 +32,7 @@ object HopperIOSim : HopperIO {
3932
hopperSim.update(Constants.Universal.LOOP_PERIOD_TIME.inSeconds)
4033

4134
inputs.hopperAngularVelocity = hopperSim.angularVelocityRadPerSec.rotations.perMinute
42-
inputs.hopperAngularAcceleration = hopperSim.angularAccelerationRadPerSecSq.radians.perSecond.perSecond
35+
inputs.hopperAngularAcceleration = hopperSim.angularAccelerationRadPerSecSq.rotations.perMinute
4336
inputs.hopperAppliedVoltage = appliedVoltage
4437
inputs.hopperSupplyCurrent = 0.0.amps
4538
inputs.hopperStatorCurrent = hopperSim.currentDrawAmps.amps

src/main/kotlin/com/team4099/robot2026/subsystems/superstructure/hopper/HopperIOTalon.kt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.team4099.lib.units.derived.ElectricalPotential
2121
import org.team4099.lib.units.derived.inVolts
2222
import org.team4099.lib.units.derived.rotations
2323
import org.team4099.lib.units.derived.volts
24-
import org.team4099.lib.units.perSecond
24+
import org.team4099.lib.units.perMinute
2525

2626
object HopperIOTalon : HopperIO {
2727

@@ -35,7 +35,6 @@ object HopperIOTalon : HopperIO {
3535
var statorCurrentSignal: StatusSignal<Current>
3636
var supplyCurrentSignal: StatusSignal<Voltage>
3737
var tempSignal: StatusSignal<WPITemp>
38-
var dutyCycleSignal: StatusSignal<Double>
3938
var motorVoltageSignal: StatusSignal<Voltage>
4039
var motorAccelSignal: StatusSignal<WPIAngularAcceleration>
4140
var rotorVelocitySignal: StatusSignal<WPIAngularVelocity>
@@ -55,7 +54,6 @@ object HopperIOTalon : HopperIO {
5554
statorCurrentSignal = hopperTalon.supplyCurrent
5655
supplyCurrentSignal = hopperTalon.supplyVoltage
5756
tempSignal = hopperTalon.deviceTemp
58-
dutyCycleSignal = hopperTalon.dutyCycle
5957
motorVoltageSignal = hopperTalon.motorVoltage
6058
motorAccelSignal = hopperTalon.acceleration
6159
}
@@ -65,7 +63,6 @@ object HopperIOTalon : HopperIO {
6563
statorCurrentSignal,
6664
supplyCurrentSignal,
6765
tempSignal,
68-
dutyCycleSignal,
6966
motorVoltageSignal,
7067
motorAccelSignal,
7168
rotorVelocitySignal)
@@ -79,11 +76,8 @@ object HopperIOTalon : HopperIO {
7976
inputs.hopperTemp = tempSignal.valueAsDouble.celsius
8077
inputs.hopperAngularVelocity = hopperSensor.velocity
8178
inputs.hopperAngularAcceleration =
82-
(motorAccelSignal.valueAsDouble / HopperConstants.GEAR_RATIO)
83-
.rotations
84-
.perSecond
85-
.perSecond
86-
(motorAccelSignal.valueAsDouble / HopperConstants.GEAR_RATIO).rotations.perSecond.perSecond
79+
(motorAccelSignal.valueAsDouble / HopperConstants.GEAR_RATIO).rotations.perMinute
80+
(motorAccelSignal.valueAsDouble / HopperConstants.GEAR_RATIO).rotations.perMinute.perMinute
8781
}
8882

8983
override fun setVoltage(voltage: ElectricalPotential) {

0 commit comments

Comments
 (0)