File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -152,11 +152,23 @@ def disabledPeriodic(self):
152
152
self .logger .warning ("Default MagicRobot.disabledPeriodic() method... Overload me!" )
153
153
func .firstRun = False
154
154
155
+ def testInit (self ):
156
+ """Initialization code for test mode should go here.
157
+
158
+ Users should override this method for initialization code which will be
159
+ called each time the robot enters disabled mode.
160
+ """
161
+ pass
162
+
163
+ def testPeriodic (self ):
164
+ """Periodic code for test mode should go here."""
165
+ pass
166
+
155
167
def robotPeriodic (self ):
156
168
"""
157
169
Periodic code for all modes should go here.
158
170
159
- ` Users must override this method to utilize it
171
+ Users must override this method to utilize it
160
172
but it is not required.
161
173
162
174
This function gets called last in each mode.
@@ -352,8 +364,18 @@ def test(self):
352
364
self .__nt .putString ('mode' , 'test' )
353
365
self .__nt .putBoolean ('is_ds_attached' , self .ds .isDSAttached ())
354
366
wpilib .LiveWindow .setEnabled (True )
367
+
368
+ try :
369
+ self .testInit ()
370
+ except :
371
+ self .onException (forceReport = True )
355
372
356
373
while self .isTest () and self .isEnabled ():
374
+ try :
375
+ self .testPeriodic ()
376
+ except :
377
+ self .onException ()
378
+
357
379
self ._update_feedback ()
358
380
self .robotPeriodic ()
359
381
wpilib .Timer .delay (self .control_loop_wait_time )
You can’t perform that action at this time.
0 commit comments