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