Skip to content

Chandana Aradhya Indexer PR - #2

Merged
chandaradhya merged 9 commits into
masterfrom
Indexer
Jun 23, 2026
Merged

Chandana Aradhya Indexer PR#2
chandaradhya merged 9 commits into
masterfrom
Indexer

Conversation

@chandaradhya

Copy link
Copy Markdown
Contributor

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

@chandaradhya
chandaradhya requested a review from a team June 19, 2026 23:38
Comment on lines +30 to +31
val STATOR_CURRENT_LIMIT = 0.amps
val SUPPLY_CURRENT_LIMIT = 0.amps

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make these 40


class Indexer(private val io: IndexerIO) : ControlledByStateMachine() {

companion object {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to put these at the bottom looks a bit cleaner


var targetVelocity = 0.0.rotations.perMinute
private set

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add an isAtTargetedVelo

Comment on lines +263 to +273
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>
) {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idt youll need current control here

private var floorAccelSignal: StatusSignal<WPIAngularAcceleration>
private var floorVelocitySignal: StatusSignal<WPIAngularVelocity>

private var feedWheelsStatorCurrentSignal: StatusSignal<Current>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use wpi annotation plz

configs.CurrentLimits.SupplyCurrentLimitEnable = true
configs.CurrentLimits.StatorCurrentLimitEnable = true
configs.MotorOutput.NeutralMode = NeutralModeValue.Coast
configs.MotorOutput.Inverted = InvertedValue.Clockwise_Positive

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 00magikarp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add units in ur log names

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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

…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 00magikarp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice structure good job

import org.team4099.lib.units.perSecond

object FeederConstants {
const val GEAR_RATIO: Double = 1.0 / 1.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cad

val STATOR_CURRENT_LIMIT = 40.0.amps
val SUPPLY_CURRENT_LIMIT = 40.0.amps

val VOLTAGE_COMPENSATION = 0.volts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

12


inputs.feederVelocity = feederSensor.velocity
inputs.feederAcceleration =
(feederAccelSignal.valueAsDouble / FeederConstants.GEAR_RATIO)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be * not /

var floorIndexerAppliedVoltage = 0.0.volts
var floorIndexerSupplyCurrent = 0.0.amps
var floorIndexerStatorCurrent = 0.0.amps
var floorIndexerTorqueCurrent = 0.0.amps

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove torquecurrents

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove stuff related to closedloop (velocity controllers, pid, ff)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@00magikarp 00magikarp Jun 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*

@00magikarp 00magikarp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls leave as seperate fractions


fun setVoltage(voltage: ElectricalPotential) {}

fun setVelocity(velocity: AngularVelocity) {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm

lowerBound = -FeederConstants.VOLTAGE_COMPENSATION,
upperBound = FeederConstants.VOLTAGE_COMPENSATION)
feederTalon.setControl(voltageOut.withOutput(clampedVoltage.inVolts))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement setbrakemode. see justins intake


fun setVoltage(voltage: ElectricalPotential) {}

fun setVelocity(velocity: AngularVelocity) {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm

…ity was removed from both and setBrakeMode was added to feeder.

@00magikarp 00magikarp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job i like this

@chandaradhya
chandaradhya merged commit 7dcc5d0 into master Jun 23, 2026
1 check passed
@00magikarp
00magikarp deleted the Indexer branch July 12, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants