Chandana Aradhya Indexer PR - #2
Conversation
| val STATOR_CURRENT_LIMIT = 0.amps | ||
| val SUPPLY_CURRENT_LIMIT = 0.amps |
|
|
||
| class Indexer(private val io: IndexerIO) : ControlledByStateMachine() { | ||
|
|
||
| companion object { |
There was a problem hiding this comment.
try to put these at the bottom looks a bit cleaner
|
|
||
| var targetVelocity = 0.0.rotations.perMinute | ||
| private set | ||
|
|
| fun configurePIDCurrent( | ||
| kP: ProportionalGain<Fraction<Radian, Second>, Ampere>, | ||
| kI: IntegralGain<Fraction<Radian, Second>, Ampere>, | ||
| kD: DerivativeGain<Fraction<Radian, Second>, Ampere> | ||
| ) {} | ||
|
|
||
| fun configureFFCurrent( | ||
| kS: StaticFeedforward<Ampere>, | ||
| kV: VelocityFeedforward<Radian, Ampere>, | ||
| kA: AccelerationFeedforward<Radian, Ampere> | ||
| ) {} |
There was a problem hiding this comment.
idt youll need current control here
| private var floorAccelSignal: StatusSignal<WPIAngularAcceleration> | ||
| private var floorVelocitySignal: StatusSignal<WPIAngularVelocity> | ||
|
|
||
| private var feedWheelsStatorCurrentSignal: StatusSignal<Current> |
| configs.CurrentLimits.SupplyCurrentLimitEnable = true | ||
| configs.CurrentLimits.StatorCurrentLimitEnable = true | ||
| configs.MotorOutput.NeutralMode = NeutralModeValue.Coast | ||
| configs.MotorOutput.Inverted = InvertedValue.Clockwise_Positive |
There was a problem hiding this comment.
i havent looked at cad but u may not want this to be the case for all of them esp if they drive the same thing
00magikarp
left a comment
There was a problem hiding this comment.
i like whats generally going on here. big comment tho: i don't think u want velocity control for this. first of all ur using one subsystem to control many motor groups, each with their own mechanical configurations so its kinda weird for them to all run one velocity. secondly velocity control isnt rly necessary esp for rollers teams like this. ik this is a big change but its lowk a lot of deleting stuff instead of adding stuff so i think it should be fine no? i can help u with this if u need. this also means getting rid of pids and ffs and target velocities and that stuff.
| CustomLogger.recordOutput("Indexer/currentRequest", currentRequest.javaClass.simpleName) | ||
|
|
||
| CustomLogger.recordOutput("Indexer/targetVoltage", targetVoltage.inVolts) | ||
| CustomLogger.recordOutput("Indexer/targetVelocity", targetVelocity.inRotationsPerMinute) |
| private val topBeltTalon: TalonFX = TalonFX(Constants.Indexer.TOP_BELT_INDEXER_MOTOR_ID) | ||
| private val bottomBeltTalon: TalonFX = TalonFX(Constants.Indexer.BOTTOM_BELT_INDEXER_MOTOR_ID) | ||
|
|
||
| private val configs: TalonFXConfiguration = TalonFXConfiguration() |
There was a problem hiding this comment.
to build off what ryan said in comment below, each of these sets of motors should probably have their own configs. for example, u may want diff current limits from ur floor rollers to ur tunnel belts. make diff configs for each one
| voltage, | ||
| lowerBound = -IndexerConstants.VOLTAGE_COMPENSATION, | ||
| upperBound = IndexerConstants.VOLTAGE_COMPENSATION) | ||
| floorTalon.setControl(voltageOut.withOutput(clampedVoltage.inVolts)) |
There was a problem hiding this comment.
this can be simplified by just calling voltageOut.withOutput(clampedVoltage.inVolts) once before the first setControl and then using voltageOut from there on, since .with...() methods also replace the value its changing in-place
…from the indexer subystem.
…ttings of the belts, floor rollers, and side roller. As a result, all indexer files were also updated to account for the different settings.
00magikarp
left a comment
There was a problem hiding this comment.
very nice structure good job
| import org.team4099.lib.units.perSecond | ||
|
|
||
| object FeederConstants { | ||
| const val GEAR_RATIO: Double = 1.0 / 1.0 |
| val STATOR_CURRENT_LIMIT = 40.0.amps | ||
| val SUPPLY_CURRENT_LIMIT = 40.0.amps | ||
|
|
||
| val VOLTAGE_COMPENSATION = 0.volts |
|
|
||
| inputs.feederVelocity = feederSensor.velocity | ||
| inputs.feederAcceleration = | ||
| (feederAccelSignal.valueAsDouble / FeederConstants.GEAR_RATIO) |
| var floorIndexerAppliedVoltage = 0.0.volts | ||
| var floorIndexerSupplyCurrent = 0.0.amps | ||
| var floorIndexerStatorCurrent = 0.0.amps | ||
| var floorIndexerTorqueCurrent = 0.0.amps |
There was a problem hiding this comment.
remove stuff related to closedloop (velocity controllers, pid, ff)
There was a problem hiding this comment.
remove stuff related to closedloop (velocity controllers, pid, ff)
| private val topBeltTalon: TalonFX = TalonFX(Constants.Indexer.TOP_BELT_INDEXER_MOTOR_ID) | ||
| private val bottomBeltTalon: TalonFX = TalonFX(Constants.Indexer.BOTTOM_BELT_INDEXER_MOTOR_ID) | ||
|
|
||
| private val slot0Configs: TalonFXConfiguration = TalonFXConfiguration() |
There was a problem hiding this comment.
i wrote this big paragraph abt why u shouldnt change slots for different motors and then realized that u called them slot configs but in reality theyre just configs lol. slot config refers to the configs for the "slot", which controlls the PID/FF gain constants. rename these to just floorConfig, sideRollerConfig, beltConfig pls
|
|
||
| inputs.floorIndexerVelocity = floorIndexerSensor.velocity | ||
| inputs.floorIndexerAcceleration = | ||
| (floorAccelSignal.valueAsDouble / IndexerConstants.FloorConstants.GEAR_RATIO) |
…s and configs were updated.
00magikarp
left a comment
There was a problem hiding this comment.
make the gear ratios driving / driven (so a small gear on the motor means that the ratio is < 1). dont simplify gear ratios. add mois.
| import org.team4099.lib.units.perSecond | ||
|
|
||
| object FeederConstants { | ||
| const val GEAR_RATIO: Double = 14.0 / 9.0 |
There was a problem hiding this comment.
leave this as 18.0 / 28.0, dont simplify. also in our codebase reductions are < 1 (driving over driven)
|
|
||
| object IndexerConstants { | ||
| object FloorConstants { | ||
| const val TOP_GEAR_RATIO: Double = 435.0 / 112.0 |
There was a problem hiding this comment.
pls leave as seperate fractions
|
|
||
| fun setVoltage(voltage: ElectricalPotential) {} | ||
|
|
||
| fun setVelocity(velocity: AngularVelocity) {} |
| lowerBound = -FeederConstants.VOLTAGE_COMPENSATION, | ||
| upperBound = FeederConstants.VOLTAGE_COMPENSATION) | ||
| feederTalon.setControl(voltageOut.withOutput(clampedVoltage.inVolts)) | ||
| } |
There was a problem hiding this comment.
implement setbrakemode. see justins intake
|
|
||
| fun setVoltage(voltage: ElectricalPotential) {} | ||
|
|
||
| fun setVelocity(velocity: AngularVelocity) {} |
…ity was removed from both and setBrakeMode was added to feeder.
Finished making the indexer subsystem files
Subsystem consists of two kraken 60 and three kraken 44 motors
Subsystem controls a series of thin black rollers, green wheels leading to the turret, a side roller, and a top and bottom belt towards the turret in the back