Skip to content

non-monotonic time issue #1

Closed
Closed
@deniz195

Description

@deniz195

Hi martin,

i'm using a similar PID implementation on a raspberry pi in a production environement (PID code is also based Brett Beauregard's code at ).

Turns out that both time.time() and datetime.datetime.now() are non-monotonic time signals. I.e. if a system service or the user turns the time back, the PID will see negative time differences. This happens on many systems (in particular the raspberry pi) regularly which has given me rare, but quite erratic behavior of the machine.

Fixed the problem using time.monotonic() which is available since python 3.3. Maybe this is helpful to your code too.

Best,
Deniz

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions