Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Damping the joystick at 1 (http://www.chiefdelphi.com/forums/showthread.php?t=102932)

Pirate programe 15-02-2012 20:01

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?

Ether 15-02-2012 20:14

Re: Damping the joystick at 1
 
Quote:

Originally Posted by Pirate programe (Post 1127614)
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:

Code:

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.


Cecil 15-02-2012 22:23

Re: Damping the joystick at 1
 
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)

juchong 16-02-2012 11:43

Re: Damping the joystick at 1
 
1 Attachment(s)
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!

billbo911 16-02-2012 12:05

Re: Damping the joystick at 1
 
Quote:

Originally Posted by Ether (Post 1127623)
Run your joystick commands through a rate-limit filter.

Do the LabVIEW equivalent of this:

Code:

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.


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.

juchong 16-02-2012 12:30

Re: Damping the joystick at 1
 
Quote:

Originally Posted by billbo911 (Post 1128054)
There is a "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 (P) section of a PID block.

Ether 16-02-2012 12:55

Re: Damping the joystick at 1
 
Quote:

Originally Posted by juchong (Post 1128087)
The VI that I created is essentially the Proportional (P) 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.



Joe Ross 16-02-2012 13:12

Re: Damping the joystick at 1
 
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.

Pirate programe 16-02-2012 15:41

Re: Damping the joystick at 1
 
1 Attachment(s)
Quote:

Originally Posted by Ether (Post 1128106)
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.

Here's that PNG.

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

Ether 16-02-2012 16:10

Re: Damping the joystick at 1
 
Quote:

Originally Posted by Pirate programe (Post 1128247)
Here's that PNG.

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


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.



Pirate programe 16-02-2012 17:12

Re: Damping the joystick at 1
 
Quote:

Originally Posted by Ether (Post 1128258)
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.

That's exactly what it was.

Ether 16-02-2012 19:06

Re: Damping the joystick at 1
 
Quote:

Originally Posted by Pirate programe (Post 1128308)
That's exactly what it was.

OK then. For the benefit of students reading this thread, it's not the Proportional (P) 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.



All times are GMT -5. The time now is 11:13.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi