capsuleguy
Member
I have a single turn encoder controlling my motion project. It is controlling the speed of an elastic web. I have a sensor looking at marks on the web that triggers and captures the current encoder position. The encoder is configured to rollover so the capture will be between 1 and 262244 counts.
The sensor is triggered again and captures the encoder position approximately one revolution later. I subtract the second capture from the first and determine a position error that is used to change the servo ratio. It all works great unless the two captures are when the encoder rolls over.
For instance working correctly with a 20 count error: capture 1= 242240 and capture 2= 242260. Then 242240-242260=-20 error.
But if capture 1=262140 (then encoder rolls over)and capture 2= 16 then 262140-16= 262124 error when it should be -20 as well.
What is the best way for me to deal with this rollover situation?
The sensor is triggered again and captures the encoder position approximately one revolution later. I subtract the second capture from the first and determine a position error that is used to change the servo ratio. It all works great unless the two captures are when the encoder rolls over.
For instance working correctly with a 20 count error: capture 1= 242240 and capture 2= 242260. Then 242240-242260=-20 error.
But if capture 1=262140 (then encoder rolls over)and capture 2= 16 then 262140-16= 262124 error when it should be -20 as well.
What is the best way for me to deal with this rollover situation?