Billbo could you post a screen shot of the labview "code"?
I like your solution over mine however I don't quite have feel of coding in Labview to get this done quickly.
TIA
Quote:
Originally Posted by billbo911
If I understand what you are asking, you want to have the robot drive straight when a button is pressed, regardless of which direction the robot is facing. Is this correct?
Now, assuming it is correct....
According to your title, you have encoders connected to you drive train. Again assuming here, one on the left and one on the right.
Start with a case structure. Wire the Y channel bypass the structure. In the False state, the X will pass through the structure to the Arcade mode. When the "button" is pressed, switch the case structure. In the True state, the X channel will be replaced inside the case structure.
Here is where it gets a little complicated.
The first time through the loop after the button is pressed, initialize the counter for both encoders. From that point on, as long as the button remains pressed, the X value to the Arcade mode becomes the difference between the counts of the left and right encoders. You will need to "GAIN" this value to maintain smooth and not over responsive control. You will also need to limit the output to the Arcade mode to between -1 and +1. You might also need to invert the sign so that the code corrects in the right direction.
The bottom line is, the correction to direction is based on the difference between the counts of the encoders.
|