Bot'n Roll ONE A+ - Raspberry Pi 5 library
 
Loading...
Searching...
No Matches
onepi.utils.pid_controller.PidController Class Reference

Public Member Functions

 __init__ (self, pid_params=PidParams(), min_value=-100, max_value=100)
 
 set_pid_params (self, pid_params)
 
 get_pid_params (self)
 
 get_setpoint (self)
 
 change_setpoint (self, setpoint)
 
 compute_output (self, input_value)
 
 reset_controller (self)
 

Static Protected Attributes

int _min_value = -100
 
int _max_value = 100
 
 _pid = PidParams()
 
int _setpoint = 0
 
bool _change_sign = False
 
int _last_error = 0
 
int _output = 0
 
int _integral = 0
 

Detailed Description

Construct a new PID controller object
kp proportional gain
ki integral gain
kd derivative gain

Constructor & Destructor Documentation

◆ __init__()

onepi.utils.pid_controller.PidController.__init__ ( self,
pid_params = PidParams(),
min_value = -100,
max_value = 100 )
construtor

Member Function Documentation

◆ change_setpoint()

onepi.utils.pid_controller.PidController.change_setpoint ( self,
setpoint )
Change the setpoint or reference value.
This is the value the PID controller is trying to reach.
setpoint: reference value

◆ compute_output()

onepi.utils.pid_controller.PidController.compute_output ( self,
input_value )
Computes the output command by applying the PID control algorithm
input_value: current input value
return: float output command value

◆ get_pid_params()

onepi.utils.pid_controller.PidController.get_pid_params ( self)
returns pid params

◆ get_setpoint()

onepi.utils.pid_controller.PidController.get_setpoint ( self)
returns the setpoint

◆ reset_controller()

onepi.utils.pid_controller.PidController.reset_controller ( self)
resets the gains

◆ set_pid_params()

onepi.utils.pid_controller.PidController.set_pid_params ( self,
pid_params )
updates pid params

The documentation for this class was generated from the following file: