Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Acceleration based on position (http://www.chiefdelphi.com/forums/showthread.php?t=91580)

umangv620 14-02-2011 18:41

Re: Acceleration based on position
 
Since I can't really use PIDs to slow down the motor when it reaches either limit, and allow free control of the motor through joystick otherwise, I tried another method that doesnt involve PIDs or case structures.

I made a function f(x) = .2 + .8sin(pi*x/1000) , and am using this to control the motor. X is an input that has the value of the encoder's position, and f(x) is multiplied with the joystick axis value to get the motor speed. When the position is near either limit, it will have a minimum speed of .2, allowing the motor to still move, yet not overshoot too badly that will cause harm. When it is not in the middle, it has a higher motor speed, allowing the motor to move from one side to the other as fast as it can.

I have that code combined with the limit switch code (using encoders) so that the elevator can't keep going up when it hits the top limit, and vice versa for the bottom. This code should technically work, right?

Ether 14-02-2011 19:26

Re: Acceleration based on position
 

Let XU be the upper position limit.

Let XL be the lower position limit.

Let X be the current position, between those limits.

Let K be the size of the "speed zone" near either limit, where speed gets reduced.

Let J be the joystick command, between -1 and +1, where +1 commands a speed toward the upper limit.

Then:

Code:

if ( (X>XU-K) && (J>(XU-X)/K) ) J=(XU-X)/K;
else
if ( (X<XL+K) && (J<(XL-X)/K) ) J=(XL-X)/K;



Greg McKaskle 14-02-2011 20:33

Re: Acceleration based on position
 
If you reverse your decision and want to use PIDs, you may want to consider joystick control where some input takes the elevator between a few known height set points -- say floor, lower peg, feed slot, middle peg, upper peg.

For more control, if the driver presses and holds a button, the joystick value is sent directly to the motor. OR you can make it to where this mode changes the set point.

Greg McKaskle


All times are GMT -5. The time now is 20:37.

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