05-11-2019 05:03 PM
Sorry if this is a bit confusing but I've been spending this off-season trying to find out more about encoders and just had a quick question about where to put the code for Resetting the encoder back to 0 at in the RobotMain.vi? I've found some information on programming them and just haven't been able to come across where to actually put it.
05-11-2019 09:16 PM
@5411 wrote:
Sorry if this is a bit confusing but I've been spending this off-season trying to find out more about encoders and just had a quick question about where to put the code for Resetting the encoder back to 0 at in the RobotMain.vi.
I recommend putting it about 2" down and slightly to the left of the center. [I realize this "answer" might not be too helpful, but for everyone except your team-mates who will recognize your Forum name and will have the exact VIs in front of them for reference, there is not much to go on in your question. Too bad that "RobotMain" is not a Standard VI that we would all recognize ...].
Bob Schor
05-11-2019 11:05 PM
The RobotMain.vi is a standard vi when creating an frc robotics project. This is where all the scheduling is and framework of the project is located.
05-12-2019 03:08 PM
There is an NI Forum here called First Robotics Competition Discussions -- you might get more viewers who "understand the question" (and possibly have sufficient experience to post a useful answer) there.
Bob Schor
05-13-2019 09:55 AM
Can you explain your desired result?
Generally, encoders used in Robot Main are those used for PID loops to bring something to a specific location.
Encoders that you'd reset are more typically used for something along the lines of "drive for distance" where you want to go x" independent of where you currently are.
For the first, you wouldn't reset the encoders. You'd aim towards the known value. With this, you'd want to do something along the lines of resetting the encoder the moment autonomous starts and then leave that value in place. For the second, you'd hide the reset behind a case structure that runs when you hit the button to handle that task. Keep in mind, you'll want to do something with your code to ensure this runs for a period of time following the reset without holding up the loop. This can be a bit tricky to do well. Have you considered looking at Command and Control and moving the encoder logic out of robot main and into one of the subsystems?