View Single Post
  #13   Spotlight this post!  
Unread 14-02-2015, 09:38
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: Controlling Motor Turns Autonomous

Quote:
Originally Posted by btcshields6 View Post
That video did help. Thanks! Anyone have advice about labview implementation?
Here is some example code of how one might implement a PID gain on the encoder to drive the robot in auto. Please refer to the a fore posted video for how to set the gains. Also, please ignore the comments before the sequence, they were just not deleted from the default auto.

Also, the stopped constants will likely need adjusted - it is .3 on our robot.

There are other options, like running the pid loop in parallel, and setting the instructions in the sequence (i.e. not in the loop with the pid), using a stacked sequence, or the array of actions that comes with the default auto (although you will likely want to change the contained cluster to contain a distance rather than a joystick y), although be careful to put a wait inside the parallel loop so it doesn't bog down the processor.

It could be argued that constantly resetting the encoders allows for more drift (inconsistent drive due to not hitting the set point exactly, and I would agree, it would be better to use absolute set points (in this example, 500, 1100, and 1600).

As far as automatically switching to Teleop, it is not appropriate to code it to (since that would require messing with how the robot decides with mode to drive), but you can run the driver station in practice mode, and with the settings correct, it will do this (i.e. 15s auto 0s delay between periods).
Attached Thumbnails
Click image for larger version

Name:	autoEncoder.png
Views:	35
Size:	112.9 KB
ID:	18346  
Reply With Quote