diff --git a/magicbot/magiccomponent.py b/magicbot/magiccomponent.py index 8f6b958..35bbdef 100644 --- a/magicbot/magiccomponent.py +++ b/magicbot/magiccomponent.py @@ -49,7 +49,7 @@ def setup(self) -> None: def on_enable(self) -> None: """ - Called when the robot enters autonomous or teleoperated mode. This + Called when the robot enters autonomous, teleoperated or test mode mode. This function should initialize your component to a "safe" state so that unexpected things don't happen when enabling the robot. @@ -60,7 +60,7 @@ def on_enable(self) -> None: def on_disable(self) -> None: """ - Called when the robot leaves autonomous or teleoperated + Called when the robot enters disabled mode. """ def execute(self) -> None: diff --git a/magicbot/magicrobot.py b/magicbot/magicrobot.py index 85d1dd7..9db0ea8 100644 --- a/magicbot/magicrobot.py +++ b/magicbot/magicrobot.py @@ -413,8 +413,6 @@ def autonomous(self) -> None: watchdog=self.watchdog, ) - self._on_mode_disable_components() - def _disabled(self) -> None: """ This function is called in disabled mode. You should not @@ -513,8 +511,6 @@ def _operatorControl(self) -> None: delay.wait() watchdog.reset() - self._on_mode_disable_components() - def _test(self) -> None: """Called when the robot is in test mode""" watchdog = self.watchdog @@ -526,6 +522,9 @@ def _test(self) -> None: wpilib.LiveWindow.setEnabled(True) # Shuffleboard.enableActuatorWidgets() + # initialize things + self._on_mode_enable_components() + try: self.testInit() except: