![]() |
Encoders
Hello, I would like to know how to do various things with encoders. If you would be so kind as to help, I would very much appreciate it!
Here are the things that I must learn to do. 1.) Get the encoders to work 2.) Be able to use them for autonomous and to go a set amount of distance per rotation Thank You so much for your help! |
Re: Encoders
The first step is to wire up your encoders and make sure that you can access the information they provide in your code.
The following code snippet provides an example of how to construct an quadrature Encoder object and register it with the LiveWindow system. Once your robot program is compiled and deployed, you should then be able to select Test mode instead of Teleop on the driver station and see the values being reported by the encoder. You will need to adjust the DIO port constants to match where you plugged in your encoder cables. The following assumes that you have a two channel (quadrature encoder) that has two PWM cables that you plugged into DIO ports on the roboRIO (you did not specify much information about your robot - so this was a guess). NOTE: I don't have access to a robot to try out this sample code below, so you may need to make some adjustments. Code:
// The digital I/O ports you plug your cables into on the roboRIO |
| All times are GMT -5. The time now is 08:59 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi