|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
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; |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|