# Naive ping-pong motion timing

The “ping-pong” in the title is catchy but a misnomer. The following derives the travel time across a line segment with max speed and acceleration. Starting from one of the endpoints and reversing direction at the opposite produces ping-pong-esque motion when repeated, hence the title.

Note: Assumes max speed is actually reached but is easily adapted otherwise

(0) This was derived from my `$DAY_JOB`

^{1} so let’s use real values to motivate the example

```
D := 1 m = 1000 mm
V := 100 mm/sec = 6000 mm/min
A := 50 mm/sec^2
N := 1000 segments
```

(1) Our total time is then acceleration/deceleration plus max speed time. The former are the same since we’re going from 0 => max speed or max speed => 0.

```
T = N * (T_accel + T_cruise + T_decel)
= N * (2*T_accel + T_cruise)
```

(2) Time spent accelerating (or decelerating) from standard equations of motion

```
v = a*t + v_0
t = (v - v_0)/a
```

(3) Acceleration distance, plugging in (2) and assuming `v_0 = 0`

```
d = v_0*t + 1/2*a*t^2
= 1/2*a*(v/a)^2
= v^2 / 2*a
```

(4) Non acceleration, max speed time

```
v = (d - d_0)/t
t = (d - d_0)/v
```

(5) Plugging double (3) as `d_0`

```
t = (d - 2 * (v^2 / 2*a)) / v
= (d - v^2/a) / v
= d/v - v/a
```

(6) Plugging (2) and (5) into (1)

```
T = N * (2*(v/a) + d/v-v/a)
= N * (v/a + d/v)
```

Solving (6) explicitly with (0)

```
T = 1000 * ((100mm/s)/(50mm/s^2) + (1000mm)/(100mm/s))
= 1000 * (2s + 10s)
= 12000s
= 200min
```

- We make 3D CNC carving machines and the design software for them. I was improving our time estimates to better align with the physics of the motion control. If you’re interested in such things we’re hiring
^{[return]}