|
A place to show off your knowledge of encoders
Lots of questions regarding encoders and how to interface them with WPILib but I'll try not to dump too many questions in here all at once. There are 4 types of encoders I have seen. I will name each encoder and give either what I think I understand and/or my questions for that sensor. Feel free to answer piecemeal, just quote the question your answering.
1. US Digital E4P
This one looks like it is only for use with the Andy Mark gear box. I've decided to forget about this one since I'm not using that gearbox in this application. Good?
2. Gear tooth sensor
This is the one that is pictured in the "C/C++ Programming Guide" for WPILib. This sensor only uses one digital input. I should use it with the GearTooth class. I can call the Get() and GetPeriod() methods from the Counter class it inherits from to get the count and rate respectively. I'm not sure if I can sense direction or not with this one. I was under the impression you need an A and B channel to sense direction. I see one comment in GearTooth.h that says "but in future versions we might implement the necessary timing in the FPGA to sense direction." But then I see a function named EnableDirectionSensing(). I'm leaning toward the comment being stale. If so then I should be able to call GetDirection() from the Counter class as well. Should this sensor only be used with gears that are in the FRC KOP due to the spacing/shape/number of teeth? Or will it generally work with any gear with ferrous teeth?
3. Magnetic rotary encoder
Does the WPILib support this one yet? In the "2011 FRC Sensor Manual" it says this sensor can be used in applications that typically used quadrature encoders. However the different interfaces it lists don't seem to match up with the Encoder class in WPILib. It talks about a serial interface which is staring to look like it would involve using the I2C class. It looks like this mode would take up 4 digital I/O slots on a digital module. I'm not sure what the address refers to in DigitalModule::GetI2C(UINT32 address). I see the device takes a 5-bit READ Angle command that would return 16-bits. How would this line up with the methods in the I2C class? Is the 5-bit command the registerAddress in I2C::Read(UINT8 registerAddress, UINT8 count, UINT8 *buffer)?
4. Linear Encoder with magnet strip
This one has the familiar A and B channel and seems like it would match up nicely with the encoder class. Is that magnet strip intended to only be laid out flat? Or can I wrap it around a shaft or sprocket that I am trying to measure the pulses on?
Thanks!
|