Runs operations and returns values specific to the encoder count. More...
Public Member Functions | |
def | __init__ (self, tim, pin1, pin2) |
Initiates encoder operations using approprate timers and pins. More... | |
def | update (self) |
Updates the encoder count and corrects for overflow. More... | |
def | getPosition (self) |
Gives the last stored position of the encoder arm. More... | |
def | setPosition (self, reset_value) |
Sets the encoder count to a desired value. More... | |
def | getDelta (self) |
Returns the change between the last two counts in update. More... | |
Public Attributes | |
AngList | |
DatumCnt | |
Initial value that will be used to measure a change in count. | |
DeltaCnt | |
Establishes the change in count. More... | |
theta | |
tim | |
The timer from which the encoder counts. | |
pin1 | |
One of two pins needed for collecting data on motor ops. | |
timCh1 | |
One of two channels needed for the encoder operation. | |
pin2 | |
One of two pins needed for collecting data on motor ops. | |
timCh2 | |
One of two channels needed for the encoder operation. | |
newCnt | |
A count value that will be updated each time update is called. More... | |
Runs operations and returns values specific to the encoder count.
Class for updating, getting, setting, and computing the change in the encoder count.
def ME405_FP_Encoder.ME405_FP_Encoder.__init__ | ( | self, | |
tim, | |||
pin1, | |||
pin2 | |||
) |
Initiates encoder operations using approprate timers and pins.
The encoder architecture requires two channels from which the timer reads in order to determine directional differences
def ME405_FP_Encoder.ME405_FP_Encoder.getDelta | ( | self | ) |
Returns the change between the last two counts in update.
def ME405_FP_Encoder.ME405_FP_Encoder.getPosition | ( | self | ) |
Gives the last stored position of the encoder arm.
def ME405_FP_Encoder.ME405_FP_Encoder.setPosition | ( | self, | |
reset_value | |||
) |
Sets the encoder count to a desired value.
reset_value; | The position one wishes to set the encoder to |
def ME405_FP_Encoder.ME405_FP_Encoder.update | ( | self | ) |
Updates the encoder count and corrects for overflow.
ME405_FP_Encoder.ME405_FP_Encoder.DeltaCnt |
Establishes the change in count.
The change in count represents the change in the location of the motor arm between sample periods. This change in count conveys direction and velocity data. The count can only go so high before an overflow condtion occurs, meaning we have to correct the overflow in order to get a continuous representation of the motor;s motion.
ME405_FP_Encoder.ME405_FP_Encoder.newCnt |
A count value that will be updated each time update is called.
A change in value for newCnt, or for that matter any value based on timer counts, will only occur if the arm of the motor is rotated, because the rotation of the motor arm is what brings about the change in pulses of the encoder, which is interpreted by the timer attached to the encoder channel and returns a change in count to reflect the change in the motor arm position