LaserWeb / LaserWeb4

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

Implementing A-Axes #304

Closed cprezzi closed 7 years ago

cprezzi commented 7 years ago

Since I have added an A-axes to grbl-LPC, we also need to add it to LW4 ;)

I did add a "Machine A Stage" toggle switch to the machine settings (corresponding to "Machine Z Stage") and included the A-axes in the DRO including Jog buttons (only shown if the "A Stage" is active).

Know, how do we want to show the A position on the workspace?

cprezzi commented 7 years ago

If A is a rotary axes, we could map A to X or Y (depending on axis orientation). What do you think? @openhardwarecoza @jorgerobles @tbfleming

jorgerobles commented 7 years ago

Good question. Should we put a flat compass overlay on a workspace corner? A position will rotate the compass. Could be an svg with css transform, no webgl required...

El 13 may. 2017 16:28, "Claudio Prezzi" notifications@github.com escribió:

Since I have added an A-axes to grbl-LPC, we also need to add it to LW4 ;)

I did add a "Machine A Stage" toggle switch to the machine settings (corresponding to "Machine Z Stage") and included the A-axes in the DRO including Jog buttons (only shown if the "A Stage" is active).

Know, how do we want to show the A position on the workspace?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/304, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoIYAfCcW2ttkBtAJLpx8D95QpPLFERks5r5b4JgaJpZM4NaFi2 .

cprezzi commented 7 years ago

The question is also, how we can show the gcode in the workspace?

jorgerobles commented 7 years ago

That's harder. @tbfleming?

El 13 may. 2017 4:37 p. m., "Claudio Prezzi" notifications@github.com escribió:

The question is also, how we can show the gcode in the workspace?

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

tbfleming commented 7 years ago

Since I have added an A-axes to grbl-LPC, we also need to add it to LW4 ;)

I laughed when I read this. It implies that other firmware isn't worth it...

The question is also, how we can show the gcode in the workspace?

This gets tricky:

  1. The gcode spec says A is parallel to X. Do we hold to that spec and prevent users from positioning A differently?
  2. We need a way to specify where the A axis is, unless we fix it to Y=0, Z=0. If we fix it there, then we enter Y negative space. Do we drop the recommendation that X, Y shouldn't go negative?
  3. An A axis move turns a line into a curve. Option 1A: we could do this conversion before WebGL, which is easy to implement, easy to explain, but can slow down execution and adds a new segment length config. Option 1B: draw curves on the GPU, which takes us further down the path of no one else understanding the WebGL code.
  4. I used a Smoothie-specific approach on the CAM side which changes the A units from degrees to mm on the cylinder surface. We probably need to drop that approach and switch it to degrees.
cprezzi commented 7 years ago

@tbfleming You are right could be missunderstud ;) Was just meant that I am right in a flow...

cprezzi commented 7 years ago
  1. It's hard to prevent users from doing anything if you don't stand by their side ;) but I would go with the gcode spec.
  2. We already dropped this recommendation by adding the workspace origin offset. This makes absolute sense for milling, but A origin offsets are needed to be universal.
  3. I'm a noob in this field.
  4. Good question. What is the most usecase for a rotary axes? Projection of a 2d vector grafic to the surface of a zylinder? That could at least be a good starting point. It would clearly be nice to show the zylinder projection in the workspace, but an easyer solution could be to just take A as Y (flat).
jorgerobles commented 7 years ago

1.gcode spec

  1. I would go for 1A for the moment. Adding a new segment length is not a big issue.
  2. I should use the flat projection. If not, the cylinder has to be parametrized also.

:)

tbfleming commented 7 years ago

Flat projection means we won't have to deal with curves and segment length.

jorgerobles commented 7 years ago

Oh, I misread. Go for it :)

tbfleming commented 7 years ago

Did the easy part 1st. The preview now adds A to Y. This comes out right for the existing CAM, but the scale will be off once the CAM switches A to degrees.

tbfleming commented 7 years ago

Path CAM is now degrees. Untested.

cprezzi commented 7 years ago

Can we reatch it somehow, that the A to Y scaling is 1:1? I mean, if the document shows 100mm in Y, then also A shows 100mm in grid Y? How can I feedback the tool position? Could you add a A axis, or should I just feed A as Y?

tbfleming commented 7 years ago

We need to make a choice: do we scale A to Y in the gcode preview to match mm on a cylinder, or do we scale A to Y in the gcode preview to be degrees?

cprezzi commented 7 years ago

Good question. I think the first would lead to less questions from normal users, as this is what they expect when they engrave on a cylinder. Although the second would probably be correct from a proffesional gcode viewpoint (not sure).

jorgerobles commented 7 years ago

I would go for be easy for base user. Any professional guy should know what it's done and why (At least for a first approach)

jorgerobles commented 7 years ago

One noob question. If I got my roller at the middle of the bed, say Y100 of 200, how do I move it to that position, then start to engrave over the cylinder, and how is that represented in a easy to user way? I know using A is not noob task but I think is confusing right now isn't it? Indeed I made a roller a couple weeks ago, lying around and I'm dying to use it :D

jorgerobles commented 7 years ago

Should we use Y axis machine offset to begin A projection?

image

cprezzi commented 7 years ago

I see the process like this:

  1. Jog to X/Y (/Z) origin of rotary axes (via Macro, if rotary axes has a fixed position).
  2. SetZero
  3. Start Job in X/A axis

With this process, the gcode should be in X+/A+ quadrant. The workspace origin (can/should) represent the rotary axis origin position (XY).

tbfleming commented 7 years ago

I've always been uneasy with shifting the grid. That screenshot reinforces my unease. gcode is in wpos so we should draw wpos.

tbfleming commented 7 years ago

Here's how shifting the grid is biting us:

i.e. the way to fix the problem is to abandon mpos.

jorgerobles commented 7 years ago

Many people don't have so abstract view and expect the workspace resemble their machine (a la reprap). Currently grid shifting is only visual :)

tbfleming commented 7 years ago

It is only visual, but look at the confusion it causes when you don't position the rotary at MPos Y=0.

cprezzi commented 7 years ago

@tbfleming You are kind of right. At the moment we mix wpos and mpos, as gcode relates to wco origin, but workspace has machine size!

jorgerobles commented 7 years ago

We are f***up already :rofl:

tbfleming commented 7 years ago

I'm starting to think of it this way:

cprezzi commented 7 years ago

What if we read the real work offset from the machine and move the work origin (including gcode) on the workspace to that location? The workspace total size would stay like it is and represent the machine size. This would mean we just have to store additional work offsets in the workspace.

jorgerobles commented 7 years ago

That idea came to my mind a while ago when included machine offset setting... I don't remember right now the issue when had mentioned​.

tbfleming commented 7 years ago

What if we read the real work offset from the machine and move the work origin (including gcode) on the workspace to that location? The workspace total size would stay like it is and represent the machine size.

This would still throw off the rotary position.

How about this?

Screen mock up: image

tbfleming commented 7 years ago

I didn't have negative area to work with when drawing that. Usually the lower-left marker would be at 0,0 or go into negative space.

jorgerobles commented 7 years ago

I think that should work lovely and will teach mpos and wpos easy.

tbfleming commented 7 years ago

Since the wpos origin would only affect the markers, it would be easy in the future to support machines where MPos 0,0 isn't the lower-left corner. Professional machines are often not like that, which is why GRBL isn't like that.

tbfleming commented 7 years ago

@cprezzi I'm getting "error: undefined" with Set Zero on grbl-lpc

tbfleming commented 7 years ago

I must be missing something. I got set zero to work, but it doesn't cause the grid to shift. I tried with both grbl and smoothie. @jorgerobles how do you shift the grid like in your screenshot?

jorgerobles commented 7 years ago

Settings- machine - machine origin :)

El 14 may. 2017 8:28 p. m., "Todd Fleming" notifications@github.com escribió:

I must be missing something. I got set zero to work, but it doesn't cause the grid to shift. I tried with both grbl and smoothie. @jorgerobles https://github.com/jorgerobles how do you shift the grid like in your screenshot?

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

tbfleming commented 7 years ago

Ah. I thought grid shift was tied to the wpos origin. So right now users have to set up their wpos origin and type that value into the config separately?

jorgerobles commented 7 years ago

Is unfinished (or fake) right now only paints baselines in other positions and coords numbering

El 14 may. 2017 8:33 p. m., "Todd Fleming" notifications@github.com escribió:

Ah. I thought grid shift was tied to the wpos origin. So right now users have to set up their wpos origin and type that value into the config separately?

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

tbfleming commented 7 years ago

Is there a way to get the wpos origin?

jorgerobles commented 7 years ago

Em nop that i know. Should be get from machine isn't it? Sorry i'm a bit confused.

El 14 may. 2017 8:40 p. m., "Todd Fleming" notifications@github.com escribió:

Is there a way to get the wpos origin?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/LaserWeb/LaserWeb4/issues/304#issuecomment-301331322, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoIYGAWcbeM1eG-Xhgoj4FuAbKKDQEEks5r50qIgaJpZM4NaFi2 .

tbfleming commented 7 years ago

Yes. We need to get the wpos origin from the machine.

tbfleming commented 7 years ago

Screenshot:

image

jorgerobles commented 7 years ago

Cooool. :) Will test tomorrow

tbfleming commented 7 years ago

Made it stand out more:

image

ghost commented 7 years ago

I missed the comments that this thread also talked about the new grid size. Sorry @jorgerobles

Anyways, to answer @cprezzi 's "The question is also, how we can show the gcode in the workspace?" in LW3 we had been working toward doing rotary preview like this: https://github.com/LaserWeb/deprecated-LaserWeb3/issues/51#issuecomment-236152662

ffc69788-558b-11e6-8a47-119e761f7845 (@HakanBastedt had the parser calculate it and segment it into a radius, then calculated XYZ positions to show it)

And threejs had an easy way to draw the helper 1e75a566-53ca-11e6-880f-35ee9b40abba

Just never got finished adding both together

cprezzi commented 7 years ago

@tbfleming We can get the work offset from the firmwares. It's just not programmed yet.

cprezzi commented 7 years ago

@tbfleming Question: What sense does it make that the grid is shown bigger than the machine? The user is always limited by the machine size. Theoretically, the grid (virtual) space is infinite, but users are used that only the machine space is shown (Repetier, Cura, Mach3...).

tbfleming commented 7 years ago

We could limit it to the machine size, or we could let the user choose.

cprezzi commented 7 years ago

I can see a case, where the part is bigger than the machine. For this case, it's bether like it is now, so the user could see the whole part and the limited machine space.

cprezzi commented 7 years ago

@openhardwarecoza @jorgerobles @tbfleming Did you realize that I have removed the Z-axes DRO and Jog buttons, if Z-Stage is not active in machine settings? Same for A-axes. Is this ok for you?

tbfleming commented 7 years ago

@cprezzi Makes sense to hide those.