View Full Version : Mecanum wheels spinning too fast!
ironmare
02-02-2015, 13:57
Before and after we have programmed a "dead zone" into our coding, we noticed that our xbox 360 thumbsticks are very touchy. Just barely moving the joysticks move the robot wheels too fast. What I need is some Labview coding that slowly starts moving the robot in the direction the thumbstick is being pushed, and then it ramps up to a higher speed when the the thumbstick is pushed all the way. Any help?
pastelpony
02-02-2015, 14:02
I would try to put in a selector that would take the input from the joystick and halve (or divide) it until it is greater or equal to 1 and then keep it constant to increase speed. Add in your deadzone and this should work.
http://i.imgur.com/rV0bIDN.png
Alpha Beta
02-02-2015, 14:04
Square or cube the joystick commands.
ironmare
02-02-2015, 14:10
How can I square or cube those joystick values, Alpha Beta? Also, pastelpony, would like to see that selector coding, thank you for your help!
samfruth
02-02-2015, 14:34
Can you give us a glimpse of what your code looks like right now?
Alan Anderson
02-02-2015, 14:46
The easiest way to square the joystick input values is to set the "square inputs" terminal to TRUE when you open your drive motors and let the WPI library take care of it for you.
If you want to cube them, then take the value from each joystick axis and multiply it by itself, then multiply the result by the original value.
pastelpony
02-02-2015, 14:53
How can I square or cube those joystick values, Alpha Beta? Also, pastelpony, would like to see that selector coding, thank you for your help!
Edited in.
Alpha Beta
02-02-2015, 14:53
How can I square or cube those joystick values, Alpha Beta? Also, pastelpony, would like to see that selector coding, thank you for your help!
Squaring the inputs is a selectable feature built into the arcade and tank drive vi's. If you open one of them up you can see how it is done and mirror the logic. At first glance I didn't see it being utilized in the mecanum drive vi. I wonder if there is a reason.
Note there is a small bit of logic needed to restore the sign to values that were initially negative.
pastelpony
02-02-2015, 15:10
Wouldn't squaring/cubing/multiplying the value of the inputs only make the stick more sensitive, though?
Wouldn't squaring/cubing/multiplying the value of the inputs only make the stick more sensitive, though?
see attachment
pastelpony
02-02-2015, 15:30
What is the value of (0.5)2 ?
I completely forgot that we're talking about decimals. Thank you for that reminder.
they way we fit this is we create a lookup table and we run the joystick command through that. This way you can have a custom joystick response. This also allows you to add a deadband, back lash corrections and ramp rates
they way we fit this is we create a lookup table and we run the joystick command through that. This way you can have a custom joystick response. This also allows you to add a deadband, back lash corrections and ramp rates
You seem to be implying that using a lookup table to shape the joystick output allows implementing a ramp rate, whereas using a function to shape the joystick output does not. Is that what you intended?
sorry no both ways work just as well. Just was putting out another option. We have just had good luck with this method. here is an example of how we use it http://i.imgur.com/Bq7QMuE.png
sorry no both ways work just as well. Just was putting out another option. We have just had good luck with this method. here is an example of how we use it http://i.imgur.com/Bq7QMuE.png
You mentioned you were using a Lookup Table for that.
Just for fun, when you have a symmetric piecewise linear curve like that with so few pieces, you can create a very simple tunable piecewise linear function.
I labeled the points (a,0), (a,b), and (c,d) on your diagram (attached).
C code for the piecewise linear code for that is quite simple:
// do the following once at initialization,
// or any time you change a ,b, c, or d on-the-fly:
m1=(d-b)/(c-a); m2=(1-d)/(1-c);
// Let J be the abscissa and K be the ordinate on your graph.
// Here's the piecewise linear code to convert J to K:
x=fabs(J);
if (x<a) K=0;
else if (x<c) K=b+m1*(x-a);
else K=d+m2*(x-c);
if (J<0) K=-K;
Greg McKaskle
04-02-2015, 21:34
LV has two nodes that assist with this approach. Interpolate is simpler and assumes a uniformly increasing second dimension. The attached image is the node that implements the more general approach.
Greg McKaskle
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.