![]() |
Acceleration Ramp Up Code
Our team is trying to cut out some of the bumps in acceleration by writing a "ramp up" code. For example, if we want the motor power to go from 0 to 100, we want there to be other steps in there to prevent jumping ss in the acceleration. Any ideas of how to do this?
|
Re: Acceleration Ramp Up Code
Can you elaborate on what you want to do to cut down on acceleration? The way I am familiar with manipulating the drive is from the joystick outputs. I don't think you can manipulate the motor output itself since the motor outputs are used the vi given by wpi. I wouldn't want to mess around with their vis until it becomes necessary.
|
Re: Acceleration Ramp Up Code
Quote:
|
Re: Acceleration Ramp Up Code
Quote:
|
Re: Acceleration Ramp Up Code
Quote:
|
Re: Acceleration Ramp Up Code
Quote:
|
Re: Acceleration Ramp Up Code
Actually yes I read through yesterday, and was interested in the "Slew Rate" and "Low Pass Filtering" sections, as we were thinking of doing it in a similar fashion but didn't know how to implement it. So that helped a lot in that regard, but I'm still wondering. Are there better ways to do this? Which of these options do you think is best?
|
Re: Acceleration Ramp Up Code
Quote:
In a text-based language, it would look something like this: Code:
change = joystick - limitedJoystick;limitedJoystick is the rate-limited joystick value you use to control your motors. |
Re: Acceleration Ramp Up Code
Thanks for the help!
|
Re: Acceleration Ramp Up Code
1 Attachment(s)
I've attached an example that helps visualize what happens when you use the low pass filter option. It has two different low pass filter implementations. One of them is simply averaging your joystick outputs over a number of samples. This method makes the most sense intuitively if you have not studied low pass filters before.
As far as implementing this, I see a couple of options. The easiest might be what was said before, which is to put a block between your joystick and your motor drive functions. The other option is to put whatever function you want to use into a VI and assign that VI to each motor as its 'transfer function'. This way you use all of your motor drive functions as you normally would, both in teleop and auton, and your ramp function will always be working. For both of these options, if you create your ramp function as a SubVI and you create multiple instances of it, it will be important to set your execution to Reentrant for that SubVI. This is File -> VI Properties -> Execution -> Reentrant execution with option Preallocate clone for each instance Edit: Added the PID Output Rate Limiter as well which is what Ether describes. |
| All times are GMT -5. The time now is 09:43. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi