File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,13 @@ def __init__(self, physics_module):
148148 self .log_init_errors = True
149149
150150 def _simulationInit (self , robot ):
151+
152+ # reset state first so that the PhysicsEngine constructor can use it
153+ self .field = wpilib .Field2d ()
154+ wpilib .SmartDashboard .putData ("Field" , self .field )
155+
156+ self .last_tm = None
157+
151158 # look for a class called PhysicsEngine
152159 try :
153160 PhysicsEngine = self .module .PhysicsEngine
@@ -171,12 +178,6 @@ def _simulationInit(self, robot):
171178 logger .exception ("Error creating user's PhysicsEngine object" )
172179 raise PhysicsInitException ()
173180
174- # reset state
175- self .field = wpilib .Field2d ()
176- wpilib .SmartDashboard .putData ("Field" , self .field )
177-
178- self .last_tm = None
179-
180181 def _simulationPeriodic (self ):
181182 now = wpilib .Timer .getFPGATimestamp ()
182183 last_tm = self .last_tm
You can’t perform that action at this time.
0 commit comments