fake it!
Think of rotation and rotational velocity as a linear timeline
you want to go from 0 to X
you want 1st derivatives to be 0 at the endpoints and continuous
You want the 2nd derivatives to be either 1 or 0 or -1 (thrust on or thrust off, this can be tweaked if you aren't getting desirable results)
so the graph looks like this
|
|
|----o
|----•----o----t
| •----
|
|
atotal velocity needs to be 0 by the end, so the first chunk and the last chunk need to be the same length [we'll call this a, and the middle chunk will be b]
total displacement needs to be θ
velocity will look like a trapezoid
area of that trapezoid will be:
1/2 a * a + [1/2 a * a] * b + 1/2 a * a = θ
= a*a+1/2a*a*b = θ
= a*a*(1+1/2*b) = θ
also remember
a + b + a = θ
2a+b = θ
solve for a and b (multiple solutions) and you're good.
2a+b = a*a+1/2*a*a*b
4a+2b=2a*a+a*a*b
4a-2a*a+a*a*b=2b
b = θ-2a
4a-(2a*a+a*a*(θ-2a)=2(θ-2a)
4a-2a*a-a*a*(θ-2a)-2*(θ-2a) = 0
4a-2a*a-θa*a+2a*a*a-2θ+4a = 0
2a^3 - [2+θ]a^2 + 8a - 2θ = 0
*wolfram alpha*
If i were you I'd fake it, and just do a = (θ - targetθ)/C, you might oscillate at the end a little but enough friction and you won't notice