Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extruder stalls because of problematic Gcode (instant retract without printing anything) #151

Open
luke321 opened this issue Aug 29, 2013 · 50 comments

Comments

@luke321
Copy link

luke321 commented Aug 29, 2013

So I have some .stl files which slic3r can't process, but Simplify 3D Creator is able to process them but sometimes generates a move to a point where he simply does the following

retracted previously than moves to new position...

G0 Z0.25 F36000
G92 E0
G1 E4 F3200
G1 E0 F3200
G0 Z1.25 F36000

moving to the position pushing the filament forward and than retract the filament instantly again.
but the extruder makes some strange noise and simply leaves a big blob of pla behind.
I will make a video when i get home to clarify!

@repetier
Copy link
Owner

That code extrudes 4mm at 53mm/s and then retracts the same 4mm. If this is the first extruder move a blob and some lost steps are what I would expect. I think the idea behind this is that the end of the previous print sucked the filament 4mm in. Even then you might get a blob because of dropping filament during warmup.

What printer du you have that can move z-axis with 600mm/s ?

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

rostock mini, I actually tested it with 1,2 m/s velocity and 10 m/s^2 acceleration altough without the hotend mounted...

yes it happes after a previous retract, mulitple times during the print

here is the gcode:
https://www.dropbox.com/s/uch6tqrpu9dy5vv/visorMaskAngledFlatWithSupport.gcode

I will try again today with some fabricated Gcode and very slow extruder settings to see whats happening...
but for me it looks like the retract directly after pushing the filament forward is not happening, instead the extruder motor stalls..
maybe a problem with extruder jerk settings when no travel move is happening?

@repetier
Copy link
Owner

Jerk is a possible reason. You are running 53mm/s in one direction and instantly in the other direction. That is the highest stress you can make, so jerk/acceleration could help to manage it.

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

isn't this handled just like moving forward stop moving backward?
if the jerk and acceleration are ok for accelerating from 0 to 53 mm/s.. than when i do a 53 to -53 mm/s move the firmware should reduce the speed more for this junction but the jerk should remain the same or not?
I will try different jerk and acceleration settings when at home, and I will try printing without filament to see if it is related to the firmware

@repetier
Copy link
Owner

Yes, it is handled like that. But normally you print slow->retract -> pause ->undo retract.
What you now have is a reverse without pause, so the motor has to change between jerk/2 forward speed to jerk/2 backward speed and depending on jerk it might be too much. The pause between direction changes can make a big difference.

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

okay, and the extruder jerk is defined by the start feedrate?

@repetier
Copy link
Owner

Yes thats the same.

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

there is definitely an issue with the firmware here:

I used a jerk of 1 and acceleration of 500 for these videos:

max speed 10mm/s
the extruder is movin fine, but the other moves get jumpy
http://www.youtube.com/watch?v=IIQqU2i_Kag&feature=youtu.be

max speed 80mm/s
the extruder stalls almost not turning at all, but the other moves work fine
http://www.youtube.com/watch?v=fNPHCCVO0xE&feature=youtu.be

the stalling starts at max speed 35mm/s and seems to be independent from the max start speed of the extruder...
maybe there is also a sign error similar to the jerk problem with delta printers?

@repetier
Copy link
Owner

Which firmware version are you using? The development version had a bug that caused such things but it was never in the master version.

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

I updated to the current Master yesterday. should I try the development version?

and this is the gcode I am using to force the problem:
G90 ; use absolute coordinates
M82 ; absolute extrusion distances
G21 ; set units to millimeters
G28 ; home all axes
G0 X-0.819 Y-23.561 Z0.25 F36000
G92 E0
G1 E4 F960
G1 X1.081 Y-23.561 E4.0558 F1800
G1 X2.22 Y-23.386 E4.0897
G1 X3.143 Y-23.152 E4.1177
G1 X3.907 Y-22.912 E4.1412
G1 X4.628 Y-22.667 E4.1636
G1 X5.42 Y-22.365 E4.1885
G1 X6.282 Y-21.971 E4.2164
G1 X7.156 Y-21.48 E4.2458
G1 X8.027 Y-20.881 E4.2769
G1 X8.817 Y-20.203 E4.3075
G1 X9.324 Y-19.695 E4.3286
G1 E0.3286 F3200
G0 Z1.25 F36000
G0 X-7.703 Y-11.884 F36000
G0 Z0.25 F36000
G92 E0
G1 E4 F3200
G1 E0 F3200
G0 Z1.25 F36000
G0 X-7.765 Y-11.417 F36000
G0 Z0.25 F36000
G92 E0
G1 E4 F3200
G1 E0 F3200
G0 Z1.25 F36000
G0 X-9.452 Y-7.564 F36000
G0 Z10.25 F36000

@repetier
Copy link
Owner

Yes, because it has many improvements for delta printer. And it is the only version where I'm fixing problems since it is the next great version.

Since it was a problem in the master version I'm curious if it s gone. With all the changes you never know.

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

the problem is still there, it happens as soon as i set the max feedrate over 30 mm/s but is unaffected by acceleration and extruder jerk!

it would be great if you could fix this, i normally use 8mm retraction and this takes a while with 30mm/s...

@repetier
Copy link
Owner

My delta does 7mm retract with 80mm/s without problems in this version. What are your settings for the extruder and how do you see the problem?

I'm a bit confused by the videos you uploaded. There I saw no extrusion and I thought you were talking about xy moves there getting jerky.

I hope I can test your script tomorrow and see something going wrong.

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

a pure retract with 80mm/s is no problem.

the problem are those

G92 E0
G1 E4 F3200
G1 E0 F3200

moves

in the first video you can see that the extruder moves fine altough for some reason the low extruder jerk settings seem to cause problems with the xy moves...

in the second video the extruder simply stalls and the only thing I changed was the max feedrate to 80mm/s,
the same thing happens now with the new firmware as soon as i set the max feedrate to a value higher than 30 mm/s...
the strange thing is as you can see in the second video the extruder does not even turn forward, but only retracts a very short distance...

and so when the next extrusion follow it pushes out too much filament resulting in blobs!

my guess would be that when there is a problem in the jerk or junction calculation when there are 2 E commands after one another...

you dont need my whole script simply try sending
G90 ; use absolute coordinates
M82 ; absolute extrusion distances
G21 ; set units to millimeters
G28 ; home all axes
G92 E0
G1 E4 F3200
G1 E0 F3200

it should produce the error!

@repetier
Copy link
Owner

I just ran the code without problems, just two short back/forth moves like in video 1 only in fast. Do you have advance enabled? That results in a different extruder handling and might be the difference.

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

okay I overlooked that advanced and quadratic advanced was activated but when i comment it out i get a compilation error in hal.cpp saying extruder_disable() was not declared in this scope..

edit: i commented the line out lets see if it works now ^^

okay that fixed it! thank you very much!

@repetier
Copy link
Owner

Simple set advanceL and advanceK to 0 to disable it. But I do not think that is the problem.

junction speed computation seems also ok:
float eJerk = fabs(current->speedE-previous->speedE);
if(eJerk>Extruder::current->maxStartFeedrate)
factor = RMath::min(factor,Extruder::current->maxStartFeedrate/eJerk);

@luke321
Copy link
Author

luke321 commented Aug 29, 2013

advancedK and L were set to 0 in my configuration.h, now after deactivating advance completely and commenting the not compiling line in hal.cpp the extruder problems are gone!

@repetier
Copy link
Owner

The compile error can be fixed with this line:
if(DISABLE_E) Extruder::disableCurrentExtruderMotor();

But that line does not get executed during print anyway. Still strange that it now works. Looks like I need to recheck other code parts depending on USE_ADVANCE

@luke321
Copy link
Author

luke321 commented Aug 30, 2013

The above example works now... but sometime when there is a very small extrusion to fill a gap the extruder still stalls and the xy moves gets jerky! I will try to isolate this with an example...

edit:
it really seems to be a problem with small extrusion... when i disable gap fill in slic3r I get no extruder stalls and no jerky movements...
also increasing the jerk to 100 seems to reduce the problem but decreases print quality...

update: bottom line, slic3r gap fill is the problem... I don't know if this also happens on normal printers or is rostock specific, but the small zig-zag line of the gap fill kill the printer... either it stops completely or when the gap is short you get strange jerk problem or the extruder stalls when retracting... I think the problem is that the message buffer gets emptied because of too many very short moves...

@luke321
Copy link
Author

luke321 commented Sep 7, 2013

I think i found one part of the problem now in motion.cpp

computeMaxJunctionSpeed(previous,act); // Set maximum junction speed if we have a real move before
if(previous->isEOnlyMove() != act->isEOnlyMove())
{
previous->setEndSpeedFixed(true);
act->setStartSpeedFixed(true);
act->updateStepsParameter();
firstLine->unblock();
return;
}

I changed the code to if(previous->isEOnlyMove() != act->isEOnlyMove()) || (previous->isEOnlyMove() && act->isEOnlyMove())

now I got no more problems with this:
G92 E0
G1 E4 F3200
G1 E0 F3200

@repetier
Copy link
Owner

repetier commented Sep 7, 2013

If you set this to true, you would fix all speeds thus disabling path planning completely. So it may solve your problem but introduce new problems.

@luke321
Copy link
Author

luke321 commented Sep 7, 2013

yeah i realised this so I changed the line... see the post above...

@karloygard
Copy link
Contributor

I think I have fixed this issue. I had similar issues on my rostock max, and can verify the skipping with the gcode you provided.

The issue is that on fast extrude/retracts, the code will run straight from extrude to retract with no decel/accel or jerk test. The code seems to mess up some signs, causing further breakage. I tested my own previously failing gcode and yours, and all seems to be well now. However, I don't know this code well enough to guarantee that this fix is correct.

