Changes between Version 9 and Version 10 of ControlSystems/SoftwareTeam/Training/GettingStarted/Encoders
- Timestamp:
- Oct 31, 2019, 1:08:41 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/Training/GettingStarted/Encoders
v9 v10 4 4 An encoder is a device attached to the motor or wheel shaft that generates a pulse with each partial rotation (e.g. every 1-degree or 5-degrees of rotation, another pulse is generated). By counting these pulses, we can tell how fast the wheel is turning or what position it is in. We can use this information to do things like make a robot travel a fixed distance or at a set speed. You can read more about encoders [https://wpilib.screenstepslive.com/s/currentCS/m/java/l/599717-encoders-measuring-rotation-of-a-wheel-or-other-shaft here]. 5 5 6 We connect encoders either directly to !RoboRio DIO ports or to an intelligent motor controller such as the TalonSRX. The intelligent motor controllers can make use of the encoder data independently which offloads work from the !RoboRIO; in general, if you have smart motor controllers, the encoders should connect to them. We'll provide examples both ways:6 We connect encoders either directly to !RoboRio DIO ports or to an intelligent motor controller such as the TalonSRX. Intelligent motor controllers can use encoder data to offload work from the RoboRIO (e.g. to keep a wheel spinning at a set speed); in general, if you have smart motor controllers, the encoders should connect to them. We'll provide examples both ways: 7 7 8 8 === Encoder connected to RoboRIO DIO (Macademia) … … 61 61 }}} 62 62 63 Note: you'll need to manually turn the left wheel forward and backward to see the Encoder values change. Try turning the wheel 360 degrees to see what value is equivalent to a full revolution of the wheel. Notice that the raw count reports the sum of both A and B channels of the quadrature encoder. 63 Note: you'll need to manually turn the left wheel forward and backward to see the Encoder values change. Try turning the wheel 360 degrees to see what value is equivalent to a full revolution of the wheel. 64 65 Notice that the raw count reports the sum of both A and B channels of the quadrature encoder. A quadrature encoder works like the optical encoder shown above, but with two rows of slits in the disk, each slightly offset from the other (overlapping) and each with its own light source/detector. This allows you to determine not just distance and speed but also direction. The light detectors are labeled A and B; because the slots overlap, the sequence of detected light as the wheel rotates forward is: A, AB, B, off, A, AB, etc. When the wheel rotates backwards, the sequence is B, AB, A, off, B, AB, A, off. [[Image(encAB.gif,right,250px,margin=10)]] 66 67 64 68 65 69 Extra credit: ask a mentor to get an oscilloscope so you can see the pulses generated by the encoder as the wheel rotates.