You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you store your RobotContainer and subsystems as Kotlin objects (singletons), AutoLogOutputManager will not pick up on them because they are not stored as fields.
funregisterFieldsForAutoLogOutput(root:Any) {
val method =AutoLogOutputManager::class.java.getDeclaredMethod("registerFields", Object::class.java)
method.isAccessible =true
method.invoke(null, root)
}
// ... in robotInit ...
registerFieldsForAutoLogOutput(RobotContainer)
// ... in RobotContainer ...
registerFieldsForAutoLogOutput(Drive)
The text was updated successfully, but these errors were encountered:
amsam0
changed the title
AutoLogOutput doesn't work with Kotlin objects
AutoLogOutput doesn't work with Kotlin objects when they are not stored as fields
Mar 15, 2024
jwbonner
changed the title
AutoLogOutput doesn't work with Kotlin objects when they are not stored as fields
Add support/workaround for using AutoLogOutput with Kotlin singletons
Nov 1, 2024
If you store your RobotContainer and subsystems as Kotlin objects (singletons), AutoLogOutputManager will not pick up on them because they are not stored as fields.
Seeing as though finding all Kotlin objects using reflection is not feasible, it would be great to be able to call the
registerFields
method of AutoLogOutputManager manually to avoid storing objects as fields.For now, we can do it via reflection:
The text was updated successfully, but these errors were encountered: