AdvantageKit icon indicating copy to clipboard operation
AdvantageKit copied to clipboard

Add Observable pattern to Network Inputs

Open reecelikesramen opened this issue 9 months ago • 0 comments

This PR draft extends the LoggedNetworkInputs ABC with an Observable pattern:

  • Modifies the concrete Network Input classes to implement the observable pattern
  • Uses weak references for listeners
  • Reads NT4 change queue to notify listeners in the periodic loop

This is a modification of an extension that my team is using this season (via a wrapper class):

  • My team is listening to the changes to Network Inputs during testing to tune gains
  • We don't want accidental changes (although unlikely) to affect practice or comp matches, so it's set to only notify listeners if the match type is None, otherwise just provides the default value.

Due to some limitations of my understanding of AKit, I don't know if the notifying of listeners only should happen in the NOT replay source case (see periodic of concrete classes) or in all cases.

I'm also not certain if extending the LoggedNetworkInputs ABC is ideal, I originally modified LoggedNetworkInputs, but was confused while conforming LoggedDashboardChooser so went this route instead.

I thought I'd offer this to AKit because I'm sure other teams may find this useful. Let me know if you have/request any changes or want some explanation of reasonings.

reecelikesramen avatar Mar 16 '25 00:03 reecelikesramen