Hi! Me and my team had an ideia of implement a system based in boost our robot speed like:
The robot operates in 70% of his whole potencial, in front-behind commands, uses an Joystick to do it. But, if we press a determined Trigger ou Button, the robot starts using 100% of his motors and speeds up.
I’ve been trying to find a code which make this happens, also, I’ve tried to do it by myself. However, no options brought good results.
Do anyone have an example of way to code like this? We would be grateful!
Edit: wrote this about Java, didn't realize you needed LabVIEW help
We did the same thing this season, to help line up and make balancing the Charge Station easier. Here are our relevant snippets of code, the first one is in RobotContainer and the second one is in CmdSwerveDrive, and all of our code for this year can be found here.
You could have a variable that multiplies the joystick inputs by .7 then when the button is pressed it sets that variable to one instead of .7. Then on the release of that button you set that variable to .7 again.
There are a few ways to do that. If you are just sending a percentage to the motor controller (a -1 to +1), just multiply that output by 0.7 normally, and multiply it by 1 when your ‘turbo’ button is pressed.
You can use the driver station program to figure out which index corresponds to the button you want. If you go to the tab with the USB symbol, you can press the button on your controller, and it will light up in the display.
The square in the top left under ‘Buttons’ is index ‘0’, and it counts up as you go down the column. If you are using an Xbox controller, the ‘A’ button is usually index 0 (‘B’ is 1, ‘X’ is 2, ‘Y’ is 3).
I have to use this constantly, because I can never remember them.
What kind of drive base do you have and what motor controllers are you using for your drive base. The reason I ask is that you may want to use an “open loop ramp rate” on your motor controllers if you have the possibility.
Going from 70% speed to 100% speed immediately when pressing a button may have some unintended consequences.
Well, finally I tested this boost code, but it isn’t working as expected. Before I press the Boost Button, the robot oppers in 70% as normal, however, after I click it, the robot uses 100% the whole time, even if the Boost Button is not pressioned anymore. The robot just comes back to 70% if I press both joytsicks and buttons together at the same time, also, this doesn’t work sometimes.
Do I have a way to code for the Boost to 100% just occures while the Boost Button is pressioned and come back to normal after I take my finger off on him?
I’m not sure if this helps but my team decided it would be a good idea to instead of limiting the motors and turning them up with a button, we don’t restrict them and code a button that turns off the current limits on the motors. I don’t know if this is helpful or not but there’s an idea for you
Our team utilized a turbo button this year. We used an xbox controller with the left stick to control forward and backwards and right stick to control turning. We slowed down both forward and back and our turns. We then used the left shoulder button as a “turbo” button that allowed for full power on forward movement only. Our driver said it worked quite well. Here is a snippet of our teleop. It is similar to what PI_Fighter already posted, but slightly different.
In addiction for this post, I would like to share a way of making my robot boost using not just only buttons, but triggers and analogics this time. For me, this code works pretty well, if you saw any problem on it, contact me for I make a change.