View Single Post
  #6   Spotlight this post!  
Unread 09-01-2013, 21:38
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 747
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: [FTC]: LABVIEW: Help with programming an Arm with an Encoder

Quote:
Originally Posted by Robobuff1.0 View Post
Okay here is a picture of my code. So is it correct? I want the motor to go to the encoder position and hold.
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.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
Reply With Quote