Closed AdrianVovk closed 4 years ago
I'm looking for a way to programmatically register classes into the FTCDashboard config system. Here's what I'm trying to do:
object TunerRegistrar { private fun OpModeManager.register(cls: KClass<out OpMode>) { this.register( OpModeMeta(cls.simpleName!!, OpModeMeta.Flavor.AUTONOMOUS, "Tuning"), cls.java) FtcDashboard.getInstance().configRoot.putVariable( ReflectionConfig.createVariableFromClass(cls.java)) } @JvmStatic @OpModeRegistrar fun registerTuners(mgr: OpModeManager) { if (DEBUG) { mgr.register(DumbWheelSpinner::class) mgr.register(WheelDirectionTester::class) mgr.register(TrackWidthTuner::class) mgr.register(DriveVelocityPIDTuner::class) mgr.register(FollowerPIDTuner::class) mgr.register(TurnTest::class) mgr.register(StraightTest::class) mgr.register(SplineTest::class) mgr.register(VisionTest::class) } } }
However, ReflectionConfig.createVariableFromClass is a private method. Could it be made public so that this could be possible?
ReflectionConfig.createVariableFromClass
Thank you!
I'm looking for a way to programmatically register classes into the FTCDashboard config system. Here's what I'm trying to do:
However,
ReflectionConfig.createVariableFromClass
is a private method. Could it be made public so that this could be possible?Thank you!