I am moving a tool over a varying distance. My motors can support constant acceleration and deceleration of $1 \space m/s^2$. I need to cover the distance as quickly as possible (accelerate for as long a time as the distance allows) and decelerate to $0 \space m/s$ at the end of the allowed distance.
Since the distance covered during deceleration varies depending on the velocity I accelerate up to; I'm looking for a good way to solve for both.
Thanks