88
99import hal
1010import hal .simulation
11- import networktables
11+ import ntcore
1212import wpilib
1313from wpilib .simulation import DriverStationSim , pauseTiming , restartTiming
1414import wpilib .simulation
@@ -87,7 +87,8 @@ def robot(self):
8787 # bubble up to the user
8888 #
8989
90- networktables .NetworkTables .startLocal ()
90+ nt_inst = ntcore .NetworkTableInstance .getDefault ()
91+ nt_inst .startLocal ()
9192
9293 pauseTiming ()
9394 restartTiming ()
@@ -107,6 +108,9 @@ def robot(self):
107108 if self ._physics :
108109 self ._physics .engine = None
109110
111+ # HACK: avoid motor safety deadlock
112+ wpilib .simulation ._simulation ._resetMotorSafety ()
113+
110114 del robot
111115
112116 # Double-check all objects are destroyed so that HAL handles are released
@@ -119,7 +123,7 @@ def robot(self):
119123 # -> some reset functions will re-register listeners, so it's important
120124 # to do this before so that the listeners are active on the current
121125 # NetworkTables instance
122- networktables . NetworkTables .stopLocal ()
126+ nt_inst .stopLocal ()
123127
124128 # Cleanup WPILib globals
125129 # -> preferences, SmartDashboard, LiveWindow, MotorSafety
@@ -133,7 +137,7 @@ def robot(self):
133137 hal .simulation .resetGlobalHandles ()
134138
135139 # Reset the HAL data
136- hal .simulation .resetAllData ()
140+ hal .simulation .resetAllSimData ()
137141
138142 # Don't call HAL shutdown! This is only used to cleanup HAL extensions,
139143 # and functions will only be called the first time (unless re-registered)
0 commit comments