# FRC, controling the speed with a 3rd axis

Hi, my team is using a Logitech attack 3, The plan is to use the dial on the bottom middle to control the speed of the drive. the drive works on its own, we just want more control.

-I know that the throttle dial goes from 1 to -1.

-we are using an arcade drive, with 4 motors.

I guess you could multiply the output of your first and second axis by the output of the third axis?

That way you would still have a value between -1 and 1 for each of your drive motors, but it would be scaled depending on the third axis inputâ€¦

how do you do that?

do you just drag the axis index array down, adding another reference

This is what comes to my mindâ€¦ itâ€™s basically multiplying the first two axis with the input of the third one. Please note the index values will change for your joystickâ€™s axis.

Hereâ€™s a variation of Oscarâ€™s idea.
This limits the power to between 50 and 100 %.
It reverses the throttle to make up=full speed and down=half speed.
And it doesnâ€™t have the reverse problem and doesnâ€™t allow the power to drop to zero.

2 Likes

so this some what works.

-the issue is when the throttle is at half the motors donâ€™t move.

-when the throttle is all the way down the robot moves forward at full speed.

-when the throttle is all the way up, the robot moves backwards at full speed.

ill try this

Thank you the robot works as intended, my last question is, if i were to change the 0.5 constant to 0.2 would that put the slowest speed to 20%

Thank you guys this works like i was hoping.

You might want to think carefully about this. This type of throttle does not return to 0 if you let go of it. Also, a slider like this is harder to control than direct thumb control on a stick. Is your driver going to have one hand dedicated to doing only throttle?

1 Like

When you let go of a control stick, it comes back to the middle, because it is spring loaded. This sliding throttle does not come back to the middle, therefore, when you let go it does not stop.

the joystick controls the motors, the throttle just effects the motor speed. aka the throttle dose Not move the motors, the joystick does.

so i could set the throttle to normal/full and nothing happens until i move the joystick.

To be able to vary the range (e.g., 20-100%) uses a different equation to remap (-1 to 1) into (.2 to 1.0) and is probably easiest to implement with a Formula Node from the Programming->Structures palette.

X= the throttle value
y = the range you want (e.g., 20-100% is an 80% range, so y =.80)

Then (x+1)/2*y+(1-y) produces the range .2 to 1.0 from the throttle axis.
Iâ€™ll let you work out what this equation does.

Hereâ€™s an example:

The typical solution to this problem is to square (while keeping the sign / positive or negative) or cube the joystick input. This tends to feel more natural or easy to control. But if this third-axis throttle control works for you, then by all means go for it.

thank you guys this works.