Maximum speed and acceleration testing macro
-
Hey all!
I have made an adaptive macro that, based on user-set variables, throws the printhead around to see if it loses steps or skips the belt.
This works really well, but I would like to also implement a part that, after the movement, homes the X axis and reports the (micro)steps needed for the homing movement.
This way I can electronically verify/ calculate if the machine/ axis missed stepsFor example,
If I know the printhead is at X100, with 80 steps/mm and 16 microsteps. I can calculate that it needs 128.000 microsteps to home the toolhead (in theory). If I can get RRF to report the amount of microsteps it actally needed for the homing, I can calculate if it missed steps or lost accuracy.Is this possible?
Macro code I have now;
; Define variables var testacceleration = 10000 var testspeed = 600 * 60 var testiteration = 2 var testboundries = 15 var testzheight = 25 var testsmallsize = 50 ; Home and level machine G28 ; home printer M98 P"0:/macros/kinematic-tramming" ; Auto calibration ; Prepare for speed testacceleration G0 X{move.axes[0].min + var.testboundries} Y{move.axes[1].min + var.testboundries} Z{var.testzheight} F3000; move to WLF corner at Zheight ; Set accelerations M203 X{var.testspeed} Y{var.testspeed} ; Adjust maximum speeds M201 X{var.testacceleration} Y{var.testacceleration} ; Adjust maximum acceleration M204 P{var.testacceleration} T{var.testacceleration} ; Set acceleration ; Start speedtesting while true G90 G0 X{move.axes[0].max - var.testboundries} Y{move.axes[1].max - var.testboundries} F{var.testspeed}; WideRightRear G0 X{move.axes[0].min + var.testboundries} Y{move.axes[1].min + var.testboundries} F{var.testspeed}; WideLeftFront G0 X{move.axes[0].max - var.testboundries} Y{move.axes[1].min + var.testboundries} F{var.testspeed}; WideRightFront G0 X{move.axes[0].min + var.testboundries} Y{move.axes[1].max - var.testboundries} F{var.testspeed}; WideLeftRear G0 X{move.axes[0].max - var.testboundries} Y{move.axes[1].min + var.testboundries} F{var.testspeed}; WideRightFront G0 X{move.axes[0].max - var.testboundries} Y{move.axes[1].max - var.testboundries} F{var.testspeed}; WideRightRear G0 X{move.axes[0].min + var.testboundries} Y{move.axes[1].max - var.testboundries} F{var.testspeed}; WideLeftRear G0 X{move.axes[0].min + var.testboundries} Y{move.axes[1].min + var.testboundries} F{var.testspeed}; WideLeftFront G0 X{move.axes[0].max - var.testboundries} Y{move.axes[1].min + var.testboundries} F{var.testspeed}; WideRightFront G0 X{move.axes[0].max - var.testboundries} Y{move.axes[1].max - var.testboundries} F{var.testspeed}; WideRightRear G0 X{move.axes[0].min + var.testboundries} Y{move.axes[1].max - var.testboundries} F{var.testspeed}; WideLeftRear G0 X{move.axes[0].min + var.testboundries} Y{move.axes[1].min + var.testboundries} F{var.testspeed}; WideLeftFront G0 X{move.axes[0].max/2 + var.testsmallsize/2} Y{move.axes[1].max/2 + var.testsmallsize/2} F{var.testspeed}; SmallRightRear G0 X{move.axes[0].max/2 - var.testsmallsize/2} Y{move.axes[1].max/2 - var.testsmallsize/2} F{var.testspeed}; SmallLeftFront G0 X{move.axes[0].max/2 + var.testsmallsize/2} Y{move.axes[1].max/2 - var.testsmallsize/2} F{var.testspeed}; SmallRightFront G0 X{move.axes[0].max/2 - var.testsmallsize/2} Y{move.axes[1].max/2 + var.testsmallsize/2} F{var.testspeed}; SmallLeftRear G0 X{move.axes[0].max/2 + var.testsmallsize/2} Y{move.axes[1].max/2 - var.testsmallsize/2} F{var.testspeed}; SmallRightFront G0 X{move.axes[0].max/2 + var.testsmallsize/2} Y{move.axes[1].max/2 + var.testsmallsize/2} F{var.testspeed}; SmallRightRear G0 X{move.axes[0].max/2 - var.testsmallsize/2} Y{move.axes[1].max/2 + var.testsmallsize/2} F{var.testspeed}; SmallLeftRear G0 X{move.axes[0].max/2 - var.testsmallsize/2} Y{move.axes[1].max/2 - var.testsmallsize/2} F{var.testspeed}; SmallLeftFront G0 X{move.axes[0].max/2 + var.testsmallsize/2} Y{move.axes[1].max/2 - var.testsmallsize/2} F{var.testspeed}; SmallRightFront G0 X{move.axes[0].max/2 + var.testsmallsize/2} Y{move.axes[1].max/2 + var.testsmallsize/2} F{var.testspeed}; SmallRightRear G0 X{move.axes[0].max/2 - var.testsmallsize/2} Y{move.axes[1].max/2 + var.testsmallsize/2} F{var.testspeed}; SmallLeftRear G0 X{move.axes[0].max/2 - var.testsmallsize/2} Y{move.axes[1].max/2 - var.testsmallsize/2} F{var.testspeed}; SmallLeftFront if iterations < var.testiteration continue if iterations = var.testiteration break ; end loop G28 ; home printer
-
@SanderLPFRG I think @jay_s_uk has already implemented something similar to what you are trying to do. I'm sure he will provide the details.
-
@SanderLPFRG this is my version based on the klipper macro
https://forum.duet3d.com/topic/32433/determining-max-speed-and-acceleration -
@jay_s_uk Ahh, was trying to do that actually.
Does it work for markforged kinematics as well??
-
@SanderLPFRG i don't see why not. it needs endstops due to how it calculates if a shift has occurred.
Would be good for you to try it on a slow speed and see if it works -
@jay_s_uk OHkee,
Does it matter in which direction it homes??
Y homes to max, X homes to min on my machine
-
@SanderLPFRG no, it works it out
-
@jay_s_uk That's a timely reminder. I said I'd test these macros out once I got my printer build finished but then forgot all about it. I'll do it in the the next few days and report back on your main thread.