Backlash compensation

edited April 2016 in Questions & Answers
Hi,
tried backlash compensation on threaded rod drive machine fired by due and have a question:
when getting to the turnover point where direction changes machine seems to stop shortly.
clearly visible when printing circles.
if i set backlash to 0 it has normal behavior. Is there a possibility to speed up ?

stopping position is visible in printed part :-(



«1

Comments

  • You see backlash logic in motion.cpp line 206-242.

    As you see all it does is adding a second move on direction change. That also needs 2 free moves to place so it reduces buffer space for travel distance. So all I can think of is that your max. buffer size should be increased to at least 32 to accomodate for extra moves without penalty for path planner, which is especially important in circles which I guess is what you tested.
  • edited May 2016
    buffer size is 40 , also tried 80.
    i do the test with circles , thats right, but on turnover point machine nearly stops.
    if i set backlash values to 0 it runs absolutely smooth.
    as soon as i put a value (in my case i need 0.005mm  to 0.009) it slows down extremely just at turnover point.
    machine step size is 0.00166 mm , so i need 3 to 5 steps.

    is there a change of feedrate in the added moves?
    any idea?
  • No feedrate stays unchanged.

    Does it also happen in a simple case with 2 lines? Then you could add






    #define DEBUG_QUEUE_MOVE

    and enable echo before running. It will out to log the moves and speeds it computes for this. You might need 1-2 pre moves to fill buffer.

  • edited May 2016
    seems to happen illogical
    using cambam gcode with G3 circles everything is ok also circles by G1 lines.

    here´s a snippet from gcode where that slow down happens(extruder is commented, feedrate set to 2400mm/min) :

    Gcode is generated by slic3r , also Cura or S3D makes not a difference

    any value in backlash slows down in turnover point, set values to 0 it runs smooth.
    may be you can check it out , its really strange


    G1 X291.517 Y113.106 F2400;E6.02030 F3600.000
    G1 X291.795 Y114.315 ;E6.08249
    G1 X291.994 Y115.535 ;E6.14451
    G1 X292.113 Y116.763 ;E6.20640
    G1 X292.153 Y118.000 ;E6.26846
    G1 X292.113 Y119.237 ;E6.33051
    G1 X291.994 Y120.465 ;E6.39240
    G1 X291.795 Y121.685 ;E6.45443
    G1 X291.517 Y122.894 ;E6.51661
    G1 X291.165 Y124.072 ;E6.57830
    G1 X290.735 Y125.233 ;E6.64039
    G1 X290.228 Y126.367 ;E6.70270
    G1 X289.657 Y127.452 ;E6.76420
    G1 X289.011 Y128.510 ;E6.82635
    G1 X288.299 Y129.520 ;E6.88834
    G1 X287.524 Y130.483 ;E6.95032
    G1 X286.681 Y131.401 ;E7.01285
    G1 X286.401 Y131.681 ;E7.03272
    G1 X285.479 Y132.528 ;E7.09548
    G1 X284.528 Y133.294 ;E7.15677
    G1 X283.510 Y134.011 ;E7.21922
    G1 X282.452 Y134.657 ;E7.28137
    G1 X281.367 Y135.228 ;E7.34286
    G1 X280.233 Y135.735 ;E7.40518
    G1 X279.072 Y136.165 ;E7.46726
    G1 X277.894 Y136.518 ;E7.52896
    G1 X276.685 Y136.795 ;E7.59114
    G1 X275.465 Y136.994 ;E7.65317
    G1 X274.237 Y137.113 ;E7.71506
    G1 X273.000 Y137.153 ;E7.77711
    G1 X271.763 Y137.113 ;E7.83917
    G1 X270.535 Y136.994 ;E7.90106
    G1 X269.315 Y136.795 ;E7.96308
    G1 X268.106 Y136.518 ;E8.02526
    G1 X266.928 Y136.165 ;E8.08696
    G1 X265.767 Y135.735 ;E8.14905
    G1 X264.633 Y135.228 ;E8.21136
    G1 X263.548 Y134.657 ;E8.27286
    G1 X262.490 Y134.011 ;E8.33501
    G1 X261.472 Y133.294 ;E8.39745
    G1 X260.521 Y132.528 ;E8.45875
    G1 X259.599 Y131.681 ;E8.52150
    G1 X259.319 Y131.401 ;E8.54138
    G1 X258.476 Y130.483 ;E8.60390
    G1 X257.701 Y129.520 ;E8.66588
    G1 X256.989 Y128.510 ;E8.72787
    G1 X256.343 Y127.452 ;E8.79002
    G1 X255.772 Y126.367 ;E8.85152
    G1 X255.265 Y125.233 ;E8.91383
    G1 X254.835 Y124.072 ;E8.97592
    G1 X254.482 Y122.894 ;E9.03761
    G1 X254.205 Y121.685 ;E9.09980
    G1 X254.006 Y120.465 ;E9.16182
    G1 X253.887 Y119.237 ;E9.22371
    G1 X253.847 Y118.000 ;E9.28576
    G1 X253.887 Y116.763 ;E9.34782
    G1 X254.006 Y115.535 ;E9.40971
    G1 X254.205 Y114.315 ;E9.47173
    G1 X254.482 Y113.106 ;E9.53392
    G1 X254.835 Y111.928 ;E9.59561
    G1 X255.265 Y110.767 ;E9.65770
    G1 X255.772 Y109.633 ;E9.72001
    G1 X256.343 Y108.548 ;E9.78151
    G1 X256.989 Y107.490 ;E9.84366
    G1 X257.701 Y106.480 ;E9.90565
    G1 X258.476 Y105.517 ;E9.96763
    G1 X259.319 Y104.599 ;E10.03015
    G1 X259.599 Y104.319 ;E10.05003
    G1 X260.521 Y103.472 ;E10.11278
    G1 X261.472 Y102.706 ;E10.17408
    G1 X262.490 Y101.989 ;E10.23652
    G1 X263.548 Y101.343 ;E10.29868
    G1 X264.633 Y100.772 ;E10.36017
    G1 X265.767 Y100.265 ;E10.42248
    G1 X266.928 Y99.835 ;E10.48457
    G1 X268.106 Y99.482 ;E10.54627
    G1 X269.315 Y99.205 ;E10.60845
    G1 X270.535 Y99.006 ;E10.67044
    G1 X271.765 Y98.887 ;E10.73243
    G1 X273.000 Y98.847 ;E10.79444
    G1 X273.407 Y98.859 ;E10.81483
    G1 X274.235 Y98.887 ;E10.85640
    G1 X275.465 Y99.006 ;E10.91840
    G1 X276.685 Y99.205 ;E10.98039
    G1 X277.890 Y99.482 ;E11.04238
    G1 X279.074 Y99.836 ;E11.10436
    G1 X280.238 Y100.267 ;E11.16663
    G1 X280.609 Y100.428 ;E11.18689
    G1 X281.359 Y100.768 ;E11.22820
    G1 X282.455 Y101.344 ;E11.29033
    G1 X283.517 Y101.993 ;E11.35273
    G1 X283.850 Y102.220 ;E11.37292
    G1 X284.517 Y102.698 ;E11.41410
    G1 X285.483 Y103.476 ;E11.47629
    G1 X286.401 Y104.319 ;E11.53881
    G1 X286.681 Y104.599 ;E11.55869
    G1 X287.528 Y105.521 ;E11.62145
    G1 X288.048 Y106.155 ;E11.66258
    G1 X288.294 Y106.472 ;E11.68275
    G1 X289.011 Y107.490 ;E11.74519
    G1 X289.657 Y108.548 ;E11.80734
    G1 X290.045 Y109.273 ;E11.84860
    G1 X290.228 Y109.633 ;E11.86884
    G1 X290.735 Y110.767 ;E11.93115
    G1 X291.165 Y111.928 ;E11.99324
    G1 X291.387 Y112.660 ;E12.03162
    ;G1 X291.806 Y112.598 F6000.000
    G1 X291.923 Y113.001 F2400;E12.05265 F3600.000
    G1 X292.207 Y114.234 ;E12.11610
    G1 X292.410 Y115.481 ;E12.17947
    G1 X292.532 Y116.737 ;E12.24276
    G1 X292.572 Y118.000 ;E12.30614
    G1 X292.532 Y119.263 ;E12.36953
    G1 X292.410 Y120.519 ;E12.43282
    G1 X292.207 Y121.766 ;E12.49618
    G1 X291.923 Y122.999 ;E12.55964
    G1 X291.562 Y124.206 ;E12.62282
    G1 X291.123 Y125.391 ;E12.68622
    G1 X290.606 Y126.548 ;E12.74975
    G1 X290.021 Y127.661 ;E12.81281
    G1 X289.361 Y128.740 ;E12.87625
    G1 X288.634 Y129.772 ;E12.93959
    G1 X287.842 Y130.756 ;E13.00293
    G1 X286.984 Y131.691 ;E13.06659
    G1 X286.691 Y131.984 ;E13.08736
    G1 X285.754 Y132.844 ;E13.15115
    G1 X284.777 Y133.631 ;E13.21409
    G1 X283.740 Y134.361 ;E13.27770
    G1 X282.661 Y135.021 ;E13.34114
    G1 X281.548 Y135.606 ;E13.40420
    G1 X280.391 Y136.123 ;E13.46773
    G1 X279.206 Y136.562 ;E13.53113
    G1 X277.999 Y136.923 ;E13.59431
    G1 X276.766 Y137.207 ;E13.65777
    G1 X275.519 Y137.410 ;E13.72113
    G1 X274.263 Y137.532 ;E13.78442
    G1 X273.000 Y137.572 ;E13.84781
    G1 X271.737 Y137.532 ;E13.91119
    G1 X270.481 Y137.410 ;E13.97448
    G1 X269.234 Y137.207 ;E14.03785
    G1 X268.001 Y136.923 ;E14.10131
    G1 X266.794 Y136.562 ;E14.16448
    G1 X265.609 Y136.123 ;E14.22788
    G1 X264.452 Y135.606 ;E14.29142
    G1 X263.339 Y135.021 ;E14.35448
    G1 X262.260 Y134.361 ;E14.41791
    G1 X261.223 Y133.631 ;E14.48152
    G1 X260.246 Y132.844 ;E14.54446
    G1 X259.309 Y131.984 ;E14.60825
    G1 X259.016 Y131.691 ;E14.62903
    G1 X258.158 Y130.756 ;E14.69268
    G1 X257.366 Y129.772 ;E14.75602
    G1 X256.639 Y128.740 ;E14.81936
    G1 X255.979 Y127.661 ;E14.88280
    G1 X255.394 Y126.548 ;E14.94586
    G1 X254.877 Y125.391 ;E15.00939
    G1 X254.438 Y124.206 ;E15.07280
    G1 X254.077 Y122.999 ;E15.13597
    G1 X253.793 Y121.766 ;E15.19943
    G1 X253.590 Y120.519 ;E15.26280
    G1 X253.468 Y119.263 ;E15.32609
    G1 X253.428 Y118.000 ;E15.38947
    G1 X253.468 Y116.737 ;E15.45285
    G1 X253.590 Y115.481 ;E15.51614
    G1 X253.793 Y114.234 ;E15.57951
    G1 X254.077 Y113.001 ;E15.64297
    G1 X254.438 Y111.794 ;E15.70614
    G1 X254.877 Y110.609 ;E15.76955
    G1 X255.394 Y109.452 ;E15.83308
    G1 X255.979 Y108.339 ;E15.89614
    G1 X256.639 Y107.260 ;E15.95958
    G1 X257.366 Y106.228 ;E16.02292
    G1 X258.158 Y105.244 ;E16.08626
    G1 X259.016 Y104.309 ;E16.14991
    G1 X259.309 Y104.016 ;E16.17069
    G1 X260.246 Y103.156 ;E16.23448
    G1 X261.223 Y102.369 ;E16.29742
    G1 X262.260 Y101.639 ;E16.36103
    G1 X263.339 Y100.979 ;E16.42447
    G1 X264.452 Y100.394 ;E16.48753
    G1 X265.609 Y99.877 ;E16.55106
    G1 X266.794 Y99.438 ;E16.61446
    G1 X268.001 Y99.077 ;E16.67764
    G1 X269.234 Y98.793 ;E16.74110
    G1 X270.481 Y98.590 ;E16.80444
    G1 X271.738 Y98.468 ;E16.86779
    G1 X273.000 Y98.428 ;E16.93115
    G1 X273.420 Y98.441 ;E16.95222
    G1 X274.262 Y98.468 ;E16.99447
    G1 X275.519 Y98.590 ;E17.05783
    G1 X276.766 Y98.793 ;E17.12117
    G1 X277.997 Y99.076 ;E17.18452
    G1 X279.207 Y99.438 ;E17.24786
    G1 X280.394 Y99.879 ;E17.31137
    G1 X280.778 Y100.045 ;E17.33237
    G1 X281.543 Y100.391 ;E17.37447
    G1 X282.662 Y100.980 ;E17.43790
    G1 X283.744 Y101.641 ;E17.50148
    G1 X284.089 Y101.876 ;E17.52244
    G1 X284.771 Y102.364 ;E17.56447
    G1 X285.756 Y103.158 ;E17.62793
    G1 X286.691 Y104.016 ;E17.69158
    G1 X286.984 Y104.309 ;E17.71236
    G1 X287.844 Y105.246 ;E17.77615
    G1 X288.375 Y105.893 ;E17.81815
    G1 X288.631 Y106.223 ;E17.83910
    G1 X289.361 Y107.260 ;E17.90270
    G1 X290.021 Y108.339 ;E17.96614
    G1 X290.417 Y109.079 ;E18.00822
    G1 X290.606 Y109.452 ;E18.02920
    G1 X291.123 Y110.609 ;E18.09274
    G1 X291.562 Y111.794 ;E18.15614
    G1 X291.789 Y112.541 ;E18.19528










  • Can't say what is so special on that gcode. Looks like 2 circles. Difference might be the direction switch is like a triangle, but I do not find that really special.

    There might be a chance that you have

    REDUCE_ON_SMALL_SEGMENTS

    defined somewhere. That will reduce speed for direction changes based on direction AND segment length. Smaller = Slower, and since backlash is small that might be the reason for a slowdown.

  • didn´t define that, only found it in motion.cpp
    #ifdef REDUCE_ON_SMALL_SEGMENTS   

    what about jerk?  i have jerk 7.0 cannot go higher because my moving table´s weight is around 12Kg.
    if i increase jerk it´s like an earthquake...





    another question regarding circles :

    tried to mill some round pockets diameter 6mm with 3mm flute using G2  , worked but segments are clearly visible.

    i found :
    #define MM_PER_ARC_SEGMENT 1
    #define MM_PER_ARC_SEGMENT_BIG 3

    thats ok for printing but not good enough for milling

    are float numbers allowed?
    so may be 0.1 or smaller?

  • Yes, the number gets converted to float anyway (in case it was integer), that is no problem.

    Regarding jerk you might have seen the experimental defines
    #define ALTERNATIVE_JERK

    should give better behavior. REDUCE_ON_SMALL_SEGMENTS is for cases where you switch direction very fast having a small move between/at end that could cause bigger real jerks if direction changes are too fast in a row. 

    But the slowdown is then still a mystery. No luck on finding a short motion list you could debug with output created using echo as described above?








  • edited May 2016

    Ok,thanks.

    I´ll try to reduce the Gcode above to a part of just one circle to see if that still happens.

    Hope i´ll find the time to investigate next week.


    another finding regarding G-code handling (killed some flutes yesterday):

    Cambam adds some single command line for spindle Speed ,

    for example just like this:

    G1 .....

    S1000

    G0 Z3

    G0 X....


    So the line S1000 is a unknown command but the following G0 Z3 is not executed

    is there a Chance to catch this ?

    I think of something like

     void Commands::processSCode(GCode *com) {

       switch ( com->S) .....


    or just adding  a  if(com->hasS()) to processGCode  before switch ( com->G)


    what would allow to set Spindle Speed or laser intensity without a move.

    should be not hard to implement.

    (easiest would be just to do nothing when detecting the S-line :-)  )




  • S1000 gets ignored. Just run a test 

    S1000
    M117 Hi

    on Repetier-Host with this result:

    10:11:02.865 : N41 M451*22
    10:11:02.865 : N42  S1000*26
    10:11:02.865 : Printjob finished at 19.05.2016 10:11
    10:11:02.865 : Printing Time: 0s
    10:11:02.865 : Lines Send: 5
    10:11:02.890 : N43 M117 Hi*18
    10:11:02.893 : N44 M104 T0 S0*17
    10:11:02.893 : N45 M104 T1 S0*17
    10:11:02.893 : N46 M84*45
    10:11:02.975 : Disabled volumetric extrusion for extruder 0
    10:11:02.975 : Disabled volumetric extrusion for extruder 1
    10:11:02.976 : PrinterMode:FFF
    10:11:02.981 : Unknown command:N42  S1000
    10:11:03.158 : Successfully send push message.

    As you see firmware detected it as unknown command and next line was send.

    What did you use for sending it? Maybe the host/firmware combination makes a difference.

    There is no branch to handle S only commands. We only support G/M/T as command identifier. Everything else gets ignored.
  • sent it by Repetier host,

    Printer mode CNC, and yes, the S1000 was ignored .

    My Problem is , that the move following the S1000 was not executed and this is reproducable.

    didn´t check it with a M117, but i´ll try that

    will post code and log this evening






  • edited May 2016
    Ok, skipping commands just happens in ASCII protocol.

    see snippet from LOG using Ascii protocol:

    17:55:20.874 : N24 M117 ETE 3m 04s *111
    17:55:20.874 : N25 M105 *48
    17:55:20.874 : N26 G1 Y155.5 *111
    17:55:20.874 : N27 G1 X294 *122
    17:55:20.874 : N28 G1 Y144.5 *97
    17:55:20.874 : N29 G1 X280.4 *107
    17:55:20.874 : ok 24
    17:55:20.874 : N30 S1000 *63
    17:55:20.874 : N31 G0 Z3 *114
    17:55:21.342 : ok 25
    17:55:21.342 : ok 26
    17:55:21.342 : ok 27
    17:55:21.342 : ok 28
    17:55:21.342 : N32 M117 ETE 3m 00s *108
    17:55:21.342 : N33 G0 X182.7 Y150 *46
    17:55:21.342 : N34 G0 Z1 *117
    17:55:21.342 : ok 29
    17:55:21.342 : Error:Format error
    17:55:21.342 : Resend:30
    17:55:21.358 : ok
    17:55:21.358 : skip 31
    17:55:21.358 : ok
    17:55:21.358 : Resend: N30 S1000 *63
    17:55:21.358 : Resend: N31 G0 Z3 *114
    17:55:21.358 : Resend: N32 M117 ETE 3m 00s *108
    17:55:21.358 : Resend: N33 G0 X182.7 Y150 *46
    17:55:21.358 : Resend: N34 G0 Z1 *117
    17:55:21.358 : N35 G1 Z-0.4 F300 *22
    17:55:21.358 : skip 32
    17:55:21.358 : ok
    17:55:21.358 : skip 33
    17:55:21.358 : ok
    17:55:21.358 : skip 34
    17:55:21.358 : ok

    with Repetier protocol it´s OK
  • but with repetier protocol i get :

    22:19:07.496 : Error:Checksum required when switching back to ASCII protocol.

    when using buttons assigned to
     
    case UI_ACTION_X_ZERO:
                if(!allowMoves) return UI_ACTION_X_ZERO;
                GCode::executeFString(PSTR("G92 X0\n"));
                break;


  • I see I'm in compatibility vs. error hell.

    I made more strict tests to detect errenous injection of wrong gcode throug communication errors. And now they are firing back. Will check it.
  • i added a handling for S commands, works in repetier protocol,
    but still get format error in ascii protocol...
    cannot see the trap, ist there something wrong in ascii parsing?

    void Commands::processSCode(GCode *com) {
    uint32_t codenum; //throw away variable


    codenum=(com->S) ;
    {
    #if defined(SUPPORT_LASER) && SUPPORT_LASER
    if (Printer::mode == PRINTER_MODE_LASER)
    {
    LaserDriver::intensity = constrain(codenum, 0, 255);
    Com::printFLN(PSTR("Laserint:"), (int)LaserDriver::intensity);
    }
    #endif // defined
    #if defined(SUPPORT_CNC) && SUPPORT_CNC
    if (Printer::mode == PRINTER_MODE_CNC)
    {
    Com::printFLN(PSTR("Spindle s "),(int)codenum);
    }
    #endif // defined
    }
    }

  • edited May 2016
    back to original problem with reducing speed with backlash compensation:
    seems to come from jerk , no improvement with alternative jerk
    as it doesn´t appear with circles generated by Cam program i guess problem is located in
    STL-file with too big segments.
    i´ll try to change my model to smaller segments in CAD and see what happens

    here´s the log:

    10:17:33.216 : N912 G1 X291.517 Y113.106 F2400 *110
    10:17:33.216 : N913 G1 X291.795 Y114.315 *0
    10:17:33.216 : N914 G1 X291.994 Y115.535 *13
    10:17:33.216 : N915 G1 X292.113 Y116.763 *10
    10:17:33.216 : N916 G1 X292.153 Y118 *31
    10:17:33.216 : N917 G1 X292.113 Y119.237 *3
    10:17:33.216 : N918 G1 X291.994 Y120.465 *3
    10:17:33.216 : N919 G1 X291.795 Y121.685 *0
    10:17:33.231 : ID:537350200
    10:17:33.231 : N920 M104 T0 S0 *10
    10:17:33.231 : vStart/End:417/417
    10:17:33.231 : accel/decel steps:1/1/3
    10:17:33.231 : st./end speed:0.7/0.7
    10:17:33.231 : Flags:146
    10:17:33.247 : joinFlags:5
    10:17:33.247 : ID:537350200
    10:17:33.247 : Delta 0 3 0 0
    10:17:33.247 : Dir:36
    10:17:33.247 : Flags:18
    10:17:33.247 : fullSpeed:0.70
    10:17:33.247 : vMax:417
    10:17:33.247 : Acceleration:8.96
    10:17:33.263 : Acceleration Prim:537600
    10:17:33.263 : Remaining steps:3
    10:17:33.263 : LimitInterval:50350
    10:17:33.278 : Move distance on the XYZ space:0.00
    10:17:33.278 : Commanded feedrate:40.00
    10:17:33.294 : Constant full speed move time:151050.00
    10:17:33.294 : ID:537339140
    10:17:33.294 : vStart/End:1921/1921
    10:17:33.294 : accel/decel steps:876/876/6589
    10:17:33.309 : st./end speed:2.5/2.5
    10:17:33.309 : Flags:146
    10:17:33.309 : joinFlags:5
    10:17:33.309 : ID:537339140
    10:17:33.309 : Delta 148 6589 0 0
    10:17:33.309 : Dir:60
    10:17:33.309 : Flags:18
    10:17:33.309 : fullSpeed:40.00
    10:17:33.325 : vMax:30746
    10:17:33.325 : Acceleration:12007.04
    10:17:33.325 : Acceleration Prim:537600
    10:17:33.325 : Remaining steps:6589
    10:17:33.341 : LimitInterval:683
    10:17:33.341 : Move distance on the XYZ space:8.58
    10:17:33.341 : Commanded feedrate:40.00
    10:17:33.356 : Constant full speed move time:4506555.00
    10:17:33.356 : Echo:N912 G1  X291.52 Y113.11 F2400.00
    10:17:33.356 : N921 M104 T1 S0 *10
    10:17:33.356 : N922 M140 S0 *76
    10:17:33.356 : ID:537339280
    10:17:33.372 : vStart/End:167/167
    10:17:33.372 : accel/decel steps:1/1/3
    10:17:33.372 : st./end speed:0.4/0.4
    10:17:33.372 : Flags:146
    10:17:33.387 : joinFlags:5
    10:17:33.387 : ID:537339280
    10:17:33.387 : Delta 2 3 0 0
    10:17:33.387 : Dir:55
    10:17:33.387 : Flags:18
    10:17:33.387 : fullSpeed:0.40
    10:17:33.387 : vMax:168
    10:17:33.403 : Acceleration:17.92
    10:17:33.403 : Acceleration Prim:537600
    10:17:33.403 : Remaining steps:3
    10:17:33.403 : LimitInterval:124381
    10:17:33.419 : Move distance on the XYZ space:0.01
    10:17:33.419 : Commanded feedrate:40.00
    10:17:33.419 : Constant full speed move time:373143.84
    10:17:33.419 : ID:537339420
    10:17:33.434 : vStart/End:1872/1872
    10:17:33.434 : accel/decel steps:464/464/929
    10:17:33.434 : st./end speed:2.5/2.5
    10:17:33.434 : Flags:146
    10:17:33.450 : joinFlags:5
    10:17:33.450 : ID:537339420
    10:17:33.450 : Delta 148 929 0 0
    10:17:33.450 : Dir:63
    10:17:33.450 : Flags:18
    10:17:33.465 : fullSpeed:40.00
    10:17:33.465 : vMax:29957
    10:17:33.465 : Acceleration:1781.72
    10:17:33.465 : Acceleration Prim:537600
    10:17:33.465 : Remaining steps:929
    10:17:33.481 : LimitInterval:701
    10:17:33.481 : Move distance on the XYZ space:1.24
    10:17:33.481 : Commanded feedrate:40.00
    10:17:33.497 : Constant full speed move time:651555.31
    10:17:33.497 : Echo:N913 G1  X291.80 Y114.31
    10:17:33.497 : N923 M84 *55
    10:17:33.497 : N924 M105 *8
    10:17:33.497 : ID:537339420 MJ:40.00
    10:17:33.497 : ID:537339420
    10:17:33.512 : vStart/End:1872/29957
    10:17:33.512 : accel/decel steps:832/1/929
    10:17:33.512 : st./end speed:2.5/40.0
    10:17:33.512 : Flags:146
    10:17:33.528 : joinFlags:7
    10:17:33.528 : ID:537339560
    10:17:33.528 : vStart/End:30345/1896
    10:17:33.528 : accel/decel steps:1/854/937
    10:17:33.543 : st./end speed:40.0/2.5
    10:17:33.543 : Flags:146
    10:17:33.543 : joinFlags:5
    10:17:33.543 : ID:537339560
    10:17:33.543 : Delta 106 937 0 0
    10:17:33.543 : Dir:63
    10:17:33.559 : Flags:18
    10:17:33.559 : fullSpeed:40.00
    10:17:33.559 : vMax:30346
    10:17:33.559 : Acceleration:1751.87
    10:17:33.559 : Acceleration Prim:537600
    10:17:33.575 : Remaining steps:937
    10:17:33.575 : LimitInterval:692
    10:17:33.575 : Move distance on the XYZ space:1.24
    10:17:33.575 : Commanded feedrate:40.00
    10:17:33.590 : Constant full speed move time:648970.68
    10:17:33.590 : Echo:N914 G1  X291.99 Y115.54
    10:17:33.699 : ID:537339700
    10:17:33.699 : vStart/End:1913/1913
    10:17:33.715 : accel/decel steps:471/471/943
    10:17:33.715 : st./end speed:2.5/2.5
    10:17:33.715 : Flags:146
    10:17:33.715 : joinFlags:5
    10:17:33.715 : ID:537339700
    10:17:33.731 : Delta 64 943 0 0
    10:17:33.731 : Dir:63
    10:17:33.731 : Flags:18
    10:17:33.731 : fullSpeed:40.00
    10:17:33.731 : vMax:30612
    10:17:33.731 : Acceleration:1733.28
    10:17:33.746 : Acceleration Prim:537600
    10:17:33.746 : Remaining steps:943
    10:17:33.746 : LimitInterval:686
    10:17:33.746 : Move distance on the XYZ space:1.23
    10:17:33.762 : Commanded feedrate:40.00
    10:17:33.762 : Constant full speed move time:647700.12
    10:17:33.762 : Echo:N915 G1  X292.11 Y116.76
    10:17:33.777 : ID:537339840
    10:17:33.777 : vStart/End:1921/1921
    10:17:33.777 : accel/decel steps:474/474/950
    10:17:33.793 : st./end speed:2.5/2.5
    10:17:33.793 : Flags:146
    10:17:33.793 : joinFlags:5
    10:17:33.793 : ID:537339840
    10:17:33.793 : Delta 21 950 0 0
    10:17:33.793 : Dir:63
    10:17:33.793 : Flags:18
    10:17:33.809 : fullSpeed:40.00
    10:17:33.809 : vMax:30746
    10:17:33.809 : Acceleration:1731.14
    10:17:33.809 : Acceleration Prim:537600
    10:17:33.824 : Remaining steps:950
    10:17:33.824 : LimitInterval:683
    10:17:33.824 : Move distance on the XYZ space:1.24
    10:17:33.840 : Commanded feedrate:40.00
    10:17:33.840 : Constant full speed move time:649743.06
    10:17:33.840 : Echo:N916 G1  X292.15 Y118.00
    10:17:33.840 : ID:537339980
    10:17:33.855 : vStart/End:112/112
    10:17:33.855 : accel/decel steps:0/0/2
    10:17:33.855 : st./end speed:0.3/0.3
    10:17:33.855 : Flags:146
    10:17:33.871 : joinFlags:5
    10:17:33.871 : ID:537339980
    10:17:33.871 : Delta 2 0 0 0
    10:17:33.871 : Dir:22
    10:17:33.871 : Flags:18
    10:17:33.871 : fullSpeed:0.28
    10:17:33.871 : vMax:112
    10:17:33.887 : Acceleration:9.33
    10:17:33.887 : Acceleration Prim:373333
    10:17:33.887 : Remaining steps:2
    10:17:33.887 : LimitInterval:186843
    10:17:33.902 : Move distance on the XYZ space:0.00
    10:17:33.902 : Commanded feedrate:40.00
    10:17:33.902 : Constant full speed move time:373687.50
    10:17:33.918 : ID:537340120
    10:17:33.918 : vStart/End:1921/1921
    10:17:33.918 : accel/decel steps:474/474/950
    10:17:33.918 : st./end speed:2.5/2.5
    10:17:33.918 : Flags:146
    10:17:33.933 : joinFlags:5
    10:17:33.933 : ID:537340120
    10:17:33.933 : Delta 21 950 0 0
    10:17:33.933 : Dir:62
    10:17:33.933 : Flags:18
    10:17:33.949 : fullSpeed:40.00
    10:17:33.949 : vMax:30746
    10:17:33.949 : Acceleration:1731.14
    10:17:33.949 : Acceleration Prim:537600
    10:17:33.949 : Remaining steps:950
    10:17:33.965 : LimitInterval:683
    10:17:33.965 : Move distance on the XYZ space:1.24
    10:17:33.965 : Commanded feedrate:40.00
    10:17:33.980 : Constant full speed move time:649743.06
    10:17:33.980 : Echo:N917 G1  X292.11 Y119.24
    10:17:33.980 : ID:537340260
    10:17:33.996 : vStart/End:1913/1913
    10:17:33.996 : accel/decel steps:471/471/943
    10:17:33.996 : st./end speed:2.5/2.5
    10:17:33.996 : Flags:146
    10:17:33.996 : joinFlags:5
    10:17:33.996 : ID:537340260
    10:17:34.011 : Delta 64 943 0 0
    10:17:34.011 : Dir:62
    10:17:34.011 : Flags:18
    10:17:34.011 : fullSpeed:40.00
    10:17:34.011 : vMax:30612
    10:17:34.027 : Acceleration:1733.28
    10:17:34.027 : Acceleration Prim:537600
    10:17:34.027 : Remaining steps:943
    10:17:34.027 : LimitInterval:686
    10:17:34.043 : Move distance on the XYZ space:1.23
    10:17:34.043 : Commanded feedrate:40.00
    10:17:34.043 : Constant full speed move time:647700.12
    10:17:34.058 : Echo:N918 G1  X291.99 Y120.46
    10:17:34.058 : ID:537340400
    10:17:34.058 : vStart/End:1896/1896
    10:17:34.074 : accel/decel steps:468/468/937
    10:17:34.074 : st./end speed:2.5/2.5
    10:17:34.074 : Flags:146
    10:17:34.074 : joinFlags:5
    10:17:34.074 : ID:537340400
    10:17:34.074 : Delta 106 937 0 0
    10:17:34.074 : Dir:62
    10:17:34.089 : Flags:18
    10:17:34.089 : fullSpeed:40.00
    10:17:34.089 : vMax:30346
    10:17:34.089 : Acceleration:1751.87
    10:17:34.089 : Acceleration Prim:537600
    10:17:34.105 : Remaining steps:937
    10:17:34.105 : LimitInterval:692
    10:17:34.105 : Move distance on the XYZ space:1.24
    10:17:34.121 : Commanded feedrate:40.00
    10:17:34.121 : Constant full speed move time:648970.68
    10:17:34.136 : Echo:N919 G1  X291.80 Y121.68

  • edited May 2016
    update : Stl changed to very small segments, still same behavior

    Speed changed to st./end speed:0.3/0.3 in turnover points
  • Any idea what 0.3 is? If I'm right your jerk is 5 resulting in 2.5 mm start/end speed.
    Commanded speed is is 40mm/s so no need to go lower. safeSpeed would be 2.5 so if anything puts it down it must be computeMaxJunctionSpeed() function returning lower. So adding a print here with id might show if that is the case and then it should be easy to find the formula causing it.

    I have just released a new development version where I fixed the communication error you had plus some other improvements. It also simplifies now minimum speed handling. Most of the code has been removed as I now check in bresenham for it allowing nearly any speed you want. Was a problem with CNC/laser sometimes that minimum speed forced higher speeds as wanted.








  • 0.3 in my setup is z-jerk, will change it to see if value in log also changes.
    also will try the development release tomorrow.


  • edited May 2016
    youre right, happens in computeMaxJunctionSpeed()
    i added some prints, found it happens here:

       float jerk = sqrt(dx * dx + dy * dy) * lengthFactor;
        Com::printFLN(PSTR("jerk "),(int)(jerk*100));
    #endif // ALTERNATIVE_JERK
    #endif // DELTA
        if(jerk > Printer::maxJerk) {
            {factor = Printer::maxJerk / jerk; // always < 1.0!
            Com::printFLN(PSTR("jerk>pJerk "),(int)(factor*100));}
            if(factor * maxJoinSpeed * 2.0 < Printer::maxJerk)  
              {factor = Printer::maxJerk  / (2.0 * maxJoinSpeed);
           Com::printFLN(PSTR(" factor<pjerk "),(int)(factor*100));}
        }
    ......
       previous->maxJunctionSpeed = maxJoinSpeed * factor; // set speed limit
        Com::printFLN(PSTR("speed limit"),previous->maxJunctionSpeed);



    so Log says :
    23:50:47.729 : jerk 257 //2.57
    23:50:47.729 : N56 G1 X265.767 Y135.735 *59
    23:50:47.729 : speed limit40.00
    23:50:47.729 : ok 49
    23:50:47.729 : N57 G1 X264.633 Y135.228 *50
    23:50:47.729 : jerk 254 //2.54
    23:50:47.729 : speed limit40.00
    23:50:47.729 : ok 50
    23:50:47.729 : jerk 258 //2.58
    23:50:47.745 : N58 G1 X263.548 Y134.657 *56
    23:50:47.745 : speed limit40.00
    23:50:47.745 : ok 51
    23:50:47.745 : jerk 5563 //55.63
    23:50:47.745 : jerk>pJerk 8 //0.08
    23:50:47.745 : N59 G1 X262.49 Y134.011 *8
    23:50:47.745 : speed limit3.59
    23:50:47.745 : jerk 5748 //57.48
    23:50:47.745 : jerk>pJerk 8 //0.08
    23:50:47.760 : speed limit3.48
    23:50:47.760 : ok 52
    23:50:47.760 : jerk 258 //2.58
    23:50:47.760 : N60 G1 X261.472 Y133.294 *53
    23:50:47.760 : speed limit40.00
    23:50:47.760 : ok 53
    23:50:47.760 : N61 G1 X260.521 Y132.528 *51


    values are *100 correct ones in comments

    so it seems backlash compensation causes high jerk values .
    do you have any idea how to solve this?
  • The only way I see is if you have reduce on small segments enabled

    #ifdef REDUCE_ON_SMALL_SEGMENTS
    if(previous->distance < MAX_JERK_DISTANCE)
    lengthFactor = static_cast<float>(MAX_JERK_DISTANCE * MAX_JERK_DISTANCE) / (previous->distance * previous->distance);
    #endif

    That can lead to high lengthFactors. While some reduction is wanted I guess this is simply too much. But assuming your correction is 0.02mm and MAX_JERK_DISTANCE 0.6 (not sure what it is) your factor becomes 900 which is a quite big and causes a big reduction as you see. Witout it jerk would be quite low. Only thing is how to reduce correctly without loosing the reason for it. So smaller segments should reduce jerk but limited somehow.


  • ok, but REDUCE_ON_SMALL_SEGMENTS is for shure not active.
    anyway, as backlash on my machine is just 5 micron i´ll disable correction for printing.
    for milling and laser i´ll activate it.

    does  backlash compensation generate separate moves instead or add the backlash steps to existing move?
  • Could you write out dx,dy and lengthFactor as well? If you did not have it on it must give lengthFactor = 1, but then I wonder what dx/dy contain that sqrt of them is such a large number.

    Backlash adds a additional move before the move changing direction. In your example it was just 2 steps in x direction.
  • Ok,
    changed prints:

       float dx = current->speedX - previous->speedX;
        float dy = current->speedY - previous->speedY;
        float jerk = sqrt(dx * dx + dy * dy) * lengthFactor;
         Com::printFLN(PSTR("dx "),(int)(dx*100));
         Com::printFLN(PSTR("dy "),(int)(dy*100));
         Com::printFLN(PSTR("jerk "),(int)(jerk*100));
         Com::printFLN(PSTR("LF "),(int)(lengthFactor*100));
    #endif // ALTERNATIVE_JERK
    #endif // DELTA
        if(jerk > Printer::maxJerk) {
            {factor = Printer::maxJerk / jerk; // always < 1.0!
            Com::printFLN(PSTR("Printermax "),(int)(Printer::maxJerk*100) );
            Com::printFLN(PSTR("jerk>pJerk "),(int)(factor*100));}
            if(factor * maxJoinSpeed * 2.0 < Printer::maxJerk)  
              {factor = Printer::maxJerk  / (2.0 * maxJoinSpeed);
           Com::printFLN(PSTR(" factor<pjerk "),(int)(factor*100));}
        }
    .......
      previous->maxJunctionSpeed = maxJoinSpeed * factor; // set speed limit
        Com::printFLN(PSTR("speed limit"),previous->maxJunctionSpeed);


    as before factors are *100

    so you see lengthFactor is 1.00 everyhere.
    i wonder about that huge dx/dy numbers.


    22:14:42.034 : N427 G1 X291.517 Y113.106 F2400 *101
    22:14:42.034 : N428 G1 X291.795 Y114.315 *5
    22:14:42.034 : N429 G1 X291.994 Y115.535 *14
    22:14:42.034 : N430 G1 X292.113 Y116.763 *0
    22:14:42.034 : N431 G1 X292.153 Y118 *23
    22:14:42.034 : N432 G1 X292.113 Y119.237 *9
    22:14:42.034 : N433 G1 X291.994 Y120.465 *7
    22:14:42.034 : N434 G1 X291.795 Y121.685 *2
    22:14:42.034 : ok 427
    22:14:42.034 : ok 428
    22:14:42.034 : dx -2835
    22:14:42.034 : N435 G1 X291.517 Y122.894 *6
    22:14:42.034 : N436 G1 X291.165 Y124.072 *2
    22:14:42.034 : dy 2454  //24.54
    22:14:42.034 : jerk 3750 //37.50
    22:14:42.034 : LF 100 //1.00
    22:14:42.050 : Printermax 500 //5.00
    22:14:42.050 : jerk>pJerk 13 //0.13
    22:14:42.050 : speed limit5.33
    22:14:42.050 : ok 429
    22:14:42.050 : dx -251 //-2.51
    22:14:42.050 : dy 49 //0.49
    22:14:42.050 : N437 G1 X290.735 Y125.233 *7
    22:14:42.065 : jerk 256 //2.56
    22:14:42.065 : LF 100 //1.00
    22:14:42.065 : speed limit40.00
    22:14:42.065 : ok 430
    22:14:42.065 : N438 G1 X290.228 Y126.367 *2
    22:14:42.065 : dx -254 //-2.54
    22:14:42.065 : dy 33 //0.33
    22:14:42.065 : jerk 256 //2.56
    22:14:42.065 : LF 100 //1.00
    22:14:42.081 : speed limit40.00
    22:14:42.081 : ok 431
    22:14:42.081 : dx -261 //-2.61
    22:14:42.081 : N439 G1 X289.657 Y127.452 *7
    22:14:42.081 : dy 16 //0.16
    22:14:42.081 : jerk 262 //2.62
    22:14:42.081 : LF 100 //1.00
    22:14:42.081 : speed limit40.00
    22:14:42.081 : ok 432
    22:14:42.081 : N440 G1 X289.011 Y128.51 *53
    22:14:42.081 : dx -44 //-.44
    22:14:42.081 : dy -3997 //-39.97
    22:14:42.096 : jerk 3998 //39.98
    22:14:42.096 : LF 100 //1.00
    22:14:42.096 : Printermax 500 //5.00
    22:14:42.096 : jerk>pJerk 12 //0.12
    22:14:42.096 : factor<pjerk 300 //3.00
    22:14:42.096 : speed limit2.50
    22:14:42.096 : dx -210 //-2.10
    22:14:42.112 : dy 3997 //39.97
    22:14:42.112 : jerk 4003 //40.03
    22:14:42.112 : LF 100 //1.00
    22:14:42.112 : Printermax 500 //5.00
    22:14:42.112 : jerk>pJerk 12 //0.12
    22:14:42.112 : factor<pjerk 300 //3.00
    22:14:42.112 : speed limit2.50
    22:14:42.128 : ok 433
    22:14:42.128 : dx -261 //-2.61
    22:14:42.128 : dy -16  //-0.16
    22:14:42.128 : jerk 262 //2.62
    22:14:42.128 : LF 100 //1.00
    22:14:42.128 : speed limit40.00
    22:14:42.128 : ok 434
    22:14:42.128 : N441 M117 ETE 00s *34
    22:14:42.143 : dx -254
    22:14:42.143 : dy -33
    22:14:42.143 : jerk 256
    22:14:42.143 : LF 100
    22:14:42.143 : speed limit40.00
    22:14:42.143 : ok 435
    22:14:42.143 : dx -251
    22:14:42.143 : dy -49
    22:14:42.143 : N442 G1 X288.299 Y129.52 *54
    22:14:42.143 : jerk 256
    22:14:42.143 : LF 100
    22:14:42.159 : speed limit40.00
    22:14:42.159 : ok 436
    22:14:42.159 : N443 G1 X287.524 Y130.483 *9
    22:14:42.159 : dx -253
    22:14:42.159 : dy -66
    22:14:42.159 : jerk 261
    22:14:42.159 : LF 100
    22:14:42.159 : speed limit40.00
    22:14:42.159 : ok 437
    22:14:42.159 : dx -239
    22:14:42.159 : N444 G1 X286.681 Y131.401 *8
    22:14:42.174 : dy -80
    22:14:42.174 : jerk 252
    22:14:42.174 : LF 100
    22:14:42.174 : speed limit40.00
    22:14:42.174 : ok 438
    22:14:42.174 : N445 G1 X286.401 Y131.681 *9
    22:14:42.174 : dx -248
    22:14:42.174 : dy -101
    22:14:42.174 : jerk 268
    22:14:42.174 : LF 100
    22:14:42.190 : speed limit40.00
    22:14:42.190 : ok 439
    22:14:42.190 : dx -225
    22:14:42.190 : N446 G1 X285.479 Y132.528 *5
    22:14:42.190 : dy -109
    22:14:42.190 : jerk 250
    22:14:42.190 : LF 100
    22:14:42.190 : speed limit40.00
    22:14:42.190 : ok 440
    22:14:42.190 : dx -224
    22:14:42.190 : dy -127
    22:14:42.190 : N447 G1 X284.528 Y133.294 *1
    22:14:42.206 : jerk 258
    22:14:42.206 : LF 100
    22:14:42.206 : speed limit40.00
    22:14:42.206 : ok 441
    22:14:42.206 : N448 G1 X283.51 Y134.011 *58
    22:14:42.206 : N449 G1 X282.452 Y134.657 *9
    22:14:42.315 : ok 442
    22:14:42.315 : N450 G1 X281.367 Y135.228 *14
    22:14:42.315 : dx -221
    22:14:42.315 : dy -145
    22:14:42.315 : jerk 265
    22:14:42.315 : LF 100
    22:14:42.330 : speed limit40.00
    22:14:42.330 : ok 443
    22:14:42.330 : dx -198
    22:14:42.330 : N451 G1 X280.233 Y135.735 *7
    22:14:42.330 : dy -149
    22:14:42.330 : jerk 248
    22:14:42.330 : LF 100
    22:14:42.330 : speed limit40.00
    22:14:42.330 : ok 444
    22:14:42.330 : dx -197
    22:14:42.330 : dy -169
    22:14:42.330 : N452 G1 X279.072 Y136.165 *5
    22:14:42.346 : jerk 260
    22:14:42.346 : LF 100
    22:14:42.346 : speed limit40.00
    22:14:42.346 : ok 445
    22:14:42.346 : N453 G1 X277.894 Y136.518 *4
    22:14:42.346 : dx -44
    22:14:42.346 : dy -212
    22:14:42.346 : jerk 217
    22:14:42.346 : LF 100
    22:14:42.346 : speed limit38.78
    22:14:42.362 : ok 446
    22:14:42.362 : dx -197
    22:14:42.362 : N454 G1 X276.685 Y136.795 *11
    22:14:42.362 : dy -29
    22:14:42.362 : jerk 199
    22:14:42.362 : LF 100
    22:14:42.362 : speed limit38.78
    22:14:42.362 : ok 447
    22:14:42.362 : N455 G1 X275.465 Y136.994 *10
    22:14:42.362 : dx -169
    22:14:42.362 : dy -197
    22:14:42.377 : jerk 260
    22:14:42.377 : LF 100
    22:14:42.377 : speed limit40.00
    22:14:42.377 : ok 448
    22:14:42.377 : dx -156
    22:14:42.377 : N456 G1 X274.237 Y137.113 *15
    22:14:42.377 : dy -207
    22:14:42.377 : jerk 260
    22:14:42.393 : LF 100
    22:14:42.393 : speed limit40.00
    22:14:42.393 : ok 449
    22:14:42.393 : dx -140
    22:14:42.393 : dy -213
    22:14:42.393 : N457 G1 X273 Y137.153 *21
    22:14:42.393 : jerk 255
    22:14:42.393 : LF 100
    22:14:42.393 : speed limit40.00
    22:14:42.393 : ok 450
    22:14:42.393 : N458 G1 X271.763 Y137.113 *0
    22:14:42.408 : dx -129
    22:14:42.408 : dy -227
    22:14:42.408 : jerk 261
    22:14:42.408 : LF 100
    22:14:42.408 : speed limit40.00
    22:14:42.408 : ok 451
    22:14:42.408 : dx -110
    22:14:42.408 : N459 G1 X270.535 Y136.994 *7
    22:14:42.408 : dy -227
    22:14:42.408 : jerk 252
    22:14:42.408 : LF 100
    22:14:42.424 : speed limit40.00
    22:14:42.424 : ok 452
    22:14:42.424 : dx -99
    22:14:42.424 : dy -242
    22:14:42.424 : N460 G1 X269.315 Y136.795 *14
    22:14:42.424 : jerk 262
    22:14:42.424 : LF 100
    22:14:42.424 : speed limit40.00
    22:14:42.533 : ok 453
    22:14:42.533 : dx -81
    22:14:42.533 : N461 G1 X268.106 Y136.518 *9
    22:14:42.533 : dy -242
    22:14:42.549 : jerk 255
    22:14:42.549 : LF 100
    22:14:42.549 : speed limit40.00
    22:14:42.549 : ok 454
    22:14:42.549 : N462 G1 X266.928 Y136.165 *14
    22:14:42.549 : dx -67
    22:14:42.549 : dy -254
    22:14:42.549 : jerk 262
    22:14:42.549 : LF 100
    22:14:42.564 : speed limit40.00
    22:14:42.564 : ok 455
    22:14:42.564 : dx -49
    22:14:42.564 : Druck fertig gestellt am 23.05.2016 22:14
    22:14:42.564 : Druckzeit: 0s
    22:14:42.564 : Gesendete Zeilen: 36
    22:14:42.564 : dy -252
    22:14:42.564 : jerk 257
    22:14:42.564 : LF 100
    22:14:42.564 : speed limit40.00
    22:14:42.564 : N463 G1 X265.767 Y135.735 *9
    22:14:42.564 : ok 456
    22:14:42.564 : dx -32
    22:14:42.564 : dy -252
    22:14:42.564 : N464 M104 T0 S0 *7
    22:14:42.580 : jerk 254
    22:14:42.580 : LF 100
    22:14:42.580 : speed limit40.00
    22:14:42.580 : ok 457
    22:14:42.580 : dx -16
    22:14:42.580 : dy -257
    22:14:42.580 : jerk 258
    22:14:42.580 : N465 M104 T1 S0 *7
    22:14:42.580 : N466 M140 S0 *65
    22:14:42.580 : LF 100
    22:14:42.580 : speed limit40.00
    22:14:42.596 : ok 458
    22:14:42.596 : dx 3997
    22:14:42.596 : N467 M84 *58
    22:14:42.596 : dy 3869
    22:14:42.596 : jerk 5563
    22:14:42.596 : LF 100
    22:14:42.596 : Printermax 500
    22:14:42.596 : jerk>pJerk 8
    22:14:42.596 : speed limit3.59
    22:14:42.611 : dx -3997
    22:14:42.611 : dy -4130
    22:14:42.611 : jerk 5748
    22:14:42.611 : LF 100
    22:14:42.611 : Printermax 500
    22:14:42.611 : jerk>pJerk 8
    22:14:42.611 : speed limit3.48
    22:14:42.611 : ok 459
    22:14:42.627 : dx 16
    22:14:42.627 : dy -257
    22:14:42.627 : jerk 258
    22:14:42.627 : LF 100
    22:14:42.627 : speed limit40.00
    22:14:42.627 : ok 460
    22:14:42.627 : dx 32
    22:14:42.627 : dy -252
    22:14:42.642 : jerk 254
    22:14:42.642 : LF 100
    22:14:42.642 : speed limit40.00
    22:14:42.642 : ok 461
    22:14:42.642 : dx 49
    22:14:42.642 : dy -252
    22:14:42.642 : jerk 257
    22:14:42.642 : LF 100
    22:14:42.658 : speed limit40.00
    22:14:42.658 : ok 462
    22:14:42.658 : dx 67
    22:14:42.658 : dy -254
    22:14:42.658 : jerk 262
    22:14:42.658 : LF 100
    22:14:42.658 : speed limit40.00
    22:14:42.658 : ok 463
    22:14:42.658 : dx 81
    22:14:42.658 : dy -242
    22:14:42.674 : jerk 255
    22:14:42.674 : LF 100
    22:14:42.674 : speed limit40.00

  • Ok, we com ecloser. The huge dx/dy values are surely the reason for the problem. Looks like it is assuming a 45° move - no move  - 45° move from the speed values. That is what wonders me most as I assume you are testing a circle part. Can you post the code tested and your steps per mm for x/y and movement speed (I assume 60 or 40 from the values). Maybe replaying the critical move while reading the code will help me seing where the speed difference comes from.
  • edited May 2016
    ok, my machines axis steps are not symmetrical for test i set them the same value but still slows down in turnover point.


     steps per mm y 768
     steps per mm x 533.333
    feedrate 40 mm/s

    testing code is part of a circle :

    G1 X291.517 Y113.106 F2400
    G1 X291.795 Y114.315
    G1 X291.994 Y115.535
    G1 X292.113 Y116.763
    G1 X292.153 Y118.000
    G1 X292.113 Y119.237
    G1 X291.994 Y120.465
    G1 X291.795 Y121.685
    G1 X291.517 Y122.894
    G1 X291.165 Y124.072
    G1 X290.735 Y125.233
    G1 X290.228 Y126.367
    G1 X289.657 Y127.452
    G1 X289.011 Y128.510
    G1 X288.299 Y129.520
    G1 X287.524 Y130.483
    G1 X286.681 Y131.401
    G1 X286.401 Y131.681
    G1 X285.479 Y132.528
    G1 X284.528 Y133.294
    G1 X283.510 Y134.011
    G1 X282.452 Y134.657
    G1 X281.367 Y135.228
    G1 X280.233 Y135.735
    G1 X279.072 Y136.165
    G1 X277.894 Y136.518
    G1 X276.685 Y136.795
    G1 X275.465 Y136.994
    G1 X274.237 Y137.113
    G1 X273.000 Y137.153
    G1 X271.763 Y137.113
    G1 X270.535 Y136.994
    G1 X269.315 Y136.795
    G1 X268.106 Y136.518
    G1 X266.928 Y136.165
    G1 X265.767 Y135.735



    also happens with circle from cam program :

    ; Made using CamBam - http://www.cambam.info
    ; Ohne Namen 5/23/2016 11:02:34 AM

    G0 X51.0 Y26.0
    G1 X50.99 Y26.707 F2400
    G1 X50.96 Y27.4135
    G1 X50.91 Y28.1188
    G1 X50.8402 Y28.8225
    G1 X50.7504 Y29.5239
    G1 X50.6408 Y30.2224
    G1 X50.5116 Y30.9176
    G1 X50.3627 Y31.6089
    G1 X50.1943 Y32.2957
    G1 X50.0066 Y32.9774
    G1 X49.7996 Y33.6535
    G1 X49.5737 Y34.3236
    G1 X49.3288 Y34.9869
    G1 X49.0653 Y35.6431
    G1 X48.7834 Y36.2916
    G1 X48.4832 Y36.9318
    G1 X48.1651 Y37.5633
    G1 X47.8292 Y38.1855
    G1 X47.4758 Y38.798
    G1 X47.1053 Y39.4003
    G1 X46.7179 Y39.9918
    G1 X46.3139 Y40.5721
    G1 X45.8936 Y41.1408
    G1 X45.4575 Y41.6974
    G1 X45.0057 Y42.2414
    G1 X44.5388 Y42.7724
    G1 X44.057 Y43.29
    G1 X43.5608 Y43.7937
    G1 X43.0506 Y44.2833
    G1 X42.5267 Y44.7582
    G1 X41.9896 Y45.2181
    G1 X41.4396 Y45.6626
    G1 X40.8774 Y46.0914
    G1 X40.3032 Y46.5041
    G1 X39.7176 Y46.9004
    G1 X39.121 Y47.28
    G1 X38.514 Y47.6426
    G1 X37.8969 Y47.9878
    G1 X37.2703 Y48.3155
    G1 X36.6346 Y48.6253
    G1 X35.9905 Y48.917
    G1 X35.3384 Y49.1904
    G1 X34.6788 Y49.4452
    G1 X34.0123 Y49.6813
    G1 X33.3393 Y49.8984
    G1 X32.6605 Y50.0964
    G1 X31.9763 Y50.2752
    G1 X31.2874 Y50.4345
    G1 X30.5943 Y50.5742
    G1 X29.8974 Y50.6943
    G1 X29.1975 Y50.7947
    G1 X28.495 Y50.8752
    G1 X27.7905 Y50.9358
    G1 X27.0845 Y50.9765
    G1 X26.3777 Y50.9971
    G1 X25.6706 Y50.9978
    G1 X24.9638 Y50.9785
    G1 X24.2578 Y50.9392
    G1 X23.5531 Y50.88
    G1 X22.8505 Y50.8008
    G1 X22.1503 Y50.7018
    G1 X21.4533 Y50.5831
    G1 X20.7598 Y50.4446
    G1 X20.0706 Y50.2867
    G1 X19.3861 Y50.1093
    G1 X18.7069 Y49.9126
    G1 X18.0336 Y49.6967
    G1 X17.3666 Y49.462
    G1 X16.7065 Y49.2084
    G1 X16.0538 Y48.9363
    G1 X15.4091 Y48.6458
    G1 X14.7729 Y48.3372
    G1 X14.1457 Y48.0108
    G1 X13.5279 Y47.6667
    G1 X13.5 Y47.6506
    G1 X12.8927 Y47.2885
    G1 X12.2959 Y46.9092
    G1 X11.71 Y46.5133
    G1 X11.1356 Y46.101
    G1 X10.573 Y45.6725
    G1 X10.0228 Y45.2284
    G1 X9.4854 Y44.7688
    G1 X8.9612 Y44.2943
    G1 X8.4506 Y43.8051
    G1 X7.9541 Y43.3016
    G1 X7.472 Y42.7843
    G1 X7.0047 Y42.2536
    G1 X6.5527 Y41.7099
    G1 X6.1161 Y41.1536
    G1 X5.6955 Y40.5852
    G1 X5.2912 Y40.0051
    G1 X4.9034 Y39.4139
    G1 X4.5324 Y38.8119
    G1 X4.1787 Y38.1996
    G1 X3.8424 Y37.5776
    G1 X3.5238 Y36.9463
    G1 X3.2232 Y36.3063
    G1 X2.9409 Y35.658
    G1 X2.677 Y35.002
    G1 X2.4317 Y34.3388
    G1 X2.2053 Y33.6689
    G1 X1.9979 Y32.9929
    G1 X1.8098 Y32.3113
    G1 X1.6409 Y31.6246
    G1 X1.4916 Y30.9334
    G1 X1.3619 Y30.2383
    G1 X1.2519 Y29.5398
    G1 X1.1617 Y28.8385
    G1 X1.0913 Y28.1349
    G1 X1.0409 Y27.4296
    G1 X1.0105 Y26.7231
    G1 X1.0 Y26.0161
    G1 X1.0095 Y25.3091
    G1 X1.0391 Y24.6026
    G1 X1.0886 Y23.8972
    G1 X1.158 Y23.1935
    G1 X1.2473 Y22.4921
    G1 X1.3564 Y21.7934
    G1 X1.4853 Y21.0982
    G1 X1.6337 Y20.4068
    G1 X1.8016 Y19.7199
    G1 X1.9889 Y19.0381
    G1 X2.1954 Y18.3618
    G1 X2.421 Y17.6916
    G1 X2.6654 Y17.0281
    G1 X2.9284 Y16.3718
    G1 X3.21 Y15.7231
    G1 X3.5097 Y15.0827
    G1 X3.8275 Y14.451
    G1 X4.163 Y13.8285
    G1 X4.5159 Y13.2158
    G1 X4.8861 Y12.6133
    G1 X5.2731 Y12.0216
    G1 X5.6767 Y11.441
    G1 X6.0966 Y10.872
    G1 X6.5324 Y10.3152
    G1 X6.9838 Y9.7709
    G1 X7.4504 Y9.2396
    G1 X7.9318 Y8.7217
    G1 X8.4277 Y8.2176
    G1 X8.9376 Y7.7277
    G1 X9.4612 Y7.2525
    G1 X9.9981 Y6.7922
    G1 X10.5477 Y6.3474
    G1 X11.1097 Y5.9182
    G1 X11.6836 Y5.5051
    G1 X12.2689 Y5.1084
    G1 X12.8653 Y4.7285
    G1 X13.4721 Y4.3655
    G1 X13.5 Y4.3494
    G1 X14.1173 Y4.0045
    G1 X14.7441 Y3.6772
    G1 X15.38 Y3.3678
    G1 X16.0243 Y3.0765
    G1 X16.6766 Y2.8036
    G1 X17.3363 Y2.5492
    G1 X18.003 Y2.3135
    G1 X18.6761 Y2.0969
    G1 X19.355 Y1.8993
    G1 X20.0393 Y1.721
    G1 X20.7283 Y1.5621
    G1 X21.4216 Y1.4228
    G1 X22.1185 Y1.3032
    G1 X22.8185 Y1.2033
    G1 X23.5211 Y1.1232
    G1 X24.2256 Y1.063
    G1 X24.9316 Y1.0228
    G1 X25.6384 Y1.0026
    G1 X26.3455 Y1.0024
    G1 X27.0523 Y1.0222
    G1 X27.7583 Y1.0619
    G1 X28.4629 Y1.1216
    G1 X29.1655 Y1.2012
    G1 X29.8656 Y1.3007
    G1 X30.5626 Y1.4199
    G1 X31.2559 Y1.5587
    G1 X31.945 Y1.7172
    G1 X32.6294 Y1.895
    G1 X33.3085 Y2.0921
    G1 X33.9817 Y2.3084
    G1 X34.6486 Y2.5436
    G1 X35.3085 Y2.7976
    G1 X35.961 Y3.0701
    G1 X36.6055 Y3.361
    G1 X37.2415 Y3.67
    G1 X37.8685 Y3.9969
    G1 X38.486 Y4.3413
    G1 X39.0936 Y4.7031
    G1 X39.6907 Y5.0819
    G1 X40.2768 Y5.4775
    G1 X40.8515 Y5.8895
    G1 X41.4143 Y6.3175
    G1 X41.9648 Y6.7613
    G1 X42.5025 Y7.2205
    G1 X43.027 Y7.6948
    G1 X43.5379 Y8.1836
    G1 X44.0347 Y8.6868
    G1 X44.5172 Y9.2037
    G1 X44.9848 Y9.7341
    G1 X45.4372 Y10.2776
    G1 X45.8741 Y10.8336
    G1 X46.2951 Y11.4017
    G1 X46.6998 Y11.9815
    G1 X47.088 Y12.5725
    G1 X47.4593 Y13.1743
    G1 X47.8134 Y13.7863
    G1 X48.1501 Y14.4081
    G1 X48.4691 Y15.0392
    G1 X48.7701 Y15.6791
    G1 X49.0529 Y16.3272
    G1 X49.3172 Y16.983
    G1 X49.5629 Y17.646
    G1 X49.7898 Y18.3158
    G1 X49.9976 Y18.9917
    G1 X50.1862 Y19.6732
    G1 X50.3554 Y20.3597
    G1 X50.5052 Y21.0508
    G1 X50.6354 Y21.7458
    G1 X50.7458 Y22.4442
    G1 X50.8365 Y23.1455
    G1 X50.9073 Y23.849
    G1 X50.9582 Y24.5543
    G1 X50.9891 Y25.2607
    G1 X51.0 Y25.9678
    G1 Y26.0





  • edited May 2016
    Ok, I now understand it and the logic is correct. In the circle you have only small angle changes but at backlash position this changes. There you have this

    G1 X275.465 Y136.994
     
    G1 X274.237 Y137.113  dir -1,228/0,119 

    G1 X273.000 Y137.153  dir -1,237/0,04 

    Here backlash move comes 0/-0,01 or whatever you have
    dVx around 40mm/s as it stops, dVy -40 as we invert speed direction to downmove

    G1 X271.763 Y137.113  dir -1,237/-0,04 
    G1 X270.535 Y136.994

    So in this example of you you go left and up until the apex. There you switch from nearly left to pure down move = 90° direction change and then continue nearly pure left again having again 90° direction change.

    Since the backlash move is not distinguishable the move planner sees a zig zag and reduces speed accordingly. When it does so it does not know that the direction is very short and it will continue old direction next move. With jerk 5 this speed approximates then to 5/sqrt(2). That is fully correct also completely unwanted.

    But how could such a thing be detected correctly. If you move along a square you also get 90° change and that is fully correct here to slow down as the BIG move is really 90°. So the stupid solution always works and safes print but looses sometimes quality for unnecessary slowdowns.
  • Ok, thanks.
    so I´ll disable backlash in printing mode because error produced by slow down is much higher than my backlash.
    (i have short bowden extruder).
    for milling and laser i keep it because there is no change result because of precision and of coarse slower
    feedrates

    thank you for your effort!!

  • Sorry for digging out this old post.

    Is it possible with low effort to inject backlash compensation moves after the planner? Or is it possible to mark them as "ignore" for the planner? Could this approach eliminate the described issue because backlash-compensating moves are ideally load-free or in other words they do not move the carriage?
  • Every move needs to go through planner as the planner computes important parameter. A marker would be possible I guess, but that makes planning very complicated as you always have to check for that extra case.
  • Hi,

    I know I'm coming back to an old topic.

    Would it be possible to set different jerk, accelerations or feedrate for the small movement of the backlash compensation?

    I think that the problem is that the printer movement is almost stopped, not because the jerk is too small but because the initial speed of that segment (jerk/2) is too small.

    For example, I'm printing a circle at 50 mm/s and when I set jerk at 100 (I know is too high) it prints without stopping at the point of the backlash compensation.

    In my understanding, the backlash movement could be done very quickly because it is not really moving any mass. It is unloading the belts and loading them again in the opposite direction, but it is not really moving the extruder. That's why I understand that the backlash movement could be done at very high rates, much higher than normally used for printing, and this could be a solution for this topic.

    I've tried to add a local change of jerk at motion.cpp at the "#if ENABLE_BACKLASH_COMPENSATION" (line 258 and line 412), first increasing the jerk to a very high value and leaving it as the original jerk at the #endif, but it didn't work.

    The modification was the following:

    #if ENABLE_BACKLASH_COMPENSATION
        if((p->isXYZMove()) && ((p->dir & XYZ_DIRPOS) ^ (Printer::backlashDir & XYZ_DIRPOS)) & (Printer::backlashDir >> 3)) { // We need to compensate backlash, add a move

    GCode::executeFString(PSTR("M207 X100")); //change of jerk when doing a backlash compensation

            waitForXFreeLines(2);             
            uint8_t wpos2 = linesWritePos + 1;
            if(wpos2 >= PRINTLINE_CACHE_SIZE) wpos2 = 0;
            PrintLine *p2 = &lines[wpos2];
            memcpy(p2, p, sizeof(PrintLine)); // Move current data to p2
            uint8_t changed = (p->dir & XYZ_DIRPOS) ^ (Printer::backlashDir & XYZ_DIRPOS);
            float back_diff[4]; // Axis movement in mm
            back_diff[E_AXIS] = 0;
            back_diff[X_AXIS] = (changed & 1 ? (p->isXPositiveMove() ? Printer::backlashX : -Printer::backlashX) : 0);
            back_diff[Y_AXIS] = (changed & 2 ? (p->isYPositiveMove() ? Printer::backlashY : -Printer::backlashY) : 0);
            back_diff[Z_AXIS] = (changed & 4 ? (p->isZPositiveMove() ? Printer::backlashZ : -Printer::backlashZ) : 0);
            p->dir &= XYZ_DIRPOS; // x,y and z are already correct
            for(uint8_t i = 0; i < 4; i++) {
                float f = back_diff[i] * Printer::axisStepsPerMM[i];
                p->delta[i] = abs((long)f);
                if(p->delta[i]) p->dir |= XSTEP << i;
            }
            //Define variables that are needed for the Bresenham algorithm. Please note that  Z is not currently included in the Bresenham algorithm.
            if(p->delta[Y_AXIS] > p->delta[X_AXIS] && p->delta[Y_AXIS] > p->delta[Z_AXIS]) p->primaryAxis = Y_AXIS;
            else if (p->delta[X_AXIS] > p->delta[Z_AXIS] ) p->primaryAxis = X_AXIS;
            else p->primaryAxis = Z_AXIS;
            p->stepsRemaining = p->delta[p->primaryAxis];
            //Feedrate calc based on XYZ travel distance
            xydist2 = back_diff[X_AXIS] * back_diff[X_AXIS] + back_diff[Y_AXIS] * back_diff[Y_AXIS];
            if(p->isZMove())
                p->distance = sqrt(xydist2 + back_diff[Z_AXIS] * back_diff[Z_AXIS]);
            else
                p->distance = sqrt(xydist2);
            // 56 seems to be xstep|ystep|e_posdir which just seems odd
            Printer::backlashDir = (Printer::backlashDir & 56) | (p2->dir & XYZ_DIRPOS);
            p->calculateMove(back_diff, pathOptimize, p->primaryAxis);
            p = p2; // use saved instance for the real move

    GCode::executeFString(PSTR("M207 X10")); //back to original jerk after the backlash compensation 
        }
    #endif


    Any thoughts?

    Thank you in advance






Sign In or Register to comment.