Skip to content

Commit 0ae4f63

Browse files
committed
magicbot: Update SmartDashboard and LiveWindow in all modes
1 parent 418cce9 commit 0ae4f63

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

magicbot/magicrobot.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ def robotPeriodic(self):
162162
This function gets called last in each mode.
163163
You may use it for any code you need to run
164164
during all modes of the robot (e.g NetworkTables updates)
165+
166+
The default implementation will update SmartDashboard and LiveWindow.
165167
"""
166-
pass
168+
wpilib.SmartDashboard.updateValues()
169+
wpilib.LiveWindow.updateValues()
167170

168171
def onException(self, forceReport=False):
169172
'''
@@ -256,6 +259,7 @@ def autonomous(self):
256259

257260
self.__nt.putString('mode', 'auto')
258261
self.__nt.putBoolean('is_ds_attached', self.ds.isDSAttached())
262+
wpilib.LiveWindow.setEnabled(False)
259263

260264
self._on_mode_enable_components()
261265

@@ -277,6 +281,7 @@ def disabled(self):
277281

278282
self.__nt.putString('mode', 'disabled')
279283
ds_attached = None
284+
wpilib.LiveWindow.setEnabled(False)
280285

281286
delay = PreciseDelay(self.control_loop_wait_time)
282287

@@ -314,6 +319,7 @@ def operatorControl(self):
314319
# don't need to update this during teleop -- presumably will switch
315320
# modes when ds is no longer attached
316321
self.__nt.putBoolean('is_ds_attached', self.ds.isDSAttached())
322+
wpilib.LiveWindow.setEnabled(False)
317323

318324
delay = PreciseDelay(self.control_loop_wait_time)
319325

@@ -345,9 +351,9 @@ def test(self):
345351

346352
self.__nt.putString('mode', 'test')
347353
self.__nt.putBoolean('is_ds_attached', self.ds.isDSAttached())
354+
wpilib.LiveWindow.setEnabled(True)
348355

349356
while self.isTest() and self.isEnabled():
350-
wpilib.LiveWindow.run()
351357
self._update_feedback()
352358
self.robotPeriodic()
353359
wpilib.Timer.delay(self.control_loop_wait_time)

0 commit comments

Comments
 (0)