robotpy / robotpy-wpilib

Moved to https://github.com/robotpy/mostrobotpy
https://robotpy.github.io
Other
170 stars 60 forks source link

Design physics/simulation support #666

Closed virtuald closed 4 years ago

virtuald commented 4 years ago

Now that we have https://github.com/wpilibsuite/allwpilib/pull/2377 ... this provides a convenient mechanism to hook in our physics.py support. I like having it as a separate file that automatically gets loaded in simulation.

I'm thinking that we hide those two methods from users, and call something internal instead... but then I was thinking maybe I try to detect if the user overrode them, and if not go back to our old physics.py stuff? Or we just make users use simulationInit/simulationPeriodic manually.

One flaw that I hadn't thought through is that simulationPeriodic doesn't provide the elapsed time, which is needed for physics computations.

auscompgeek commented 4 years ago

One flaw that I hadn't thought through is that simulationPeriodic doesn't provide the elapsed time, which is needed for physics computations.

That's not too bad. We can call hal.getFPGATime.

virtuald commented 4 years ago

Implemented in https://github.com/robotpy/pyfrc/pull/170