LaserWeb / deprecated-LaserWeb3

Open Source Laser Cutter / Engraver software. Supports gcode, svg, dxf, stl, png, jpg, bmp
265 stars 68 forks source link

Scientific notation in generated GCODE generates error in GRBL #147

Closed maudette01432 closed 7 years ago

maudette01432 commented 7 years ago

Scientific notation in generated GCODE generates an error in GRBL. This in turn causes the LW3 communications to lockup and in my case leaves the laser in an unsafe state (stalled and still firing laser).

The console server shows the following:

Sent: G1 F1200 X9.02687276038705e-7 Y18.46436716475577 Z0 S255 Q: 2575 Recv: error: Unsupported command

GCODE is here: LW3_HOP_A32P5.zip

The only way to get the laser into a safe state is to reset the controller again. Universal GCODE Sender (UGS) continues on it's way even after the error resulting in an engrave (likely with a missed coordinate). This GCODE may also be causing the issues with my RAMPS setup locking up or loosing communication as well.

Since the precision on my banggood A3 2.5W is only about 0.0125 mm step (80 steps/mm)...this type of precision is overkill (likely on any laser setup). It would be best to output standard fixed notation with precision as documented on the G-code wiki. There are potentially 2 issues here:

1) Generated GCODE should used fixed precision 1a) The precision should be one ten-thousandth of an inch (0.0001"), which is a larger distance than the usual minimum increment in G21 (one thousandth of a millimeter, .001) 1b) 1a is referenced from the G20/G21 documentation on the G-code wiki 2) When Gcode generates an error condition the sender needs to be able to recover 2a) Continue sending commands or stop the machine and make sure the laser is disabled 2b) GRBL isn't locking up the sender is.

emteeoh commented 7 years ago

um... Was this GCODE generated by LW? if so, what was it generated from?

maudette01432 commented 7 years ago

This code was generated from LaserWeb3. Imported SVG scaled at 120 DPI and Exported with my machine settings. I have no START GCODE and no HOMING Sequence so there is nothing at the start of the file (including a header - maybe a but because the "Required" Homing sequence field was left empty?)

Windows 10 grbl-server.

I'll upload my config file today. 100% this was generated with LW3 and I can reproduce it with the SVG file. Really the GCODE out of LW3 seems to have way more precision than it needs ;)

ghost commented 7 years ago

I suspect we need a toFixed(2) somewhere there in threegcode.js

On Sep 27, 2016 5:22 PM, "maudette01432" notifications@github.com wrote:

This code was generated from LaserWeb3. Imported SVG scaled at 120 DPI and Exported with my machine settings. I have no START GCODE and no HOMING Sequence so there is nothing at the start of the file (including a header - maybe a but because the "Required" Homing sequence field was left empty?)

Windows 10 grbl-server.

I'll upload my config file today. 100% this was generated with LW3 and I can reproduce it with the SVG file.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openhardwarecoza/LaserWeb3/issues/147#issuecomment-249896878, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr24O2kKMn5d4EZ6PDFWwjJgMVKsMKks5quTPMgaJpZM4KF-xn .

ghost commented 7 years ago

Can you upload the file that gave you that issue, so I can test while fixing?

maudette01432 commented 7 years ago

sf_hop_test.zip

I've attached a modified version of the file here...it does however still reproduce the problem (it's in the outline - I just removed some of the "core" junk.

Open SVG sf_hop_test.svg On the SVG set DPI to 120 Press Generate G-Code Save Gcode

I've also attached the config I'm using for my Banggood A3 2.5W engraver (JT-Photonics GRBL 0.9) A3_2.5W_LASER.json.zip

Definitely need a toFixed with 4-5 decimal places (This will allow .1 thou accuracy in inches...which is a pipe dream on just about any machine) - that should correct an issue and get rid of lots of extra GCODE characters to send as well as fixing the scientific 9.xxxxxe-7 junk

maudette01432 commented 7 years ago

I modified my local copy of threegcode.js and formatted all the output strings using xpos, ypos, and zpos to utilized .toFixed(4) - this still has accuracy required for G20/G21 reduces output file sizes and fixes the issue with the scientific notation. I didn't clone the repo, but will if you want me to commit the change.

I have attached the modified file here.

threegcode.zip

gndprx commented 7 years ago

What is considered acceptable resolution? 4-digit should be beyond accurate for the capabilities of most machines I would think.

maudette01432 commented 7 years ago

As mentioned earlier. 4 digits covers us for G20 and G2 (inches and metric).

1a) The precision should be one ten-thousandth of an inch (0.0001"), which is a larger distance than the usual minimum increment in G21 (one thousandth of a millimeter, .001) 1b) 1a is referenced from the G20/G21 documentation on the G-code wiki

This is what I modified my local code for and attached the mod in the prior post. Works good...haven't tested on actual hardware yet.

ghost commented 7 years ago

Please send it as a pull request: easier for me to merge (i'm on the road - taking a bit of a quick holiday) - i can merge the pull via github's webpage (:

On Oct 5, 2016 12:54 PM, "maudette01432" notifications@github.com wrote:

As mentioned earlier. 4 digits covers us for G20 and G2 (inches and metric).

1a) The precision should be one ten-thousandth of an inch (0.0001"), which is a larger distance than the usual minimum increment in G21 (one thousandth of a millimeter, .001) 1b) 1a is referenced from the G20/G21 documentation on the G-code wiki

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openhardwarecoza/LaserWeb3/issues/147#issuecomment-251643351, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr22CDRQwGTGOPDTawei81K9XGPaXVks5qw4HmgaJpZM4KF-xn .

ghost commented 7 years ago

I gave @maudette01432 push access to both lw3 and lw4 repos

maudette01432 commented 7 years ago

Tried to push...getting permission error

fatal: unable to access 'https://github.com/openhardwarecoza/LaserWeb3.git/': The requested URL returned error: 403 root@LENOVO-LAPTOP:/mnt/c/LW3_EDIT/LaserWeb3/public/js# git push origin master Username for 'https://github.com': XXXX Password for 'https://XXXX@github.com': remote: Permission to openhardwarecoza/LaserWeb3.git denied to maudette01432. fatal: unable to access 'https://github.com/openhardwarecoza/LaserWeb3.git/': The requested URL returned error: 403

It's letting me login with said username/password (I changed XXXX to protect me). Do I have to fork before I can push and have someone else merge in the change. (Github noob..have used git for other projects but not with github).

ghost commented 7 years ago

Github shows you havent accepted the invite yet

On Oct 7, 2016 12:34 AM, "maudette01432" notifications@github.com wrote:

Tried to push...getting permission error

fatal: unable to access 'https://github.com/openhardwarecoza/LaserWeb3. git/': The requested URL returned error: 403 root@LENOVO-LAPTOP:/mnt/c/LW3_EDIT/LaserWeb3/public/js# git push origin master Username for 'https://github.com': XXXX Password for 'https://XXXX@github.com': remote: Permission to openhardwarecoza/LaserWeb3.git denied to maudette01432. fatal: unable to access 'https://github.com/openhardwarecoza/LaserWeb3. git/': The requested URL returned error: 403

It's letting me login with said username/password (I changed XXXX to protect me). Do I have to fork before I can push and have someone else merge in the change. (Github noob..have used git for other projects but not with github).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openhardwarecoza/LaserWeb3/issues/147#issuecomment-252107573, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2-6qK-F2EtWPeJz-fCi4FaW0ILvmks5qxXddgaJpZM4KF-xn .

maudette01432 commented 7 years ago

Thanks Peter. Normally I just use git locally. Accepting the invite and I was able to push.

ghost commented 7 years ago

Thanks for the help!