i don’t know much about encoders, but i know that autonomous is almost exactly like teleop, except for instead of using joysticks to drive, you have the code input numbers
The Encoder Example project in LabVIEW should tell you everything you need to know in order to connect, initialize, and read from the type of encoder provided in the Kit of Parts.
In the main LabVIEW FRC 2011 “getting started” window, click the Support tab then click the Find FRC Examples… option. You will find Encoder Example.lvproj under the Sensors subfolder of the FRC Robotics folder.
I am also trying to get encoders working in Labview. How can I set a motor output value using encoders? For example, arcade drive> output value > encoder?
I would still like a more helpful answer to my initial question. Look, I basically want to be able to drive the robot in autonomous to whatever distance I set the encoder to go. I looked at the example, but that is not really any help. Do I need to do a PID Loop for this, or is there a block of code that I can use that I can link to my drive code to drive it a certain distance in autonomous?
Do you know how to calculate the number of encoder counts that represents the distance you want to travel?
Do you know how to do a comparison function in LabVIEW?
Do you know how to use a Case structure in LabVIEW to do different things based on a value?
The simplest thing to do is to continuously read the encoder and run the robot forward only when the value is less than the distance you want to travel. You’ll probably coast past the destination unless you have your speed controllers set to “brake” mode.
I have not yet managed to read the encoder value because we don’t have encoders on our robot from last year, which I’m using to play with programming right now.
I do not currently know how to calculate the number of encoder counts for my distance. I’m pretty i just need to find the converting factor that is usually provided with the encoder or I could find it online.
I’m not exactly sure how to do a comparison function in Labview, though I’m sure I could find it.
I’m pretty good at using case structures to do certain things, though I usually only used them last year for buttons on the joysticks. Not really related to using them for encoders, but I’m pretty sure I could make it happen with case structures.
The way you described that would be the simplest method was exactly how I was thinking it. Find the distance I need and how many counts it would be. Run the encoder and the motors until the encoder hits this value. At that point, I would set the motors to 0/stop. Also, I would set my speed to something like .5 or .7 to lessen the chance of it overshooting my projected distance.