Hi
I made a camera slider with stepper (programmed in Arduino ) implementing different usage scenario's.
(camera moving for video, stepping for focusstack shots and timelapse, etc)
Implementing acceleration/deceleration of the slider during a timelapse is causing me headache though and it looks like I'm stuck..
Until now I was not able to find the correct algorithm to calculate the number of pictures to take during acceleration and the constant move part.
The number of exposures is fixed.
The distance in which the acceleration/deceleration is taking place is also fixed. This is also true for the total slider distance.
In timelapse acceleration/speed of the slider is accomplished by varying the distance between each shot/frame and not the speed in which the slider actually moves.
In this example I forget the deceleration part. So: use incrementing distance between shots in the first part and then continues using a fixed interval distance until the slider end is reached.
WHITHOUT ACCELERATION (ONLY A CONSTANT SPEED/MOVE )
amount of frames (shots) 70
total distance 40cm => 32400 steps (believe me.. )
algorithm:
frame interval distance 32400 / 71 = 456steps
nofShotsAccel= 0
nofShotsConst= 70
make shot
move slider 456 steps
wait delay time between shots
repeat until all done.
final shot.
WITH ACCELERATION
My objective is: the slider starts moving slowly until the max speed is reached at 15cm.
We are in a timelapse so the slider first makes little moves and then endup with the
largest move at 15cm, which should also be the constant distance to use until the 40cm is reached.
(no good..) algorithm:
acceleration distance 15cm => 12150 steps
frame interval distance 32400 / 71 = 456steps
nofShotsAccel= 12150/456 = 26
nofShotsConst= 70- 26= 44
make shot
if shotcnt <= 26 dist= CubicEasIn( shotcnt/nofShotsAccel) * 12150
else dist= 456 steps
move slider dist steps
delay until time between shots elapse
repeat until all done.
final shot.
The big problem here is:
Acceleration starts with little moves and then accelerates until the distance is reached. Because of using little steps at the beginning bigger steps at the end of the acceleration are needed.
And of course they will exceed the constant step size used after the acceleration (456steps) to compensate the steps which are smaller.
In the final clip this will result in a nice start but ending at a very fast and then will drop to the slower constant distance after the accelerating part.
All distances during acceleration should always be smaller than the constant stepsize.
The only way to accomplish this is making more frames during the acceleration part. (=>more smaller steps until 15cm is reached)
Because the total amount of frames is fixed (70) and more shots are needed during acceleration less shots will be taken during the constant move (40-15cm).
But this implies a bigger constant distance... So this distance depends on the number of shots taken during acceleration. The number of shots used during acceleration depends on this distance though...
There just has to be an algorithm to find the optimum but I couldn't find it yet.
So the question is:
how to calculate the number of shots to take during acceleration in such way it's max interval distance will never exceed the interval distance during the constant move cycle.
Of course I also have to deal with a deceleration part which start at the end of constant move/speed part
Anyone is able to put me in the correct direction..?
In CubicEasIn( t ) t is 0..1 and will generate an accelerating multiplication factor 0..1 corresponding the frame taken.
So it starts at distance (012150) and ends at it's max (112150)