>In the code yall defined your filter as:
>
>sensor1filt = sensor1filt + ((256 + sensor1 - sensor1filt KFilt/200) - (256KFilt/200)
>
>What is KFilt?
KFilt is a constant that must be chosen experimentally to give you the behavior you want. Its range will necessarily be between 0 and 200 because if KFilt is 0, the filtered sensor value will never change, and if it’s 200, the effect is of no filter at all. (If it were to be more than 200, your filtered value would fluctuate wildly whenever the sensor reading changed.)
To understand this, simplify
sensor1filt = sensor1filt + ((256 + sensor1 - sensor1filt)*KFilt/200) - (256*KFilt/200)
and you get
sensor1filt = sensor1filt + ((sensor1 - sensor1filt)*KFilt/200)
(The reason for the extra terms is to avoid dividing a negative number – a well known problem on the BASIC Stamp.) What we see from this simplification is that each time through the loop, a percentage of the difference between the current sensor reading and the previous filtered value is added to the previous filtered value to give you a new filtered value. The effect of this is to “smooth out” the input from the sensor. (That is the purpose of this type of filter.) In my experience, you will probably want to set KFilt to somewhere between 20 and 120 (10-60% filtering).
What is Yaw rate?
Yaw rate is the rate at which a body turns about a vertical axis. In other words, how fast something is turning to the left or right. This is actually different than what we were measuring for the bridge balancing problem we had to tackle this past year. To solve this problem, we had to turn the gyro sensor so that we were measuring the robot’s pitch rate (the rate at which the nose of the robot pitched up and down.) I guess the yaw rate sensor is commonly called that because that is the application for which it is used in the automotive industry.
In the code it says…
k = 1 to 85…k = 1 to 50…k = 1 to 75
…what do this #'s mean and why are they used?
These are timing loops. For example,
for k = 1 to 75
Serout USERCPU, OUTBAUD, ...]
next
simply executes the Serout command 75 times. I believe the TechnoKats had to figure out by trial and error how many times to repeat each loop in order to balance the bridge.
>sensor1filt var ???
Since sensor1 is a byte variable, sensor1filt needs to be at least byte sized.
Hope it helps.