View Single Post
  #4   Spotlight this post!  
Unread 23-02-2015, 10:34
mshafer1 mshafer1 is offline
Programming Mentor
AKA: Matthew Shafer
FRC #3937 (Breakaway)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2008
Location: Arkansas
Posts: 55
mshafer1 is an unknown quantity at this point
Re: Help with LabView lift presets

Quote:
Originally Posted by Greg McKaskle View Post
While it is possible to do this in TeleOp using a state machine, it is probably easier to put this code into Periodic tasks. You can directly check the joystick button there, or you can check the button in teleOp and use a global or other notification mechanism to tell the periodic loop what to do.

The buttons will either add or remove some value to a common set point, and the loop will drive the motor as appropriate to get to the set point.
Both Greg and Stevil99 have made good points. I just want to point out some additional options.

As far as software, it may be advisable to use a pid, have the buttons select a set point (which is "remembered" either via a shift regiser or a feedback node), and some way of measuring the location of the elevator. My team typically utilizes encoders connected to the gear box (this yields a position relative to power up), alternatively, one could use a 10turn pot (yielding an absolute position). I won't go into details on that, but I am attaching an examples of what it could look like.
To change from encoder to pot, merely swap open the open and read vi's. This version would be for use in Teleop (it is designed based on the idea of a state machine, although not a true one), to put it in Time Tasks, switch the loop constant to false so it doesn't exit.
Attached Thumbnails
Click image for larger version

Name:	elevatorExample.png
Views:	64
Size:	28.7 KB
ID:	18462  
Reply With Quote