[FTC]: Encoder programming in labview for teleop

Hi so my team is using encoders this year and I’m not familiar in programming them. Our plan was to incorporate encoders in our teleop code. Like for example when I press button 1 I want the arm to go to a specific position using the encoder. I’ve been researching and doing trial and error for about a month now and can’t quite get it any help will be much appreciated Thank you in advance.

So an encoder is simply a sensor that tells you how much the encoder has rotated. For moving an arm to a specific position, you need to use a control algorithm such as PID. PID works by calculating a power setting for the motor based on the arm’s current position (taken from the encoder) relative to the position you want the arm at. If you’re in FTC, I believe you’ll be using either NXT-G or RobotC (are there others?), however, I’m only familiar with RobotC.

We are using lab view and I’m familiar with what an encoder is but what’s confusing me is how to set up the PID structure

Could you be a bit more specific? It’s not clear what you mean by “set up the PID structure”.

For example, here’s a link to the LabVIEW help section for PID. If you could identify what part of it is confusing, it would help get you targeted answers.

I would like to execute a code once when I click a button on the controller. Like when I click button 1 on the controller I want the arm to move to the specified enconder position and stay there until I press another button to retract it. I just need an example to work with.

When you press the first button, your code should set the PID setpoint to whatever position you want the arm to go to.

When you press the other button, your code should set the setpoint to whatever position corresponds to “retract”.

Does your version of LabVIEW have examples? That would be a great place to look.

Here’s another good resource:

http://team358.org/files/programming/ControlSystem2009-/LabVIEW/

The link you gave me is labview for FRC, is it similar to labview ftc

Check to see if your LabVIEW installation has built-in examples how to use PID. If it does, that’s usually a very good place to look for help.