Skip to content

mc_arc(): G93 (inverse time) arcs run at F × segments mm/min - their time depends on the radius and $12, not on F #1030

Open

Description

@yiivon

In inverse time mode (G93) F means "complete the move in 1/F minutes". For lines the planner gets this right (programmed_rate = F * millimeters). Arcs do not: mc_arc() turns the inverse-time F into an absolute feed rate by multiplying it by the number of segments instead of the arc's length in mm:

// motion_control.c, mc_arc() - the same in master (451a539)
if (pl_data->condition.inverse_time) {
    pl_data->feed_rate *= segments;
    pl_data->condition.inverse_time = Off; // Force as feed absolute mode over arc segments.
}

Every segment then runs at F × N mm/min, so an arc of length L takes L / (F·N) minutes: the programmed time 1/F multiplied by the chord length in mm. The chord length depends on the radius and $12 (about 2·sqrt(2·r·$12)), so small arcs run too fast and arcs whose chords are longer than 1 mm (r above ~125 mm at the default $12 = 0.002) run too slow. F itself only scales the result.

Reproduction with the upstream Simulator (91eda77, core d7aaee3, default settings, -t 0 -r 0.001, time taken from the step file), each move alone after G21 G90 G17 G94 / G0 X0 Y0 Z0:

move programmed time measured
G93 G1 X31.416 F3 (line) 20 s 20.04 s
G93 G2 X0 Y0 I0 J-5 F3 (full circle, r = 5) 20 s 6.09 s
G93 G2 X0 Y0 I0 J-1 F3 (full circle, r = 1) 20 s 2.68 s
G93 G2 X0 Y0 I0 J-100 F0.25 (full circle, r = 100) 240 s 304.08 s

(r = 100: 496 chords of 1.265 mm, and 1.265 × 240 s = 304 s.)

Proposed fix: multiply by the arc's length, as the planner does for lines. For N_AXIS == 3:

         if (pl_data->condition.inverse_time) {
-            pl_data->feed_rate *= segments;
+            pl_data->feed_rate *= hypotf(angular_travel * radius, target[plane.axis_linear] - position[plane.axis_linear]);
             pl_data->condition.inverse_time = Off; // Force as feed absolute mode over arc segments.
         }

With it the same Simulator runs the three circles in 20.03 s, 19.84 s and 240.12 s (the line is unchanged). With N_AXIS > 3 the travel of the other linear axes would belong in the length as well.

Arcs with more than one turn (P > 1) are not covered by that line. The full turns are made by recursive mc_arc() calls that share pl_data: the first turn converts the feed and clears inverse_time, so the following turns and the remaining arc keep the first turn's rate, and the 1/F minutes are never spread over the whole move. Converting once before the recursion, with the length of the whole move (all turns and the helical travel), would cover both cases. I have not tested this part.

Found while checking program run times in a digital twin of a small mill that runs the unmodified core.

Activity

  1. terjeio commented on Oct 4, 2026

    @terjeio
    Contributor

    Good catch, I have also removed the P > 1 recursion - it was there to catch potential single precision float issues.
    Use of A, B, ... axes with arcs is unlikely/not common so decided not to bother.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions