A PID service allows the tracking and transformation of output in relation to iinput. This is currently used as one of the tracking strategies in the Tracking service. Input is sent to PID, a "compute" method is sent and appropriate output is sent to a servo.
References
Example code (from branch develop):
#########################################
# Pid.py
# categories: pid
# more info @: http://myrobotlab.org/service/Pid
#########################################
import time
import random
pid = runtime.start("test", "Pid")
pid.setPid("pan", 1.0, 0.1, 0.0)
pid.setSetpoint("pan", 320)
pid.setPid("tilt", 1.0, 0.1, 0.0)
pid.setSetpoint("tilt", 240)
for i in range(0,200):
i = random.randint(200,440)
pid.compute("pan", i)
i = random.randint(200,440)
pid.compute("tilt", i)
time.sleep(0.1)
Example configuration (from branch develop):
!!org.myrobotlab.service.config.PidConfig
data: {
}
listeners: null
peers: null
type: Pid
test [[service/PID.py]]
test [[service/PID.py]]