Have a look at the example given in: examples/controller/pid_with_simulator.py
examples/controller/pid_with_simulator.py