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

Integrating data into macro #479

Closed
JensHauser opened this issue Jul 3, 2020 · 19 comments
Closed

Integrating data into macro #479

JensHauser opened this issue Jul 3, 2020 · 19 comments

Comments

@JensHauser
Copy link

Hi,

I use an ESP32 with ESP3D and a working macro with XYZ edge finding.

Now I want to enhance it with potential work piece rotation (G68).
Based on the measured values I can calculate a rotation angle to shift the WCS fitting the work piece.

Inside a macro? Can I "get back" data from the CNC for calucations somehow?

Jens

@github-actions
Copy link

github-actions bot commented Jul 3, 2020

Thank your for submiting, please be sure you followed template or your issue may be dismissed.

@luc-github
Copy link
Owner

currently macro just send commands and do not use / catch response
in 3.0 there is lua interpreter that would fit your need: send and handle response but not yet fully ready as miss user case

what you would do with the response of your command?

@JensHauser
Copy link
Author

My idea is to "ask" for the measured values of e.g. x1 and x2 (G38.2) at different locations of the work piece.
The difference should be calculated to a rotation angle of x axis at the current position, s.th. like G68 X0 Y0 R4.5

Maybe I´m thinking too complicated and there are other alternatives.

@luc-github
Copy link
Owner

sorry to ask as it is not clear for me and I am not familiar with this command
who calculate the difference and where it is used?
should be automated ? do you need to add pauses in gcode to manualy do some calculation?

@JensHauser
Copy link
Author

JensHauser commented Jul 3, 2020

Found a nice video explaining G68. He can do better than by written words :-)

The manual way by pausing is the second priority, it should be calculated automagically. The data is only needed to rotate the work piece once during milling.

@DivingDuck
Copy link

@JensHauser, I like to ask you what controller board / firmware you are using for this?

@JensHauser
Copy link
Author

The board is a self-developed one based on ESP32 devkit v4 and the firmware is GRBL_Esp32 and ESP3D master branch v2.1

Placing the XYZ finder on the work piece, editing the x1/x2 and y1/y2 distances in the ESP3D (so the edge finder can measure on existing workpiece and no beyond) and "go" would be nice :-)

@luc-github wrote about LUA, does this mean some scripting approach, which goes beyond GRBL sending and allows some interaction between script/user and GRBL?

@DivingDuck
Copy link

Interesting. Didn't knew GRBL is supporting G68/G69. Seems I need to do an knowledge update. Thanks for the information.

@JensHauser
Copy link
Author

It doesn't yet, the functionality can also achieved by G38.2. If I just get back the X1/X2 and Y1/Y2 values, the script could calculate the corrective angle.

@DivingDuck
Copy link

Ok, I got what you try to do. Thanks for your answer.

@luc-github
Copy link
Owner

luc-github commented Jul 5, 2020 via email

@JensHauser
Copy link
Author

JensHauser commented Jul 5, 2020 via email

@luc-github
Copy link
Owner

well if you can share a situation with all actions that need to be done step by step it would be helpful for to see how to convert it in lua script

@JensHauser
Copy link
Author

Use case "XYZ edge finding with auto rotation"

Motivation

  1. Overall target is
  • to switch from pure G code sender to an interactive scripting tool
  • allow getting back G code values (mostly what´s written in the "command" box of ESP3D, like coordinates)
  • feed them back into the calling script for calculations and assemble new G code operations before/during milling process
  • E.g. useful in or measurement operations ("where did the edge finder hit the work piece? -> point cloud")
  1. A work piece can't be mounted exactly on work surface, so it´d be synchronized with 3D model.
    So there is a risk that milling is performed out of bounds
  2. Finding work coordinate system (X, Y, Z) in order to start milling. In my case "G54"
  3. Based on preliminary work (Manual tool change for GRBL cncjs/cncjs#118)

Prerequisites

  1. Work piece is mounted tightly on work surface
  2. Edge finder connected and placed on work piece
  3. Work piece measures known
  4. Milling cutter installed, a few millimeters above edge finder surface
  5. Dimensions of edge finder are known to the program (height, width, depth, square landing area, )

Workflow

  • Log into web interface
  • Start program "Auto rotate"
  • Program asks for
    1. edge finder type (=various types with different sizes. I have an example...mine)
    2. milling cutter diameter [float]
    3. work piece measures X and Y [float]
    4. is milling cutter placed on expected area of edge finder? [boolean]
  • Program starts
  • Measure x2/y2 and x1/y1
  • Call function with (x2, y2, x1, y1) to calculate rotation angle
  • Now 2 options
    1. Call G code to rotate coordinate system with "G68 ..." (not implemented in GRBL right now)
    2. In the G code generator, e.g. Autodesk Fusion 360, enter this angle to generate "rotated" G code
  • Program stops

I have some more material for handling and calculations, but wanted to start with this in order to align the way we could go.

@JensHauser
Copy link
Author

Is it possible to show up a custom message in ESP3D master, e.g. "Please change from tool A to tool B now" ?

@luc-github
Copy link
Owner

there is no such feature, you can only display text in terminal by usinh M118 command with Marlin like FW but grbl does not have such command as far I know

@stale
Copy link

stale bot commented Aug 16, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 16, 2020
@stale
Copy link

stale bot commented Aug 19, 2020

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Aug 19, 2020
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants