I'm trying to mimic the pan behavior of a DMX moving head so that I can simulate it as closely as possible. A straightforward acceleration/deceleration algorithm doesn't work, even after repeated trial & error with the parameters and there's always something off about the acceleration, deceleration or both.
So I tried measuring the acceleration curve. I set up a camera and prepared the moving head to rotate within its field of view: -170.5° to -20.12° (the weird values are because I'm converting from DMX values in range 0-255). The input change is a sudden one, so all of the movement speed comes from the mover itself. On the wall I taped six Xs to divide the trajectory into fifths and recorded the trajectory. By recording it together with a frame counter, I was able to get the amount of frames each fifth of the trajectory took. Converting those to seconds and degrees per second gives:
-170.5° to -140.8°: 0.5667s| 52.4087°/s
-140.8° to -111.2°: 0.15s | 198°/s
-111.2° to -81.53°: 0.1833s| 161.8658°/s
-81.53° to -51.88°: 0.2s | 148.25°/s
-51.88° to -20.12°: 0.7s | 45.3714°/s
Now, I can put all of this data into mycurvefit.com and get a 4th polynomial curve equation, but I'm not sure how to actually implement it. So my questions are
a) How can I calculate the acceleration and deceleration values given these data?
b) How can I apply those forcoes at random short time intervals where all I know is the current rotation, the current speed, and the target rotation keeping in mind that the target rotation can change at any moment?
That paper looks a bit too advanced for me. There seems to be a slerp function in the peculiar software I'm using, so I'll try using that for starters...
– S. Elliot Perez Mar 06 '23 at 11:36