How to make my robot speed boost? (LabVIEW)

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!

Mont#9305

1 Like
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.

controller.getButton("RightTrigger").onTrue(new InstantCommand(()-> Swerve.throttle = 1)).onFalse(new InstantCommand(()-> Swerve.throttle = 0.8));
        controller.getButton("LeftTrigger").onTrue(new InstantCommand(()-> Swerve.throttle = .25)).onFalse(new InstantCommand(()-> Swerve.throttle = 0.8));
translation = new Translation2d(xAxis.getAsDouble(), yAxis.getAsDouble()).times(Swerve.throttle).times(maxSpeed)
rotation = -zAxis.getAsDouble() * maxAngularVelocity * Swerve.throttle;
1 Like

Thanks for your disposition, really. However it’s also my fault I didn’t mention that before. Sorry!

1 Like

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.

2 Likes

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 could also treat your ‘turbo’ button as a toggle, where each button press switches between the slower and faster speeds.

2 Likes

This button besides the “Turbo Button” text, where do I find it? I know it’s related with the True of False, but it isn’t the same as the one used for define the motors rotation side, for example.

That’s actually a LabVIEW control for the front panel of the VI. For the robot, it won’t be useful, because you can’t access it during a match.

If you right click a boolean constant (the T/F box) the list will have an option, ‘Create Control’, and it will create one. The default name will be ‘Boolean’, so it will look like this:

Boolean Control

You can ignore how the ‘Turbo Button’ and ‘Boolean’ look different, they do the same thing.

For your robot, you want the turbo button to actually be a button on your joystick, game controller, whatever plugs into your driver station.

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.

1 Like

Alright, I will test it on Tuesday and give you feedback! Thanks for your help so far. :raised_hands:

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?

**Here is the code I’m using now


**

I don’t know exactly what is a driver base, but if you refer to the chassis, we’ve built an AM14U5. We’re using Viktorks SPX Motor Controller in all of our 4 motors.

Could you give me an example of an “open loop ramp rate” in a code, for me get the ideia?

1 Like

Yes, it’s easy to do that. Just take the boolean wire from the button array, and wire it directly to the select operator that goes between -1 and -0,4.

1 Like

Could you send me a screenshot of this code in LabVIEW? I don’t know if I done it correctly.

Screenshot 2023-04-12 151541

Look at this example. With this, the turbo only applies when the driver is holding the turbo button. When they let go, it should go back to the slower speed.

Also, I noticed that both of the joystick names were the same name, so I changed it to Joystick 0 and Joystick 1.

Turbo Button Example

1 Like

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

1 Like

Disclaimer: I am not an expert in Labview

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.
turbo

1 Like

Thanks for your help anyway!

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.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.