def update(self, v_d, v_m, dt):

        # check if need reset
        if v_d != self.last_var_desired:
            self.reset()
            self.last_var_desired = v_d
        
        # calculate error
        error = v_d - v_m
        
        # calculate response
        p = self.gain_p * error
            
        self.integrated_error += error * dt
        i = self.gain_i * self.integrated_error

        d_error = (error - self.last_error) / dt
        d = self.gain_d * d_error
        self.last_error = error
        
        response = p + i + d
                
        # apply eg deadband, saturation
        if self.dead_zone:
            dz = self.dead_zone
            if abs(response) < dz:
                return 0.0

        if self.max_response:
            max_r = self.max_response
            if abs(response) > max_r:
                return math.copysign(max_r, response)

        # return response
        return response
Computes the texture stretch metric from
dataset/ETHPy150Open FishPi/FishPi-POCV---Command---Control/fishpi/control/navigation.py/BasicPIDControl.update--crossover with--dataset/ETHPy150Open pycollada/meshtool/meshtool/filters/simplify_filters/sander_simplify.py/stretch_metric