Coding a button to reduce power

Need help with code (Labview) …trying to use a button on xbox controller to cut power to a specific value then return to full power when pushed… Does anyone have any examples… we are using mecanum wheels…

What is the problem you are trying to solve? You may get bad advice if you don’t explain why you want to do this and what you are trying to accomplish.

As I replied in another thread… we are now in panic mode with all the programming issues we had and our driver hasn’t had the opportunity to practice… now he won’t get the opportunity until competition… so we are looking for programming options to add a little finesse to a fast drive train… we used it before but we lost our old codes when our computer bit the dust this year…we spent 3weeks trying to save everything… but didn’t happen… I wasn’t involved with programming until this year so I wasn’t sure what was in the code…

Multiply your joystick values by 0.5 or whatever value you want between 0 and 1 before sending them on to Mecanum Drive Cartesian.

Adding to this. What I prefer to do is if I have the availability of buttons then i use rb and lb to control drive. I program it so it acts as a drive lock (robot will only move while button is being held). It also makes it very easy to control speed. One button multiplies the joystick by .5 so the max output of it is only half of the full power of the motors and the other button is just straight so it will allow the full power of the motors.

If you need a code example I can provide one.

Using a select works well with this idea.

Read the button of interest and feed the value into select. If true, output the joystick value * 0.5. If false, output the joystick value.

Would a select work like that though? 3072 tried that, and it would send .5 instead of the joystickvalue*(.5). We had to use a case structure to achieve switching to half speed (around quarter speed in our case) so our drivers would quit throwing the rope around at the end of the match

I am attaching what the code would look like for what JeffB posted - this will cut the output to the motors in half while the button is pressed (else full power available). There a number of toggle setups posted around CD (and you can easily make one using Breakaway’s Memory Library) if you wanted to have the power cut persist beyond while the button is pressed (either clear it by pressing again, or by pressing a different one).

selectSpeed.png


selectSpeed.png