(Note that the GitHub Markdown really screws up the following patch; I don't know how to stop that)

diff --git a/src/ArduinoAVR/Repetier/motion.cpp b/src/ArduinoAVR/Repetier/motion.cpp
old mode 100644
new mode 100755
index 1d4e79b..8fa915c
--- a/src/ArduinoAVR/Repetier/motion.cpp
+++ b/src/ArduinoAVR/Repetier/motion.cpp
@@ -1100,7 +1102,7 @@ inline void PrintLine::queueEMove(long e_diff,uint8_t check_endstops,uint8_t pat
p->delta[i] = 0;
axis_diff[i] = 0;
}

  • axis_diff[E_AXIS] = e_diff*Printer::invAxisStepsPerMM[E_AXIS];
  • axis_diff[E_AXIS] = fabs(e_diff*Printer::invAxisStepsPerMM[E_AXIS]);

if (e_diff >= 0)
{
p->delta[E_AXIS] = e_diff;

@luke321
Copy link
Author

luke321 commented Sep 14, 2013

thx for the fix karloygard, I'm trying it out right now with a print that always skipped extruder steps and till now I got no problems at all!

@karloygard
Copy link
Contributor

Eeeeeexcellent! Please post back if you see any detrimental effects on prints. As I mentioned, I don't know the code well enough to say that the fix is 100% correct.

@luke321
Copy link
Author

luke321 commented Sep 15, 2013

I reverted my changes in the code and everythings still works fine, I run some of my problematric prints without problems and no extruder stalls! Altough i can't tell if it effects quality because my hot end broke...
I'll post back next week, but it looks great and I can use fast retracts with 80mm/s again ;)

@luke321
Copy link
Author

luke321 commented Sep 15, 2013

sadly I found some Gcode which still causes the extruder to stall

G1 X-8.694 Y-7.833 E15.77023
G1 X-6.288 Y-13.814 F36000.000
G1 X-6.281 Y-13.821 F2400.000 E15.77051
G1 F4800.000 E7.77051 <--here is the stall
G1 Z1.250
G92 E0

after a travel move to a new position there is a very short extrusion and the retract after that stalls, if you add another travel move in between no stall takes place.

edit: I did some further testing, the short extrusion is not the problem, it also happens if you remove the extrusion and use this code:

G1 X-8.694 Y-7.833 E15.77023
G1 X-6.288 Y-13.814 F36000.000
G1 X-6.281 Y-13.821 <-- if you remove this small move the retracts works fine!
G1 F4800.000 E7.77051 <--here is the stall
G1 Z1.250
G92 E0

so there seems to be a problem with retracts or perhaps all E only moves after very small XY moves!

and again the stall only happens for extruder speeds above 30mm/s so I quess the acceleration is messed up

@karloygard
Copy link
Contributor

Cool stuff, I'll take a look at it tonight.

@luke321
Copy link
Author

luke321 commented Sep 16, 2013

did some further testing, the retract fails as soon as the travel move before is under .03 mm...

G90 ; use absolute coordinates
M82 ; absolute extrusion distances
G21 ; set units to millimeters
G28 ; home all axes
G92 E0
G1 Z5 F36000
G92 E15.7
G1 X-8.694 Y-7.833 F2400 E15.77023
G1 X-6 Y-13 F36000.000
G1 X-6 Y-13.02 <-- set this to -13.03 and the retract works fine
G1 F4800.000 E7.77051
G1 Z1.2

and it seems the extruder goes directly into double/quad stepping disabling quad stepping gives you a deeper stall "sound" than with quad stepping enabled.
The retract works if you set the extruder max feedrate to 30mm/s so I think that again acceleration and jerk is completely ignored.

@karloygard
Copy link
Contributor

I can't reproduce that issue. I tested acceleration and deceleration, and I can't find anything unusual. Are you sure you just aren't reaching the limits of your extruder?

@luke321
Copy link
Author

luke321 commented Sep 17, 2013

i use max feedrate 80mm/s start feedrate 10mm/s and acceleration of 2000mm/s^2. It works fine alle the time, thanks to your fix, except after this small moves the extruder stalls. Maybe it's because you have rostock max and I use a rostock mini? Different computation of the kinematics?

@karloygard
Copy link
Contributor

Okay, I'll do some more testing tonight with your values.

@luke321
Copy link
Author

luke321 commented Sep 17, 2013

okay I really don't know what is happening here:

G1 X-6 Y-13 F36000.000
G1 X-6 Y-13.02

or

G1 X-6.281 Y-13.81 F36000.000
G1 X-6.281 Y-13.821
produce a stall

G1 X-6.01 Y-13 F36000.000
G1 X-6.01 Y-13.02
produces no stall!
it is not only related to distance but also to the position of the endeffector...

@kyrreaa
Copy link
Contributor

kyrreaa commented Sep 17, 2013

I suggest looking at the code that calculates the length of the movement vector.
Since it does a lot of cross-multiplications/sums it may “tick over” on the float representation.
I seem to recall not liking that that some of the math happens in floats though I may be wrong and it happens in int32.
Still due to the reduced representations available in floats there may be hickups there. Especially with the delta movements to consider.

Kyrre

From: luke321
Sent: Tuesday, September 17, 2013 4:22 PM
To: repetier/Repetier-Firmware
Subject: Re: [Repetier-Firmware] Extruder stalls because of problematic Gcode (instant retract without printing anything) (#151)

okay I really don't know what is happening here:

G1 X-6 Y-13 F36000.000
G1 X-6 Y-13.02

or

G1 X-6.281 Y-13.81 F36000.000
G1 X-6.281 Y-13.821
produce a stall

G1 X-6.01 Y-13 F36000.000
G1 X-6.01 Y-13.02
produces no stall!

it is not only related to distance but also to the position of the endeffector...


Reply to this email directly or view it on GitHub.

@luke321
Copy link
Author

luke321 commented Sep 17, 2013

what I don't understand is why a mixed xyze move destroys the start speed settings of an Eonlymove which should always be safe if I understand the code correctly...

this part in motion.cpp should prevent the forward and backward planner to mess with EOnlyMoves right?

if(previous->isEOnlyMove() != act->isEOnlyMove())
{
previous->setEndSpeedFixed(true);
act->setStartSpeedFixed(true);
act->updateStepsParameter();
firstLine->unblock();
return;
}

So the start speed settings of the EOnlyMove are incorrect even before the updateTrapezoids function is called?

how can I view the Debug messages?

@kyrreaa
Copy link
Contributor

kyrreaa commented Sep 17, 2013

Well, that code only runns if they are not equal.
If previous is a Eonly and active is not, it runns.
If previous is not Eonly and active is, it runns.

Is this the expected behaviour?
What I wonder is what is the source of the start speed of the Eonly move that follows a non Eonly move.

Kyrre

From: luke321
Sent: Tuesday, September 17, 2013 10:40 PM
To: repetier/Repetier-Firmware
Cc: kyrreaa
Subject: Re: [Repetier-Firmware] Extruder stalls because of problematic Gcode (instant retract without printing anything) (#151)

what I don't understand is why a mixed xyze move destroys the start speed settings of an Eonlymove which should always be safe if I understand the code correctly...

this part in motion.cpp should prevent the forward and backward planner to mess with EOnlyMoves right?

if(previous->isEOnlyMove() != act->isEOnlyMove())
{
previous->setEndSpeedFixed(true);
act->setStartSpeedFixed(true);
act->updateStepsParameter();
firstLine->unblock();
return;
}

So the start speed settings of the EOnlyMove are incorrect even before the updateTrapezoids function is called?

how can I view the Debug messages?


Reply to this email directly or view it on GitHub.

@luke321
Copy link
Author

luke321 commented Sep 17, 2013

by default startspeed and endspeed should be computed with safespeed() as far as I looked into the code...
so 0.5*maxExtruderfeedrate.. but somehow this gets overriden...

it gets set in PrintLine::calculateMove()
startSpeed = endSpeed = safeSpeed();

I tried to set some parameters for the EOnlyMove like this.
if(act->isEOnlyMove())
{
act->startSpeed = 10;
act->endSpeed = 10;
act->fullSpeed = 10;
act->invFullSpeed = 0.1;
}
it had no effect...

@karloygard
Copy link
Contributor

Luke,

Can you slow the acceleration way down to see exactly what the extruder is doing? I've been doing that in order to check that accel/decel actually runs. Set accel to eg. 50.

If you turn on Echo in Repetier, you'll get tons of debugging, but it's not very easy to decipher. There is more logging to be had as well, but that requires recompiling the firmware.

  • Karl

@luke321
Copy link
Author

luke321 commented Sep 18, 2013

okay it works with acceleration values up to 100 mm/s^2...

where do i have to activate echo? In repetier.h i activated debugging but I'm still getting nothing in repetier host. Or do I have to use another programm for debugging?

@repetier
Copy link
Owner

Ok, vacation is over and I'm ready to join the problem.

First thanks to @karloygard , you were right with your observation. I never checked the queueEOnly. I have now deleted that line you changed and changed in the function the distance calculation to
p->distance = axis_diff[E_AXIS] = p->delta[E_AXIS]*Printer::invAxisStepsPerMM[E_AXIS];

that should have the same effect, since delta is always positive and it removes one computation to speed up computation.

For debugging make sure repetier.h has
#define DEBUG_QUEUE_MOVE
which is often the case in develeopment version. Then enable echo and you see computed steps/accelerations in the log.

With the small moves followed by pure e move the emove should start with start speed,since
if(previous->isEOnlyMove() != act->isEOnlyMove())
should prevent speed changes. If you debug your short move, does it show wrong start values for the e only move?

@luke321
Copy link
Author

luke321 commented Sep 18, 2013

found the problem:

this is a after a small move with stall:

i added the right parameters in comparision to a working move

16:56:13.283 : N57 G1 E7.77051 F4800 *24
16:56:13.349 : ID:2449 <-- I quess this is from the previous small move? in the correct version there is only one ID
16:56:13.349 : vStart/End:166/5
16:56:13.349 : accel/decel steps:65/66/132
16:56:13.349 : st./end speed:7.3/0.2
16:56:13.349 : Flags:128
16:56:13.349 : joinFlags:7
16:56:13.349 : ID:2570 <-- the ratract move
16:56:13.349 : vStart/End:41666/2599 <-- 2599/2599
16:56:13.349 : accel/decel steps:1/832/4160 <-- 1 accel step!!!!
16:56:13.349 : st./end speed:0.2/0.0 <-- 5.0/5.0
16:56:13.349 : Flags:130
16:56:13.349 : joinFlags:5
16:56:13.349 : ID:2570
16:56:13.349 : Delta 0 1 0 4160 <-- in the working move this is 0 0 0 4160
16:56:13.349 : Dir:165 <-- should be 128
16:56:13.349 : Flags:2
16:56:13.349 : fullSpeed:0.23
16:56:13.349 : vMax:41666
16:56:13.349 : Acceleration:0.25 <-- in the working retract this is 32000
16:56:13.349 : Acceleration Prim:1040000
16:56:13.349 : Remaining steps:4160
16:56:13.349 : LimitInterval:384
16:56:13.349 : Move distance on the XYZ space:0.02 <--- this should be 8 because my retract move is 8mm
16:56:13.349 : Commanded feedrate:80.00
16:56:13.349 : Constant full speed move time:1597440.00
16:56:13.349 : Echo:G1 E7.7705 F4800.00

for me it looks like the retract move is getting mixed up with the short travel move.. because the distance is exactly the 0.02mm the travel move should have...

here is the link to the complete log files: https://www.dropbox.com/s/gku5ow7r1d4m89t/stall.rar

ps.: welcome back! i hope you guys can fix this, than my rostock mini would be perfect ;)

@luke321
Copy link
Author

luke321 commented Sep 20, 2013

Sometimes the z lift after the retract is also very jumpy! maybe this is also connected to this and the z-lift happens with 1 accel step?

@repetier
Copy link
Owner

I just uploaded a new dev. version, where I changed rounding to steps. Can you test if your examples get no 1 step moves with extrusion with them? I tried to get your problem with different coordinates, but all tests got 0 for xyz, so I could not test if it helps.

@luke321
Copy link
Author

luke321 commented Sep 20, 2013

It is working with the above example! I'll try some other prints tomorrow and give you feedback!

@luke321
Copy link
Author

luke321 commented Sep 21, 2013

Okay I had it happen one time today, while printing the tree frog. I'm gonna try to find the specific part of the code.
But I printed a lot of parts with small moves and lots of retracts and they worked perfectly! So it definitely got much better!

@repetier
Copy link
Owner

I have just finished an other change but not uploaded yet. It makes E move dominant if e > xyz move, which should even help if you get such rounding errors. First tests show correct move data, but I want to run a test print before I upload that version.

@luke321
Copy link
Author

luke321 commented Sep 21, 2013

okay please post here as soon as you uploaded it and I will check it out!
I found another case where the retract stalls even with the newewst version!

G21 ; set units to millimeters
G28
G90 ; use absolute coordinates
G92 E0
M82 ; use absolute distances for extrusion
M106 S153
G1 Z1.550 F36000.000
G1 F4800.000 E8.00000
G1 X-15.443 Y-2.851 F1200.000 E8.00031
G1 X-15.656 Y-2.894 F36000.000
G1 X-15.666 Y-2.883 F1200.000 E8.00050
G1 F4800.000 E0.00050
G1 Z2.550 F36000.000

@repetier
Copy link
Owner

Ok, test print looked ok, so I uploaded the latest change. Hope that solves all remaining problems.

@luke321
Copy link
Author

luke321 commented Sep 21, 2013

It works with the above example! I think its resolved now if I find anything else I post back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants