[FTC]: LABVIEW: Help with programming an Arm with an Encoder

Hi I am fairly new at programming using an encoder and need some assistance. I wanted to program an arm with an encoder to go to a position and HOLD THERE on the press of a button until ANOTHER BUTTON is pressed. (so like a loop keeps running holding the arm in place, like if the arm is lower than it should be the code moves it back up and if its higher moves it lower… until another button is clicked) I’m using Labview. I need help please!!!

http://www.chiefdelphi.com/forums/showpost.php?p=1210305&postcount=1

Have you successfully been able to read an encoder?

Do you know how to program buttons to select setpoint values?

If you could articulate what part of the problem you are struggling with, it would help in getting you the answers you need.

Yes I was able to get the encoder to got to a set position however the loop ends once it is at that position so the arm goes back down. I want it to stay there until I tell it no to. And no I don’t know how to use button to setpoint

Without seeing your code, it’s hard to know how/when you are issuing move commans to the arm.

It could be one of several problems.

The Motor controller could be timing out after you issue the move command (this is to prevent a bad move burning up your motor), or you could be issuing the return command without meaning to.

If the arm goes limp a short period after making the correct move, then it’s probably the timeout.

You need to use the watchdog VI (in the tetrix pallett) in order to keep the motor controller alive.

One way to do this would be just to put it in the main control loop.
A better way would be to creat a loop that runs slower, so you are not making the call faster than you need to.

If the motor Drives itself back to the other position than you are probably sending the command yourself. One way to debug this is to put a beep in the program where you issue each commands. High beep for position 1, low beep for position 2. Thenyou can ‘hear’ what your program thinks it’s doing.

Sound is your friend on the NXT.

Okay here is a picture of my code. So is it correct? I want the motor to go to the encoder position and hold.

Code.png


Code.png

Since you have reset the encoder, it will start out at zero, and you are giving a positive power, so the encoder value will go up.

Which means that test: Encoder > -360 will be true immediately, so the loop will exit immediately. So perhaps it should be > 360.

Some suggestions…

You really should have a “wait” in that loop because once it starts working, it will lock up the program for the duration of the arm move (which may not be a good idea) You should maybe wait for 25 to 50 msec.

Also., once the loop exits, if you don’t send a new motor command in 2.5 seconds, it will droop down again.

FTC used to have a “move to position” (rather than “Move fixed distance”)which would do exactly what you want here, with a single call, but I couldn’t find it this year (had to roll my own).

Phil.

okay I have added the wait for 25 milliseconds and How would I make the motor stay in that position until another button is pressed instead of just exiting the loop like in my code