Does anybody know how to switch between the arcade drive mode and tank drive. Preferably in C++ and blocks but python would work as well.
Do you want it to switch between drive modes during the match?
If so, this may help: Button pressed, switch to tank drive won't work - #5 by weilin
You can do it, I’ve made it work in blocks. Using variables, you check what the variable is at when the button is pressed and then chage it to the thing it is not. Then in your drive code (for this to work you have to completely code your drive) you use one drive code in the variable is a certain value and a different driving code if the variable is a different value. This was also hos we swapped our directions to drive backwards better. here’s a mock drive code. the toggle code is a when button pressed, if variable equals first number, set variable to second number else if variable equals second number set it to first number else set it to fist number (the last parts to make sure other thing in the code don’t accidentally mess up all your code, basically like self repairing)
Thanks this is really good.
You’re welcome. I’ll get a toggle code displayed soon
DriveControlDemo.v5blocks (38.3 KB)
That has the front/back and control type switching in there
I’m going to work on a speed control that works with that setup later but too lazy and homework-ridden to do it right now. You can try if you like. I plan to use variables to multiply the joystick outputs by decimal integers of variables which are changed by buttons, and automaticall reset back to zero or one if they’re above or below them, respectively. Then I’ll set other variables to those final results and substitute those variables for the actual joystick outputs in the code attached. This’ll make sure it doesn’t just start driving as it did when I tried subtractiong from the joysticks.