Quote:
Originally Posted by btcshields6
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).