LaserWeb / LaserWeb4

Collaborative effort on the next version of LaserWeb / CNCWeb
GNU Affero General Public License v3.0
707 stars 191 forks source link

Show Time Remaining / Passes Remaining #110

Open cojarbi opened 7 years ago

cojarbi commented 7 years ago

We have in LW3 an estimated time the operation will take. It could be very useful to have this but to go a little further show a live counter with relevant information

iceblu3710 commented 7 years ago

The total time metrics are definitely the most useful as I currently keep a log of my 40W's tube hours so I know when I need to start saving for a replacement.

I imagine the GCODE could be parsed for line segments and every F change sum up the previous path and divide by that mm/min.

The downside is that would be a TON of Math.sqrt calls and I suspect something like a Raspberry Pi may freak out.

iceblu3710 commented 7 years ago

Just had a though. The Shoe Laser selection is a canvas context. You could count all the green pixels and then apply the average feed rate that dpi. Would be waaaay faster and probably accurate enough for a guesstimate time.

cprezzi commented 7 years ago

I do already have "some" job metrics on server side:

Job started at Fri Feb 24 2017 18:24:26 GMT+0100 (Mitteleuropäische Zeit)
Job finished at Fri Feb 24 2017 18:30:27 GMT+0100 (Mitteleuropäische Zeit)
Elapsed time: 361 seconds.
Ave. Speed: 333 lines/s

It should be possible to save a usage summary on server side, and let the client query it.

cprezzi commented 7 years ago

@cojarbi Where do we have an estimated time (preview) for the job duration in LW3? I only see a distance esimation.

ghost commented 7 years ago

We had it in LW2 - but with that big refactoring on the parser to increase its performance, it stopped working. Some of the code still exists though.

https://github.com/LaserWeb/LaserWeb3/blob/master/public/lib/gcode-viewer/gcode-parser.js#L756-L774

https://github.com/LaserWeb/LaserWeb3/blob/master/public/lib/gcode-viewer/gcode-parser.js#L788-L790

ghost commented 7 years ago

https://github.com/LaserWeb/LaserWeb3/blob/master/public/lib/gcode-viewer/gcode-parser.js#L773 was actually quite accurate (;

tbfleming commented 7 years ago

LW4's gcode preview uses an acceleration-less approximation for the slider.

cprezzi commented 7 years ago

Job stats from LW3 are back: grafik

cprezzi commented 7 years ago

I have an idea for the duration estimation, at least while the job is running. I could count how many queue lines was processed over a period (like 5s) and calculate the rest duration (ETA: like file transfer dialog from Windows).

ghost commented 7 years ago

I like that plan. Just like 'windows time' it can change through the job too. 2 hours from done. 5 min. 3 day. -2 seconds. 5 min lol

On Feb 24, 2017 9:25 PM, "Claudio Prezzi" notifications@github.com wrote:

I have an idea for the duration estimation, at least while the job is running. I could count how many queue lines was processed over a period (like 5s) and calculate the rest duration (ETA: like file transfer dialog from Windows).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/110#issuecomment-282381282, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2ysR8b9CotbUwa6yqsODxdKXwvZ3ks5rfy6agaJpZM4LXRHj .

cprezzi commented 7 years ago

Right, could jump around but people are used to it from Windows ;)

cojarbi commented 7 years ago

Thanks guys. The passes count would be more related to laser diode mostly as currently if I'm not mistaken enabling Z stage will rub a pass on all vectors and then change Z, socould that be a trigger?

cprezzi commented 7 years ago

@cojarbi Yes, that could be a trigger, but what if there is no Z change? Most Laser cutters don't have a Z-stage. The gcode generator could place a command into the code to tell me when a new pass starts? And probably at the start, how many passes to expect?

cojarbi commented 7 years ago

We have now a Z stage enable button and we need to select amount of passes , so if passes > 1 then start counting ??

cprezzi commented 7 years ago

I would't use Z-moves for that, as this would not work on milling. It should be very easy to add a comment line to the gcode when a new pass starts. @tbfleming @lautr3k What do you think?

jorgerobles commented 7 years ago

https://github.com/hudbrog/gCodeViewer has a worker we could use (CC-A-4.0)

tbfleming commented 7 years ago

We could add special comments to gcode generation to mark each operation and mark each pass. The sender could report back when it hits each one.

jorgerobles commented 7 years ago

@tbfleming I like the idea :) "#: Pass 1" ?

tbfleming commented 7 years ago

Comments are either ; blah or (blah): http://linuxcnc.org/docs/html/gcode/overview.html#gcode:comments

Maybe ; Operation: 3/4 Pass: 7/9

I prefer counting starts at 0; a single-operation single-pass file would have just a single marker: ; Operation: 0/1 Pass: 0/1

jorgerobles commented 7 years ago

Opps, My fault (jumbled comment marks.)

ghost commented 7 years ago

https://github.com/hudbrog/gCodeViewer was the original viewer, reworked first by John lauer to add G2/G3 parsing. Then reworked by Andrew Hodel to simplify, then reworked by me to add the laserweb grid, and the S value opacity. Then reworked by Håkan Båstedt to use Buffer Geometry for lower memory. So i wouldnt say go all the way back then. The parser we had in lw3 was plenty much better than its forefather (;

On Mar 21, 2017 10:38 PM, "Todd Fleming" notifications@github.com wrote:

We could add special comments to gcode generation to mark each operation and mark each pass. The sender could report back when it hits each one.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/110#issuecomment-288210895, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr26NDJ3SiK9LFedFcwRlXmI-bVGuQks5roDU8gaJpZM4LXRHj .

jorgerobles commented 7 years ago

Ok then. Will check for gcode time estimation :)

jonbev commented 7 years ago

@cprezzi noticed yesterday that if the last operation is a long one (in my case a rectangle that took about 2 mins to cut) the finished time is output at the time the operation is sent to the machine and not when it has finished. Anything you can do about that?

jorgerobles commented 7 years ago

@openhardwarecoza the LW3 parser does much more than estimating time maybe a leaner one purpose code, like https://github.com/cncjs/gcode-parser could help

ghost commented 7 years ago

Agreed, was just giving the history lesson as to where gcode.ws already did fit in (:

tbfleming commented 7 years ago

The temp parser doesn't do a lot; hopefully the replacement permanent parser also won't do a lot.

cprezzi commented 7 years ago

@jonbev At the moment, the job is "finished" when the last line has been accepted by the controller. At this time, the controller planner queue still has some commands to execute (max. 16 for Grbl or 32 for Smoothie). Unfortunatelly there is no event from the controller after a command has been executed.

It would probably be possible to wait until no moves are detected for a certain period, but that would be guesswork.

cprezzi commented 7 years ago

I see two things of interest. First the estimated duration in the CAM tab and second the job progress in JOG. Instead of showing the queue length aboove the DRO, I could show a progress bar of % queue position.

By the way: Wouldn't MACHINE or OPERATE be better names than JOG?

jorgerobles commented 7 years ago

@tbfleming please take a look to https://github.com/cncjs/gcode-toolpath Seems quality code regarding parsing. BTW, What does the tmpParser lacks of? I've seen a nice implementation of G2/G3 on https://github.com/cncjs/cncjs/blob/master/src/web/widgets/Visualizer/GCodeVisualizer.js

tbfleming commented 7 years ago

It looks like they made a fundamental error: they treat G numbers as strings. e.g. it will mishandle "G0.0", which is the same as "G0". I doubt any cam would generate "G0.0", but that kind of mistake makes me uneasy.

The temp parser only supports the tiny gcode subset that the rasterizer and path cam generates. It's missing G2/G3, inch mode, canned cycles, work coordinate systems (would be a major PITA to show graphically), and probably more.

jorgerobles commented 7 years ago

Seems can be added at will

motion: 'G0', // G0, G1, G2, G3, G38.2, G38.3, G38.4, G38.5, G80

2017-03-24 11:53 GMT+01:00 Todd Fleming notifications@github.com:

It looks like they made a fundamental error: they treat G numbers as strings. e.g. it will mishandle "G0.0", which is the same as "G0". I doubt any cam would generate "G0.0", but that kind of mistake makes me uneasy.

The temp parser only supports the tiny gcode subset that the rasterizer and path cam generates. It's missing G2/G3, inch mode, canned cycles, work coordinate systems (would be a major PITA to show graphically), and probably more.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/110#issuecomment-288991636, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoIYIeikZ3sPyMikyEqaQaQtjQVxN_Vks5ro6C8gaJpZM4LXRHj .

tbfleming commented 7 years ago

Here's where it accepts G0 but not G0.0: https://github.com/cncjs/gcode-toolpath/blob/master/src/index.js#L41

jorgerobles commented 7 years ago

What would be a good timing algorithm? I'm not trying to replicate the 18 steps planner of @chamnit, only get a nice ballpark (Improving @openhardwarecoza 's Factor 1.32 :smile: ), without getting mudded.

For each former line:

jorgerobles commented 7 years ago

..anyone...?

tbfleming commented 7 years ago

You've entered the realm of firmware-specific wild guessing. The only way to know which techniques produce reasonable approximations is to run a very large number of experiments covering a wide range of gcode files in combination with a wide range of firmware settings.

jorgerobles commented 7 years ago

:smile: I did plan to name the function guesstimate. Including a huge ballpark, the accuracy should be enough to tell if the job is about 1 hour, or 2, etc.Even with 3d printers, an accuracy of 85% is enough. Did you see any awful error in the algorithm? Not speaking of the Joint factor...

tbfleming commented 7 years ago

I don't see anything obvious, but I'm not sure what your steps mean.

cprezzi commented 7 years ago

Interesting use of LaserWeb2 code: http://dangerousprototypes.com/store/lasercut I got that link from someone who asked me if we could do something like that for his website.

ghost commented 7 years ago

Yeah I coded that up for Ian. I'll forward you the offline thread privately (;

On Mon, Jun 26, 2017 at 9:42 AM, Claudio Prezzi notifications@github.com wrote:

Interesting use of LaserWeb2 code: http://dangerousprototypes. com/store/lasercut I got that link from someone who asked me if we could do something like that for his website.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/110#issuecomment-310986053, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2xmh7j5zuLwNL5VO4qAjEaGApYLeks5sH2DagaJpZM4LXRHj .

ghost commented 7 years ago

Sent (:

On Mon, Jun 26, 2017 at 9:48 AM, Peter van der Walt (Gmail) < peter.plaaswerf@gmail.com> wrote:

Yeah I coded that up for Ian. I'll forward you the offline thread privately (;

On Mon, Jun 26, 2017 at 9:42 AM, Claudio Prezzi notifications@github.com wrote:

Interesting use of LaserWeb2 code: http://dangerousprototypes.com /store/lasercut I got that link from someone who asked me if we could do something like that for his website.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/110#issuecomment-310986053, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVr2xmh7j5zuLwNL5VO4qAjEaGApYLeks5sH2DagaJpZM4LXRHj .

jorgerobles commented 7 years ago

Reviewing this thread I almost forgot the guesstimator I made. I've got an epiphany right now, we could implement a deviation factor though using own user gcode. Kind of learning the machine deviation from several works. Will be ballparking anyways, but maybe more precise.