mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
library/pid.py change millis to ticks_ms
change pyb.millis to time.tick_ms, for supporting imx.rt
This commit is contained in:
parent
dbe5187558
commit
e763300b8b
@ -8,7 +8,7 @@ while(True):
|
|||||||
#control value with output
|
#control value with output
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pyb import millis
|
from time import ticks_ms
|
||||||
from math import pi, isnan
|
from math import pi, isnan
|
||||||
|
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class PID:
|
|||||||
self._last_derivative = float("nan")
|
self._last_derivative = float("nan")
|
||||||
|
|
||||||
def get_pid(self, error, scaler):
|
def get_pid(self, error, scaler):
|
||||||
tnow = millis()
|
tnow = ticks_ms()
|
||||||
dt = tnow - self._last_t
|
dt = tnow - self._last_t
|
||||||
output = 0
|
output = 0
|
||||||
if self._last_t == 0 or dt > 1000:
|
if self._last_t == 0 or dt > 1000:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user