Skip to content

Commit

Permalink
Fix simulationInit hack for getting the robot instance
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Jan 30, 2022
1 parent 8c245fe commit 3595f42
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyfrc/physics/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def _simulationInit(self):
if len(sig.parameters) == 2:
# which we don't have. So... we can't really change that at the moment,
# so let's do things that should never be done
robot = inspect.stack()[1].frame.f_locals["self"].robot
context = inspect.stack()[1].frame.f_locals["self"]
# If the user calls simulationInit then they're likely calling it from the robot
robot = getattr(context, "robot", context)

self.engine = PhysicsEngine(self, robot)

Expand Down

0 comments on commit 3595f42

Please sign in to comment.