Closed Zinka010 closed 5 years ago
If I'm understanding this right, you're saying that the FluidConstant outside of the Config.java
class aren't being initialized? I don't think we want to define FluidConstants outside of the Config
class.
I agree that they should all be made in Config
, but I think that they should still work even if they're made in another class or defined after the robot is initialized.
Ready for testing. Will also need to speak to @Zinka010 to see if this is what the intended behaviour was.
Just to explain what was happening: We found that the FluidConstants that were created weren't making NetworkTables entries.
All FluidConstants create a callback to add the NT entry when the robot code is initialized, but since the
Config
class hasn't been referenced yet, the callback only gets registered after the robot has initialized. As a result the callback is never activated.Calling
Config.initialize()
was a good workaround, but it wouldn't fix the problem for a FluidConstant outside ofConfig
. One possibility would be to either haverobotInit
callbacks activate immediatly if the robot has already initialized. Another way is to use a callback to create the NT entry only if the robot hasn't been initialized already, and just create the entry without a callback otherwise.