Introducing: Button PID

I have been playing with this idea for a while, and was wondering what others thought.


float kPb = 1.0;
float kIb = 1.0;
float kDb =1.0;
float kLb = 50.0;

task buttonPID(){
	int error = 0;
	int pError = 0;
	int p = 0;
	int i = 0;
	int d = 0;

	while(true){
		error = targetValue - SensorValue[BTN1];
		
		p = error;
		i = abs(i + error]) < kLb ? i+ error : sgn(i + error)*kLb;
		d = error - pError;

		pError = error;
	}
       SensorValue[BTN1] = p*kPb + i*kIb + d*kDp;
}

THIS IS A JOKE

Interesting code, not exactly the “Accepted” way of doing things though. Your sig may get you kicked of the forums btw.

Thanks for the response, I figured that much, so I changed it.

It was funny (and the code still is), but not everyone shares my sense of humor.

Pegasus ? Thought you were with Chadwick. So we’re way off topic and will now end up in the “Chit Chat” forum.
https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/v/t1.0-1/p320x320/601572_454883904582070_1067998273_n.png?oh=259d099da124a6f2c46ede3209ca8587&oe=552F2F7B&gda=1430036794_8b4766124679074206c24810288e2c91

Yeah Harrison, I thought you went to Chadwick :stuck_out_tongue:

@jpearman I was just trying to find another school name to replace my previous :C

@cam The school of learning is the most real school ever!

what? we learn things at my school… :stuck_out_tongue: