Gcode Error - Any Ideas?

System: running webcontrol on RPI 3B
Gcode Generator: Inkscape:

This is my first non ground-control cut. I’ve been driving the sled around and verifying it works before trying anything else.

So here’s the code (the comments in the parentheses are mine) :

M3 (begin)
G21 (All units in mm)
G00 Z 5.0000 (raise Z axis to travel height)
G00 X 331.3930 Y 131.5208 (move to first cut position)
G01 Z -4.0000 F 1000.0000 (Penetrate)

G02 X 333.3425 Y 131.2956 Z -4.0000 I -0.6426 J -14.1182 F 800.0000

It failed at the space and never actually cut after the plunge. I didn’t screenshot the error, so I can’t tell you exactly what it said but something about a gcode error… The router won’t retract now and I can’t tell if it is in fake servo mode. The serial port shows up, so it didn’t disconnect and the device is connected.

My Questions:

  1. What is wrong with the Gcode?

my guess is the 1000 mm/min plunge speed is higher than recommended by the firmware, but it is a direct drive, so no chain jumping there - checked the webcontrol setting and it was maxxed at 800, but it plunged and then stopped.

  1. How do I reset the system without doing the 12:00 reset? The system is plunged at 4 mm at X 331.3930 Y 131.5208 How do I tell it that is where it is and then unplunge and have it go home?

there are probably more details in the log, cn you see what’s there?

it may be stopped, try hitting the stop and/or play buttons.

Also, GroundControl has a menu option to create a diagnostic bundle tht gathers
the logs and configs so that you can upload them.

David Lang

Looks like the problem is that the gcode doesn’t include a positioning command (G90 or G91). Webcontrol does some fancy things and ‘needs’ that to be in the gcode file to do them. In the gcode ‘standard’ is there a default value (i.e., absolute or relative) when positioning is not specified?

One of the issues with webcontrol is that a thread can crash (this time, the serial port thread) and you don’t really know since part of the program is still responsive. Maybe I need a watchdog thread that checks the status of threads so an error message can be reported.

thanks for responding so quickly.

I pulled the logs from webcontrol. Here’s the most recent lines of interest:

From ALog.txt

12.90: Firmware Version 1.26
12.90: Ground Control Version 1.27
12.90: ok
12.91: Sent: G21
12.91: G21
12.91: ok
12.97: Sent: $$
12.99: $0=2438.40 (machine width, mm)
13.00: $1=1219.19995117 (machine height, mm)
13.01: $2=3010.01025390 (motor distance, mm)
13.01: $3=660.00000000 (motor height, mm)
13.02: $4=310.00000000 (sled width, mm)
13.03: $5=92.07500457 (sled height, mm)
13.04: $6=79.00000000 (sled cg, mm)
13.05: $7=2 (Kinematics Type 1=Quadrilateral, 2=Triangular)
13.05: $8=139.69999694 (rotation radius, mm)
13.06: $9=2000 (axis idle before detach, ms)
13.07: $10=3360 (full length of chain, mm)
13.07: $11=1650 (calibration chain length, mm)
13.08: $12=8113.72998046 (main steps per revolution)
13.09: $13=63.50000000 (distance / rotation, mm)
13.10: $15=800 (max feed, mm/min)
13.10: $16=1 (Auto Z Axis, 1 = Yes)
13.11: $17=0 (auto spindle enable 1=servo, 2=relay_h, 3=relay_l)
13.12: $18=12.60000038 (max z axis RPM)
13.13: $19=3.17000007 (z axis distance / rotation)
13.13: $20=7560.00000000 (z axis steps per revolution)
13.14: $21=1300.00000000 (main Kp Pos)
13.15: $22=0.00000000 (main Ki Pos)
13.15: $23=34.00000000 (main Kd Pos)
13.16: $24=1.00000000 (main Pos proportional weight)
13.17: $25=5.00000000 (main Kp Velocity)
13.18: $26=0.00000000 (main Ki Velocity)
13.20: $27=0.27999999 (main Kd Velocity)
13.21: $28=1.00000000 (main Velocity proportional weight)
13.23: $29=1300.00000000 (z axis Kp Pos)
13.24: $30=0.00000000 (z axis Ki Pos)
13.25: $31=34.00000000 (z axis Kd Pos)
13.26: $32=1.00000000 (z axis Pos proportional weight)
13.27: $33=5.00000000 (z axis Kp Velocity)
13.28: $34=0.00000000 (z axis Ki Velocity)
13.28: $35=0.27999999 (z axis Kd Velocity)
13.29: $36=1.00000000 (z axis Velocity proportional weight)
13.30: $37=9.50029850 (chain sag correction value)
13.31: $38=2 (chain over sprocket)
13.32: $39=3 (PWM frequency value 1=39,000Hz, 2=4,100Hz, 3=490Hz)
13.33: $40=0.00000000 (chain tolerance, left chain, mm)
13.34: $41=0.00000000 (chain tolerance, right chain, mm)
13.35: $42=2.00000000 (position error alarm limit, mm)
13.35: $43=0.00000000 (reserved1, deg)
13.36: $44=0.00000000 (reserved2, mm)
13.37: $45=0.00000517 (chain stretch factor, m/m/N)
13.37: $46=92.07500457 (Sled Weight, N)
13.38:
13.38: ok
13.38: Sent: $45=0.00000516850
13.40: ok
172.83: Sent: %
172.84: ok
172.92: Sent: M3
172.93: M3
172.93: ok
172.99: Sent: G21
173.00: G21
173.01: ok
173.07: Sent: G00 Z5.0000
173.09: G00 Z5.0000
174.89: ok
174.89: Sent: G00 X131.3929999999999723 Y201.520800
174.91: G00 X131.3929999999999723 Y201.520800

from the log.txt file

172.83: Sent: %
172.84: ok
172.86: <Idle,MPos:-199.99,69.88,3.80,WPos:0.000,0.000,0.000>
172.86: [PE:0.00,0.00,127]
172.92: Sent: M3
172.93: M3
172.93: ok
172.99: Sent: G21
173.00: G21
173.01: ok
173.07: Sent: G00 Z5.0000
173.08: <Idle,MPos:-199.99,69.88,3.80,WPos:0.000,0.000,0.000>
173.09: [PE:0.00,0.00,127]
173.09: G00 Z5.0000
173.26: <Idle,MPos:-199.99,69.88,3.85,WPos:0.000,0.000,0.000>
173.27: [PE:-0.03,-0.02,127]

174.73: <Idle,MPos:-199.99,69.88,4.84,WPos:0.000,0.000,0.000>
174.74: [PE:0.00,0.00,127]
174.89: ok
174.89: Sent: G00 X131.3929999999999723 Y201.520800
174.91: G00 X131.3929999999999723 Y201.520800
174.94: <Idle,MPos:-199.62,70.03,4.98,WPos:0.000,0.000,0.000>
174.95: [PE:-0.17,0.38,127]

175.78: <Idle,MPos:-189.21,74.17,4.96,WPos:0.000,0.000,0.000>
175.79: [PE:-0.45,0.99,127]
from the log.txt file:

I don’t see a G90 or G91.

I wonder if rpi display driver is conflicting with anything. I’ll look into it more.

No, add either g90 or g91 to your gcode… It’s not there.

I think absolute is the standard, but you are right that the file should specify. Without specifying in the gcode there is no way to know for sure.

  • G90 | Distance Mode - Absolute
  • G91 | Distance Mode - Relative

but the file I used in ground control did not specify. This is expected?

Right, so you should be able to tack a G90 onto the front of the file and it should work. Most programs which export gcode will do that by default, often times you will see something like G90 G21 to specify the units (inches or mm) and if they are relative or absolute coordinates

Cool Thanks so much for the quick response! You guys are amazing! I added a header file in the directory where inkscape writes the gcode file and it gets put in there now. So the first question is answered (pending verification run).

The second question was: How do I get the system functional or must I reset the chain lengths?

1 Like

You need to restart webcontrol. You don’t need to reset the chains.

2 Likes

I ssh’d into the pi and

sudo reboot

It rebooted and showed up at the right coordinates (show sled position in webcontrol - ON).

Thanks. I think it will be fine. Inkscape lets you put a file named “header” in the gcode write directory and it will prefix your gcode with whatever is in there. I’ll hopefully get to run it a little later today, if not tomorrow morning.

HAPPY NEW YEAR!!

2 Likes

So it cut, but on the second try. It went part way, failed due to

ALARM: The sled is not keeping up with its expected position and has halted. Click the ‘Stop’ button to clear the alarm. More information at: https://github.com/MaslowCNC/Firmware/wiki/Keeping-Up
4183.04: [Forward Calculating Position]

In a moment of insanity I started it again and it retraced the first few cuts, which was painfully slow to watch and then it fully completed.

Thanks for your help.

This issue crops up mostly with maxed feedrates with the sled near the top center of the board (that’s where the motors are working the most). Try slowing the feedrate down. Also, webcontrol has the ability to start from an arbitrary point in the gcode. You just need to click through the gcode or enter the gcode index line number. Webcontrol was written so to make sure the machine is in the proper state when starting at an arbitrary point (units, positioning, spindle control) and move to the starting point at safe height. I’ve tested it a lot, but with everything I can’t guarantee success. Ground control uses a much simpler method (just starts sending gcode) and it’s up to the user to make sure everything is correct.

This is configurable in the settings, the idea was that if the motors are not
moving as fast as we think they should, we should alarm.

However, since we have no allowance for acceleration, this ends up alarming much
too frequently when you have high feed rates.

It should be useful in the future, but right now I would suggest setting it to a
much larger value to effectively disable it.

David Lang

To disable it, I think it’s under advanced settings -> positional error limit (or something like that) increase it to a large number to effectively disable it. The default is 2 mm.

What the alarm does is tells you the sled isn’t where it should be after completing a move. After every gcode move in the file, the controller calculates it’s position based upon the motor encoders and compares it to the gcode’s end coordinates. If the difference is greater than the positional error limit, it throws an alarm.

Clarification, it’s not after every gcode move, it’s several times a second.

So when you have g-code that tells the machine to go from stopped to full speed,
and it takes time for the machine to get to full speed (in part because the PID
loop ramps up the power rather than slamming it to full power instantly, in part
because of mechanical inertia), it is very easy to trip this alarm.

David Lang

Yeah, I was confusing it with something I was working on. The controller only does a check to determine if the chain length error is greater than the limit, not the position of the sled… and it does it a couple times a second (when it reports error values to webcontrol/ground control)