# Clever Driver Control Programming

What are some clever programs that your team use to make your driver control more efficient? (eg. raise lift to tower height by pressing one button).

2 Likes

Well I know we (and lots of others) have 1 button that backs our robot up and runs the intakes slowly so we can stack

5 Likes

Nice. Our intake get pushed out by the tray when we push so we donāt have that

2 Likes

Decreasing sensitivity for the drive helps make driving smoother without removing itās max speed

9 Likes

How? In our recent comp we have this problem and what I did is just decreasing the joystick value by 3/4

2 Likes

Thatās one way to do it, another popular method is to cube the joystick values (taking āthe joystick valueā as a float between -1 and 1 in each axis), that way you get more sensitivity at low motor powers for precise movement while still being able to use 100% power when you want it.

5 Likes

Do you put the axis value into the float? (Something like this?)

`` float axisone = Controller1.Axis1.value();``

I plan on having a sensor know when my tray is full, and drive slowly when it is so that I donāt accidentally spill cubes

1 Like

So if youāre getting joystick values as a percent (int from -100 to 100), then the easiest thing to do is probably to divide the controller value by 100, then cube it, then scale the cubed result back by 100 (because you probably want it scaled back up to feed as a power value to motors):

``````int cube_joystick_val(int input){
return  pow(input/100.0, 3.0)*100.0;
}
``````

note that you will likely need to `#include <math.h>` to get the `pow` function.

7 Likes

This is really good. With a drfb I increase the value of the exponent as the drfb gets higher so itās less likely to tip

2 Likes

With some algebraic thinking, you should be able to simplify that even further: cube, then divide by 10000. Not that it will make any noticeable difference in performance, just an observation.

5 Likes

Ohhh so like the value slowly builds up more and more when you move the joystick

No, that would be called slew rate/acceleration. The cube joystick basically remaps all the value (80% joystick would be 51.2% motor power).

2 Likes

I have buttons for running intake at full speed, and at half speed. That way if I want to fine tune the position of a cube in the intake, you can use the slower buttons. The full speed buttons toggle on, but the half speed buttons run as long as you press the button.

For a bot with a tall lift, reduce the motor speed based on the lift height to make it less prone to falling over, and more precise when trying to stack.

If you need to zero the position of a pid based motors, hold a button for manual control that, when released, resets the position of that motor.

Hold a button for low-speed/precise drive train control.

Select different braking options using buttons.

Have a partner controller pre-select stack or tower height so that the driver can just press a single button and the lift goes to the correct height for stacks or buckets.

Button for small adjustments to the left/right motors of a lift to level it out.

Toggle a drive straight function if your drive train gets messed up and your robot is turning when you try to drive straight.

3 Likes

Check out our robot showcase:

There we show how we automated our flywheel angler in driver control, and made ourselves some higher level controls.

5 Likes

From personal experience, also think about partner controls. Our driver last year was also our main programmer, while I was the secondary programmer to help ease the load of him driving by taking over some things like intake control and aiming.

Like a lot of people say, combine commonly paired inputs or sequences together. At nationals our programmer mapped a ādouble shotā function to our ball launcher, which would automatically aim, shoot, re-aim, and shoot again with just 1 button press.

4 Likes

Macros and directional x-drive