![]() |
Question about Gear Sensor
I have tried to look for some guides about Gear tooth sensor, but what I`ve found doesn`t really help me.
Some stuff is ambiguous for me. What are the meanings of quadrature encoder`s states, what does each of them tell me about? What is Get_Encoder_1_Count() and Get_Encoder_2_Count() , and what`s the meaning of the number in the name of the function. -I use MPLAB Thank you in advance. |
Re: Question about Gear Sensor
Quote:
In Kevin Watson's FRC code the functions like Get_Encoder_1_Count() return the net number of pulses sent by the encoder plugged into the port as declared in the encoder.h file. The numbers are used to distinguish between encoders, I believe Kevin's code allows for 6 to be used at a time. The value returned by Get_Encoder_1_Count() can be converted into distance traveled since the encoder was last reset by multiplying the value by the ratio of encoder turns to wheel turns then by multiplying by the wheel circumference. |
Re: Question about Gear Sensor
Quote:
|
Re: Question about Gear Sensor
Quote:
|
Re: Question about Gear Sensor
Quote:
and where can I see exactly what the ports are in encoder.h? |
Re: Question about Gear Sensor
Quote:
|
Re: Question about Gear Sensor
For encoder 1 phase A goes to dig_in 1 phase b to dig_in 11
encoder 2 uses 2 and 12, 3 uses 3 and 13, ans so on. There is not more than one option, the encoder or gear tooth sensor just pulses once for every set fraction of a rotation, ie when ever the gear tooth sensor senses a gear tooth. This pulse triggers an interrupt in Kevin's code and that tallies the number of pulses, adding one for each forward pulse and subtracting one for each reverse pulse. This tally is returned by get_encoder_count. |
Re: Question about Gear Sensor
Quote:
Code:
from to direction |
Re: Question about Gear Sensor
Quote:
|
Re: Question about Gear Sensor
Quote:
|
Re: Question about Gear Sensor
Do as above, but note that the gear tooth sensors in the kit have only a single phase. This means that the encoder code will only count either up or down.
If you want direction information (i.e. a count that goes up when rotating one way, and down when rotating the other), you need to estimate it based on other factors (such as commanded motor direction, etc.). |
| All times are GMT -5. The time now is 01:00. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi