FRC, controling the speed with a 3rd axis


#1

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.


#2

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… :thinking:


#3

how do you do that?


#4

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


#5

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.


#6

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.

LimitThrottle


#7

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.


#8

ill try this


#9

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%


#10

Thank you guys this works like i was hoping.


#11

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?


#12

what do you mean it dosn’t return to zero.


#13

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.


#14

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


#15

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


#16

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:
Anyrange3


#17

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.


#18

thank you guys this works.