InfernalRobotics icon indicating copy to clipboard operation
InfernalRobotics copied to clipboard

Adjustable servo acceleration/deceleration

Open tox1m opened this issue 11 years ago • 4 comments

Would be nice if we could adjust how long it takes for a part to start moving at the set speed, so that they would slowly accelerate (and/or decelerate to a stop).

Right now when applying movement to the parts, they immediately move at the specified speed.

For example; we could set the servo acceleration to take 2 seconds and deceleration to take 1.5s and have servo speed at 1.

This might decrease the wobble with robotic arms and cranes when moving around large objects.

tox1m avatar Apr 28 '14 17:04 tox1m

I too would like this feature. I'd say that the end stops of each joint would need to be taken into account, so if you accelerate a joint and it reaches the end of its 90 degree range it cannot be allowed to overshoot, and should abruptly stop.

ZodiusInfuser avatar Apr 29 '14 08:04 ZodiusInfuser

I understand the acceleration but not the deceleration. Movement action could be stopped at any time, so the action must stop immediately or continue and decrease speed to achieve smooth stop?

omgnull avatar May 10 '14 21:05 omgnull

It should be the latter IMO, since you've released control of the joint, but it needs to apply the brakes to reach a stop. The exception to this is when the distance/angle reaches the limits of the joint, in which case the value should just be clamped, and not allowed to overshoot. This should apply in both cases, as its possible to hit the limit whilst accelerating.

ZodiusInfuser avatar May 11 '14 01:05 ZodiusInfuser

I have a simple interpolator in mind, which accelerates smoothly both on keypress and towards the ends of the travelling range. Say we are travelling in positive direction.

// Variables cmdVel: target speed oldVel: speed from last frame newVel: speed for this frame maxPos: End of travelling range

// Limit cmdVel to constant acceleration braking profile towards maxPos cmdVel = min(maxVel, sqrt(2 * acc * (maxPos-pos) )) // speed tries to follow cmdVel newVel = min(oldVel + acc * deltaT, cmdVel) newVel = max(oldVel - acc * deltaT, newVel) // position is updated pos = min(pos + curVel * deltaT, maxPos)

pellinor0 avatar Feb 21 '15 14:02 pellinor0