Time-optimal dynamic path inversion for an automatic guided vehicle