Off Topic Hobbies > Mechanical Engineering

[Math] CNC tool path generation from point A to point B


As the title suggests, what is a good tool path generation algorithm for moving from point A at PA(x, y) with velocity VA(x, y) to point B at PB(x, y) with velocity VB(x, y)?

Naively, one may think just find the acceleration A(x, y) so that by the time the object reaches PB(x, y), the velocity reaches VB(x, y).

However, this does not work all the time, as in the real world the system has a maximum motor winding current, thus a maximum force, thus a maximum acceleration, so the acceleration must be capped at Amax.

Furthermore, for power supply stability reasons, I would prefer the acceleration to be kept constant at +-Amax or zero, so for each axis, only 3 possible acceleration values can be used, +Amax, 0 or -Amax.

Given the constraints, what is a good strategy for this problem?

I do have a naive solution that I will post later, but I'd like to know if there are other solutions.



You have a trajectory generator that puts out a series of points from the beginning to the end of the move, calculating the number of intermediate points needed to get the desired velocity.

Then, you have a PID calculation that compares actual position to commanded, and figures out what to do with the motor to minimize following error.

Have a look at LinuxCNC, this has all been worked out 25 years ago.


Limiting yourself to +- Amax or zero acceleration is generally a bad idea.
The transitions release energy that is stored in the flex of the moving parts which will then ring.
If you want more information on this, look up "jerk". It's the third time derivative of position, after velocity and acceleration.


[0] Message Index

There was an error while thanking
Go to full version