How can I set the rate of acceleration so when I drive the robot forward it doesn’t do a wheeling all the time. My teammates are young and like to hit the joystick hard. I don’t want to limit the max speed, but rather set a rate of acceleration so it’s a nice slow increase in speed. A visual would be awesome I’m a newbie
What you want is a rate limit on your joystick command.
You want the LabVIEW equivalent of something like this:
o = joystick;
if (o > op+d) o = op+d;
else if (o < op-d) o = op-d;
op = o;
… where
“joystick” is the present value of the joystick command
“o” is the output to the motor controller
“op” is the previous output to the motor controller
“d” is the maximum change you want to allow each iteration
So how would I do that in labview?
By the way, there are lots of goodies that ship with LabVIEW that aren’t in the FRC palette. In this example, there is an Output Rate Limiter. It basically does what Ether described, but is already coded up.
It is in vi.lib/addons/control/pid/pid.llb. You probably want to wire the input from the joystick, the output to the motor, and use the output rate to control how much it will allow the output to change in a given time period. The units it uses may not be obvious, but numbers in the range of 100 to 1000 are likely what you are looking for.
Greg McKaskle
I believe I found the pid thing, but I’m not sure which one it is, or how to hook it up to what? Also I have no idea what your talking about the 100 to the 1000 thing where is that? I am newbie Sorry for any frustrations, Thanks
You want the PID Output Rate Limiter.vi (it’s the bottom one of the three in your image). As with any LabVIEW function, its inputs and outputs are described in the popup help. The only inputs you need to be concerned with are “input” and “output rate”, and the output is called “output”.
Just insert it on the wire where you want to limit the rate of change of a value, with the source connected to “input”, the destination connected to “output”, and a number representing the maximum rate of change connected to “output rate”. You can use a front-panel control as the source of the rate number, so you can change it while the program is running. Just remember to either replace it with a constant or “make current value default” when you determine the rate you want.
Also I have no idea what your talking about the 100 to the 1000 thing where is that? I am newbie Sorry for any frustrations, Thanks
The output rate is in units of “EGU per minute”. Since you probably want to limit the motor rate of change to go from full scale reverse to full scale forward in about a half second (give or take an factor of two or so), that’s something like 4 per second, which is 240 per minute. Start there and tweak it up or down until you get a value that works for you.
Okay I have it hook up but I’m a little hazy yet with the EGU what does that mean? So lets say the acceleration was at 100% before this which was too fast. What would be the setting for say 75% acceleration. So do I limit it in the EGU dot or what dot do I exactly limit it thanks. visuals are awesome, but are not necessary.
EGU stands for engineering units. It is vague because the limiter is just a mathematical operation, sorta like averaging. It can work on anything you want to control, temperature, voltage, current, etc. In this case it is the 0 to 1 motor controller value.
Leaving it set to 1 will, I believe, limit it to a one unit change per minute. Seems a bit timid. A setting of 60 will take one second to let it change by one unit. 120 will ramp from 0 to one in half a second, and so on.
Since the speed controllers in your teleop are running 50 times per second, and the code could currently change the value instantaneously from -1 to 1 in a adjacent calls, the equivalent value of the original system was 60502, or 6000.
To your question of what value to use, why don’t you make a numeric control on the panel of teleop. Set the initial value to 100. Run RobotMain using the run button. Carefully drive the robot a bit, on blocks or on the ground, and see that it is spongey. The throttle doesn’t instantly change the robot speed. With the robot still running, change the value to 6000. It should be the original acceleration. Now try 1000, 500, and explore a bit.
When you are done, make the value permanent by either making the value a constant on the diagram or by right clicking and going to Data Operations>>Make Current Value Default.
Greg McKaskle
My team wanted a non-linear approach to acceleration that would add a deadzone so we could control our driving.
I went off and played with the joystickget.vi located in the teleop.vi and came up with this:
That ‘x**3’ is x^3 which looks like this on a graph:
The blue represents the normal linear acceleration in which there is no dead zone and what you press is what you get. The red is the x**3 which adds a deadzone that, in my team’s case, helped people driving not crash into walls right away. The functions are wired into the axis (x and y for driving). I don’t know if that’s really what you are asking for but I hope this helps.
EDIT: I also noticed you are from MN; What city?
I wrote this for 2009 Lunacy. It describes a few ways to limit acceleration rates in LabVIEW.
where in labview would i put this
You wouldn’t. You’d have to take that logic and do something equivalent in LabVIEW.
Do a search for “rate limit”. I’m pretty sure there are threads showing how to do that in LabVIEW.
Here’s an article by Eric:
http://thinktank.wpi.edu/article/140
… look at the section named “slew rate”