In 3 pi robot ,they use discharge time of a capacitor to detect white and black surfaces. But is there a big difference between 3pi sensor outputs & digital sensor outputs when we are working with pure black & White surface (because in 3 pi sensor panel , white surface gives very high discharge time and black surface gives very low discharge time).
I did the experiment yo mentioned & observed the value of weighted sum using serial monitor. the value was changed in in consistent steps as u mentioned. Can you please explain little bit about the use of exponential filter to smooth it out?
I found a code of fast line follwing robot & they have used a sensor array of 8 for the line following.
First the sensor values (digital) were saved in to an array & weighted sum was calculated.
sum = 1*Sensors+2*Sensors+4*Sensors+8*Sensors+16*Sensors+32*Sensors+64*Sensors+128*Sensors
then the error was calculated as follows
double error =((sum&0b10000000)/128)*4+((sum&0b01000000)/64)*3+((sum&0b00100000)/32)*2+((sum&0b00010000)/16)*1+((sum&0b00001000)/8)*(-1)+((sum&0b00000100)/4)*(-2)+((sum&0b00000010)/2)*(-3)+((sum&0b00000001)/1)*(-4);
error = error*1.0/Count;
I do not clearly understand what is done in the highlighted section. What is the meaning of taking bit wise and operation between sum and those binary numbers?
thanks a lot