Does bed.g serve a purpose on a cartesian printer?



  • Hi,

    I'd like to know if bed.g serves a purpose on a cartesian printer. Here's the content of my bed.g:

    ; bed.g
    ; called to perform automatic bed compensation via G32
    ;
    ; generated by RepRapFirmware Configuration Tool on Sat Apr 15 2017 17:35:56 GMT+0300 (GTB Daylight Time)
    
    ; Clear any bed transform
    M561
    
    ; Probe the bed at 5 points
    G30 P0 X15 Y15 H0 Z-99999
    G30 P1 X15 Y175 H0 Z-99999
    G30 P2 X187 Y175 H0 Z-99999
    G30 P3 X187 Y15 H0 Z-99999
    G30 P4 X101 Y95 H0 Z-99999 S
    
    
    

    I use mesh leveling with the following macro:

    G29 S2
    M561;
    G28 XY;
    M280 P3 S10 I1;
    G28 Z;
    M280 P3 S90 I1;
    G1 Z5 F80;
    
    M280 P3 S10 I1;
    G29;
    M280 P3 S90 I1;
    

    And my starting script on Simplify3D is as follows:

    G28 XY; Home X and Y axis
    M280 P3 S10 I1; BLTouch Pin down
    G1 X100 Y100; Go to 100
    G28 Z;
    G29 S1 ; Bed leveling with already recorded height map
    M280 P3 S90 I1; BLTouch pin up
    
    

    So my question are:

    1. Do I need to modify anything on bed.g? Do I even need bed.g for some purpose?
    2. Can you find any errors on my mesh leveling macro? Do I really need a M561 there?
    3. Anything to change on my starting script?

    I am on Duet 2.051 by the way. I am asking these questions because there might be some details that changed between versions and I don't want to make an error there.

    Thanks,



  • you can use mesh leveling using G29 or you can do it using G32 ... if there is bed.g G32 will call it if not it will do leveling on it's own ...

    I'm in the process of making my bed.g do the mesh leveling but "complex"

    bed.g that I use now that works

    M400
    M913 X30 Y30 Z30
    M566 Z0
    M201 Z20.00
    
    G29 S2 ; delete compensations
    M561   ; clear any bed transform
    G28    ; home
    
    M400
    G4 S1
    M400
    G31 P{sensors.probes[0].value[0] + 8}
    G29 S0 
    G1 X0 Y0 Z5 F9000
    
    ; RESTORE current, jerk, speed, acceleration
    M98 P"cfg_jerkspeedaccel.g"
    

    and the bed.g that's in progress

    
    M400
    M913 X30 Y30 Z30
    M566 Z0
    M201 Z20.00
    
    G29 S2 ; delete compensations
    M561   ; clear any bed transform
    
    ; G31 P{sensors.probes[0].value[0] + 8}
    ; G29 S0 
    
    echo "Starting calibration. Initial deviation: (" ^ move.calibration.initial.deviation ^ "mm)"
    
    ; X points: -110, -55, 0, 55, 110
    ; Y points: -100, -50, 0, 50, 100
    
    while true
      if iterations = 5
        abort "Too many auto calibration attempts"
      G28
    
      G1 X-110 Y-100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P0 X-110 Y-100 Z-9999
      if result != 0
        echo "ERROR P0"
        continue
      echo "DONE P0"
      
      G1 X-55 Y-100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P1 X-55 Y-100 Z-9999
      if result != 0
        echo "ERROR P1"
        continue
      echo "DONE P1"
      
      G1 X0 Y-100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P2 X0 Y-100 Z-9999
      if result != 0
        echo "ERROR P2"
        continue
      echo "DONE P2"
    
      G1 X55 Y-100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P3 X55 Y-100 Z-9999
      if result != 0
        echo "ERROR P3"
        continue
      echo "DONE P3"
    
      G1 X110 Y-100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 10}
      G30 P4 X110 Y-100 Z-9999
      if result != 0
        echo "ERROR P4"
        continue
      echo "DONE P4"
    
      G1 X110 Y-50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P5 X110 Y-50 Z-9999
      if result != 0
        echo "ERROR P5"
        continue
      echo "DONE P5"
    
      G1 X55 Y-50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P6 X55 Y-50 Z-9999
      if result != 0
        echo "ERROR P6"
        continue
      echo "DONE P6"
    
      G1 X0 Y-50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P7 X0 Y-50 Z-9999
      if result != 0
        echo "ERROR P7"
        continue
      echo "DONE P7"
    
      G1 X-55 Y-50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P8 X-55 Y-50 Z-9999
      if result != 0
        echo "ERROR P8"
        continue
      echo "DONE P8"
    
      G1 X-110 Y-50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P9 X-110 Y-50 Z-9999
      if result != 0
        echo "ERROR P9"
        continue
      echo "DONE P9"
    
      G1 X-110 Y0 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P10 X-110 Y0 Z-9999
      if result != 0
        echo "ERROR P10"
        continue
      echo "DONE P10"
    
      G1 X-55 Y0 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P11 X-55 Y0 Z-9999
      if result != 0
        echo "ERROR P11"
        continue
      echo "DONE P11"
    
      G1 X0 Y-0 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P12 X0 Y0 Z-9999
      if result != 0
        echo "ERROR P12"
        continue
      echo "DONE P12"
    
      G1 X55 Y0 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P13 X55 Y0 Z-9999
      if result != 0
        echo "ERROR P13"
        continue
      echo "DONE P13"
    
      G1 X110 Y0 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P14 X110 Y0 Z-9999
      if result != 0
        echo "ERROR P14"
        continue
      echo "DONE P14"
      
      G1 X110 Y50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P15 X110 Y50 Z-9999
      if result != 0
        echo "ERROR P15"
        continue
      echo "DONE P15"
    
      G1 X55 Y50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P16 X55 Y50 Z-9999
      if result != 0
        echo "ERROR P16"
        continue
      echo "DONE P16"
    
      G1 X0 Y50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P17 X0 Y50 Z-9999
      if result != 0
        echo "ERROR P17"
        continue
      echo "DONE P17"
    
      G1 X-55 Y50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P18 X-55 Y50 Z-9999
      if result != 0
        echo "ERROR P18"
        continue
      echo "DONE P18"
    
      G1 X-110 Y50 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P19 X-110 Y50 Z-9999
      if result != 0
        echo "ERROR P19"
        continue
      echo "DONE P19"
    
      G1 X-110 Y100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P20 X-110 Y100 Z-9999
      if result != 0
        echo "ERROR P20"
        continue
      echo "DONE P20"
    
      G1 X-55 Y100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P21 X-55 Y100 Z-9999
      if result != 0
        echo "ERROR P21"
        continue
      echo "DONE P21"
    
      G1 X0 Y100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P22 X0 Y100 Z-9999
      if result != 0
        echo "ERROR P22"
        continue
      echo "DONE P22"
    
      G1 X55 Y100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P23 X55 Y100 Z-9999
      if result != 0
        echo "ERROR P23"
        continue
      echo "DONE P23"
    
      G1 X110 Y100 Z5 F9000
      M400
      G4S1
      M400
      G31 P{sensors.probes[0].value[0] + 8}
      G30 P24 X110 Y100 Z-9999 S-1
      if result != 0
        echo "ERROR P24"
        continue
      echo "DONE P24"
    
      if move.calibration.final.deviation <= 0.03
        break
      echo "Repeating calibration because deviation is too high (" ^ move.calibration.final.deviation ^ "mm)"
    
    echo "Auto calibration successful, deviation", move.calibration.final.deviation ^ "mm"
    G1 X0 Y0 Z5 F9000
    
    M913 X100 Y100 Z100
    M566 Z100.00
    M201 Z50.00
    

    The problem I have with this one is that "last G30" need to have S value and that thing does not work for me ok, getting some weird errors back 😞


  • Moderator

    @drmaestro G32 calls the bed.g macro. If you don't have any way to level the bed physically (eg independent Z screws), bed.g can be the same as your mesh levelling macro.

    @arhi said in Does bed.g serve a purpose on a cartesian printer?:

    The problem I have with this one is that "last G30" need to have S value and that thing does not work for me ok, getting some weird errors back

    If you want the compensation, and not just reported (with S-1), just set it to "S". You don't have to define the number:

    On the last G30 command in the sequence, the S parameter indicates that a complete set of points has been probed and instructs the firmware what sort of calibration to perform.
    If the value is zero or not present, then this specifies that the number of factors to be calibrated is the same as the number of points probed.

    Ian



  • Might be slightly related but I'll ask it here too: What's the advantage of having 2 independent Z motors for bed leveling? I see some posts about it but I haven't seen a comparison where you use 2 independent motors vs 2 linked (single driver) motors.


  • Moderator

    @drmaestro I don't know about you, but my nearly-4-year-old loves twiddling the Z axis motors individually when the printer is off! Running a macro levels the X axis to the bed again.

    Ian



  • @droftarts Ah, ok. So, you need to do a macro to correct the relation of the Z axis to the X axis if they are not level, then another macro for mesh leveling. Wouldn't mesh leveling alone compensate for this error?


  • Moderator

    @drmaestro Much quicker to do a axis level and load an existing bed mesh!

    Ian


  • administrators

    @droftarts said in Does bed.g serve a purpose on a cartesian printer?:

    @drmaestro G32 calls the bed.g macro. If you don't have any way to level the bed physically (eg independent Z screws), bed.g can be the same as your mesh levelling macro.

    To clarify, this doesn't have to be independent Z motors, it can just be bed levelling screws. See https://duet3d.dozuki.com/Wiki/Using_the_manual_bed_levelling_assistant.



  • @droftarts said in Does bed.g serve a purpose on a cartesian printer?:

    If you want the compensation, and not just reported (with S-1), just set it to "S". You don't have to define the number:

    I tried it (here). I noticed (late) that @dc42 used S8 on his last point so re-read the manual and found that I missed that part. Then I tried different S values (-1, 0, 8, 25...) but none gave useful results so after exosting all the ideas I had I gave up. I am willing to give it another go if I get more data to how to go about it but with current knowledge there's not much I can do. The only thing left is to do the first 5 points in the requested order and then just add other ones in "no clue what" order and give it a go since now in RC7 the bug with return not being populated from G30 should be fixed.

    S/S0 does this:

    Error: Probe points P0 to P3 must be in clockwise order starting near minimum X and Y, and P4 must be near the centre
    ERROR P24
    
    

    Issue #1 P0 to P4 ?!?! What about the other 20 points?
    Issue #2 order?! I ordered P0-P24 in the same way G29 does it. I could do 4 corners and center but what then? What would be the order of the other 20 points?
    S-1 reports some worrying results too. Anyhow, this is the sample of what in theory could be done; obviously, I don't know how to do it.


  • Moderator

    @arhi said in Does bed.g serve a purpose on a cartesian printer?:

    Error: Probe points P0 to P3 must be in clockwise order starting near minimum X and Y, and P4 must be near the centre

    That's an old error message, but I think still valid. If you're calculating the bed plane, you can only have a maximum of 5 points (which, in itself is odd, as a plane is defined by three points!). This was from the time before mesh levelling, when calculating the bed plane was the only firmware-implemented levelling available. It's probably why you can only report the deviation for the rest of the points,

    Ian


  • administrators

    The old 3, 4 and 5-point bed compensation had been deprecated for several years. Use mesh bed compensation instead.



  • @dc42 said in Does bed.g serve a purpose on a cartesian printer?:

    The old 3, 4 and 5-point bed compensation had been deprecated for several years. Use mesh bed compensation instead.

    how to do it point by point?
    G0,G30P0,G0,G30P1...G0,G30P24S
    is what's supposed to reading the doc .. but it does not

    you are doing the same thing here only on delta and you finish with S8 after using 16 points .. how do I finish after 25 points on cartesian?


  • administrators

    The point of mesh bed compensation is that you don't have to specify all the points, saving you a lot of work. Instead you specify the limits to be probed, and either the spacing between points or the number of points.



  • @dc42 said in Does bed.g serve a purpose on a cartesian printer?:

    Instead you specify the limits to be probed, and either the spacing between points or the number of points.

    Yes, that's how G29 works. You yourself made an example of how to do it point by point for delta. Why would the same thing not work for cartesian?


Log in to reply