Damping the joystick at 1

Sorry for the undescriptive name, but there’s no real way to describe this with my high-school math knowledge.

We’ve noticed that when our robot goes at a speed, and then moves in the opposite direction at the same speed, it starts tipping over. As such, we’d like the joystick, when it is set to a certain value (let’s say 1), to slowly ramp up toward that value, instead of immediately going to it.

Any ideas?

Run your joystick commands through a rate-limit filter.

Do the LabVIEW equivalent of this:

change = joystick - limitedJoystick;
if (change>limit) change = limit;
else (if change<-limit) change = -limit;
limitedJoystick += change;

limit is the amount of change you will allow every iteration

limitedJoystick is the rate-limited joystick value you use to control your motors.
*
*

Also, with the Jaguar v.101 firmware, you can set the speed controllers to automatically ramp up the values by simply turning the limit switch jumpers sideways. You don’t need to be using CAN to do this, either, only the firmware is needed.

More information on this can be found here.

Seems a lot easier to me to just do this, if the ramp rate is good enough (I haven’t tried this method yet)

Just add this VI to your Teleop loop. All you have to do is wire your joystick input (which must be between -1 and 1) to the “joystick input” side, wire the output to your motor control VI, and pick a constant for scaling. Start with 0.1 and tune it in to what you think is best.

Once you have that, repeat for the other axis and you’re done!

Joystick Scaling.vi (17.1 KB)


Joystick Scaling.vi (17.1 KB)

There is a pre-built “PID” function in LabView that does exactly this. Search for “rate limit”.
We are using this to keep us from stripping gears on our ball pickup if we reverse directions quickly on it.
Find a control value that works well by experimentation. For our ball pickup, a value of 45 is good. For drive control, you may want a higher number.

I agree, a PID block would also work well in this case. The VI that I created is essentially the Proportional § section of a PID block.

Could you please post a PNG? I don’t have LabVIEW installed here.

I’m wondering how you get a maximum rate limiter using only a P controller, without affecting the dynamics of commands which do not exceed the desired limit.

There are several methods in this whitepaper: http://thinktank.wpi.edu/article/140, including Ether’s method, a reference to the PID Output Rate Limiter, and some introduction to low pass filters.

Here’s that PNG.

The use of a feedback node is throwing me off a bit, but it seems pretty straightfoward…

scrncap1.png


scrncap1.png

Thanks, but you misread my post. My post was addressed to juchong. I was asking for a PNG of the P-controller vi he attached to post#4.

What you posted is not a P controller. It’s slew rate limiter; the LabVIEW equivalent of the C pseudo-code in post#2.

That’s exactly what it was.

OK then. For the benefit of students reading this thread, it’s not the Proportional § section of a PID block. It’s a slew rate limiter, and it’s identical to the one in the WPI paper Joe linked to.
*
*