FRC2706 / 2019-2706-Robot-Code

The main robot code for the FIRST 2019 challenge: Deep Space
MIT License
2 stars 0 forks source link

Config requires initialization in order for FluidConstants to be accessed #30

Closed Zinka010 closed 5 years ago

ryanlarkin commented 5 years ago

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 of Config. One possibility would be to either have robotInit 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.

KyleRAnderson commented 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.

ryanlarkin commented 5 years ago

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.

KyleRAnderson commented 5 years ago

Ready for testing. Will also need to speak to @Zinka010 to see if this is what the intended behaviour was.