# Generating double s-curve velocity profiles with given time

I wonder how to generate double s-curve velocity profile for multiple DOF trajectory. Since there are constraints on initial and final velocities which can be non-zero it is necessary to synchronize each DOF in time. Therefore firstly I would like to compute trajectory for DOF with the largest displacement and then trying to fit other DOFs in the computed execution time for the former. However I was not able to find anything about generating s-curve profile with given time. Having tried to solve it by myself I came up with a conviction that it is an optimization problem. I tried several approaches but they all seemed to have non-convex cost function and hardly could they satisfy constraints on final velocity. Having spent much time I wondered if there is an easy way to synchronize them?

For parabolic trajectories, the procedure for computing the time-optimal (1D) trajectory exists (see e.g., this paper). So first you can compute 1D velocity profiles for all DOFs and see which DOF takes the most time. Suppose DOF $i$ takes time $T$ to reach its destination, you need to synchronize other DOFs with time $t =T$, because DOF $i$ cannot go any faster.
Then the next step is kind of velocity profile stretching, i.e., for each DOF $j \neq i$ we stretch the velocity profile such that it has duration $t$ as specified earlier. For this steps, many heuristics can be used. One of them is described in the paper I mentioned above (this method is somewhat constrained due to some assumptions made in the paper). Another one is implemented in OpenRAVE, see this file (the detail of the method implemented was given alongside of the code, this method is less constrained than the first).
Note that given a duration $t$ to synchronize a trajectory with, the problem is not always feasible due to inoperative time interval (this paper mentioned this topic a bit). Basically, due to velocity and acceleration limits of the robot joints, given a set of boundary conditions (such as initial and final velocities), there might exists some time interval $\tau = [t_0, t_1]$ such that there exists no trajectory which satisfies the boundary conditions and has a duration $t \in \tau$.