Nikolay-Kha / PyCNC

Python CNC machine controller for Raspberry Pi and other ARM Linux boards

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible miscalculation in "_to_accelerated_time" function?

Beshtia opened this issue · comments

Hi Nikolay

Great work on this project!

I was looking through the code and trying to understand it, particularly regarding the interpolation and control part. I was going through the "_to_accelerated_time" and something seemed off when I saw that the "_2Vmax_per_a" parameter was calculated only for one axis but used for all of them. This is being done in the "iter" function:

self._2Vmax_per_a = (2.0 * max_axis_velocity_mm_per_sec.find_max()
                             / STEPPER_MAX_ACCELERATION_MM_PER_S2)

Basically it is only calculated for the axis with the maximum velocity and then applied for each axis separately.
Doesn't it mean that the "_to_accelerated_time" function would give incorrect results for all axis except the one with the maximum velocity?
I might be wrong about this, so please do correct me if I am wrong.
A possible solution would be to have 3 values about the "_Vmax_per_a" parameter:

self._2Vmax_per_a = (2.0 * max_axis_velocity_mm_per_sec
                             / STEPPER_MAX_ACCELERATION_MM_PER_S2)

and then using the exact value for the appropriate axis in the "_to_accelerated_time" function.