Moosetracks
Member
I have a analog laser distance sensor. It measures a pneumatic actuators position. I want to know when the actuator has stopped (its used as a clamp so I can't use a prox sensor because the position varies.
I have done this before using a timer. Each time the timer is done I compare the last value to current value and if the change is less than a set limit I call it stopped.
However sometimes the measurement update rates are not exact or the cylinder is moving a larger load and all the other real world variables get in the way. I am about to add a FIFO so I can look at several past measurements to get better performance, but I was curious how would you guys code this to decide when its actually stopped.
I have done this before using a timer. Each time the timer is done I compare the last value to current value and if the change is less than a set limit I call it stopped.
However sometimes the measurement update rates are not exact or the cylinder is moving a larger load and all the other real world variables get in the way. I am about to add a FIFO so I can look at several past measurements to get better performance, but I was curious how would you guys code this to decide when its actually stopped.