• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Fully automatic xyz cnc probe macro

Scheduled Pinned Locked Moved Solved
CNC
4
18
1.8k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    tyrod
    last edited by tyrod 2 Jul 2022, 17:40

    I've edited this post because I may have asked the wrong question before. Does anyone know of a way to write a macro to not only automate XYZ probe but to add in 2 separate X or Y points of probing to get exact position of a part that has been removed for some reason and now milling has to be resumed at exactly the same point. I know a simple peg system would work for a stock piece of material but after machining the first time the outer perimeter may have changed making it impossible to use the original alignment method, even flipping the part over is problematic. I have seen it done by other controllers(i believe it was UCCNC). I'm not a programmer by any means. I understand how to make simple macros but am unable to use any variables which i believe would be needed to accomplish this. I've searched the forums for a solution but so far nothing fits the bill😕 Codes such as G38, G60 G10, M581, G17, G18, G19 and M556 may provided a solution but it's beyond my abilities😖 Do all you cnc'ers think this would be a useful macro to have?
    Rod

    undefined undefined 3 Replies Last reply 15 Jul 2022, 18:05 Reply Quote 2
    • undefined
      tyrod @tyrod
      last edited by 15 Jul 2022, 18:05

      @tyrod
      bump

      1 Reply Last reply Reply Quote 0
      • undefined
        HebigT @tyrod
        last edited by HebigT 15 Jul 2022, 19:53

        @tyrod Not sure it helps, but have you seen this thread?

        https://forum.duet3d.com/topic/24706/automatic-tool-offset-xyz-for-syringe-printer/3?_=1652218329515

        Sorry if I already shared before.

        You may be able to use some of the published Gcodes to do part of what you want, but I agree that you will need variables, especially when you want to store and then reference the 'resume' position later on. I don't understand your exact use case (I don't have a CNC), but it definitely sounds possible.

        If you can make simple macros already, then defining variables shouldn't be a bridge too far from that. Once you get that down you'll be good to go.

        https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands

        undefined 1 Reply Last reply 16 Jul 2022, 15:40 Reply Quote 0
        • undefined
          tyrod @HebigT
          last edited by 16 Jul 2022, 15:40

          @hebigt
          Thanks for your reply, checked your link but I don’t think it’s what would work. I’ll see if I can explain the function a bit better, x any y are 90 degrees to one another, now if I place a work piece down with dowels or whatever is used for alignment of stock to x and y axis, then all I need is to do one probe of x then y then z, subtract half probe width and I have all I need to proceed. But, i have a vacuum table so no dowel holes. So the best I can do is get it close, but x and y will always be skewed slightly. So, if after turning on the vacuum and securing the piece I do a a single xyz probe, the work piece will still be skewed with relation to the true xy positioning. But if I was able to do either an x or y second probe a certain distance(say 25 mm) away from the first probe, that would tell the machine to skew both x and y planes to suit the position of the workpiece. And if that could be done, no matter what type of work holding you use, you won’t need a known x or y plane(I always use x because y is my motive axis. Does that make sense? Or maybe I’m wrong about this?

          undefined 1 Reply Last reply 17 Jul 2022, 21:16 Reply Quote 0
          • undefined
            HebigT @tyrod
            last edited by HebigT 17 Jul 2022, 21:16

            @tyrod Hey sorry about that. I completely misread your original post and assumed you were asking about XYZ tool offsets with a fixed workpiece! I was way off...

            You said,
            "But, i have a vacuum table so no dowel holes. So the best I can do is get it close, but x and y will always be skewed slightly."

            Are you saying that, because it is a vacuum table, the workpiece can be placed anywhere, and you do your best to align it to the X/Y axes?

            I wonder if you could try to use M556, like you mentioned?

            (This might be wrong) The way I read the description for M556, it's measuring the two orthogonal sides of a right triangle. If that's correct, you might be able to do something like:

            For X-axis

            1. Probe the absolute X position (of the workpiece) at one point

            2. Probe the absolute X position at another point along the same face
              (Ideally, these measurement points are far enough away from one another for there to be a discernible difference in the distance between the two, while still being on the workpiece)

            3. Subtract the above positions from one another and initialize the result as a variable, e.g. 'w'. The result may be negative or positive which tells you in what direction the piece is skewed.

            4. Initialize a variable, e.g. 'd' which is the distance you had to move the Y-axis between the two points.

            5. Feed both of those stored variables as parameters into an M556 command (or even another macro containing M556).

            Use a similar method for the Y-axis. I imagine, If you are doing this by hand and eye-balling it, the skew will be small but not insignificant.

            Making it automatic would require the machine to know where to probe the piece in the first place.

            Again, I'm not sure if that's exactly how M556 works, but it may be worth a try. You should be able to easily test the skew compensation by applying it and then running the probe across a face of your workpiece to make sure it is following the face exactly. Or by measuring points along the face.

            Skew Compensation.JPG

            undefined 1 Reply Last reply 18 Jul 2022, 16:40 Reply Quote 0
            • undefined
              tyrod @HebigT
              last edited by 18 Jul 2022, 16:40

              @hebigt
              hi, yes, m556 looked good to me at first until i looked into its function a little closer. its used to correct misalignment of the frame. so with a misaligned frame the xy planes arent perpendicular to each other. i think what i want is G68 coordinate rotation. then i could rotate the xy plane to match the stock xy planes. note That i have visible xy lines to get my stock very close. what im trying to achieve is perfect realignment of stock if removed for any reason. G68 uses angle input to rotate xy plane keeping them perpendicular.
              i can write a macro to probe all axis, even the 2 probe points on x axis. i would probe once, set that point to x0, then move a specific amount and do another g38.2 then read that point with M114 and this is where i get stuck. i would need a formula to take the length of the 2 points and their x differential and apply an angle . the BIG question is, how do i get gcode to do this automatically 😕 what formula would work. im not a programmer so meta commands and variables etc,etc are beyond my capabilities.

              undefined 1 Reply Last reply 18 Jul 2022, 17:25 Reply Quote 1
              • undefined
                HebigT @tyrod
                last edited by 18 Jul 2022, 17:25

                @tyrod

                Cool if G68 works!

                I feel like I'm doing a lot of guessing here, but i'm fairly certain you can calculate the angle you need using meta commands.

                RRF supports the atan function which you can use to calculate the small angle in a right triangle.

                Here's a drawing and some notes (super messy, sorry!).

                angle.JPG

                undefined 1 Reply Last reply 19 Jul 2022, 17:04 Reply Quote 0
                • undefined
                  tyrod @HebigT
                  last edited by 19 Jul 2022, 17:04

                  @hebigt
                  Wow! All Greek to me! Trigonometry etc was a long time ago 😵‍💫 I just turned 64 on the 13th. Anyway I searched through the info on meta commands and it’s nothing I can deal with. That being said, I went online and found what I think I need to calculate the angle in degrees(for g68)D2F37710-CCD2-48CA-AB04-1EA7A0F49180.jpeg
                  Not sure but I think picture b would be the correct way. Side note, I believe probing y would have to come after doing this but not z height.
                  I’ve searched to see if there is a complete formula to do this that is usable as a meta command but I’m not sure of what to do with it even if I did😵‍💫. I need help!!

                  undefined 1 Reply Last reply 19 Jul 2022, 18:11 Reply Quote 0
                  • undefined
                    alankilian @tyrod
                    last edited by 19 Jul 2022, 18:11

                    @tyrod

                    Since you have a vacuum table, I would flip the problem:

                    • Insert a pointy thing in your chuck.
                    • Do a G0 move to location (0,0)
                    • Align part of the part at that location
                    • Do a G0 move to location (100,0)
                    • Rotate the part to align rotation in the X-Y plane
                    • Turn on the vacuum

                    I get that the part may be unusually-shaped, but you need known coordinates on the part to locate it using the coordinate-system transformation method anyway, so instead of doing that, just make G0 moves to those known locations and orient the part correctly.

                    SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

                    undefined 1 Reply Last reply 20 Jul 2022, 01:34 Reply Quote 0
                    • undefined
                      tyrod @alankilian
                      last edited by 20 Jul 2022, 01:34

                      @alankilian
                      Ahh, the k.i.s.s method 😁
                      I already do that but the issue is that it’s difficult to keep the original 0,0 from shifting in some cases. I really believe a software solution would benefit all cnc users. As a lot of cnc users are probing it seems an automatic probing solution is a logical step forward. I’m really hoping someone can help.

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        tyrod @tyrod
                        last edited by 21 Jul 2022, 16:01

                        @tyrod
                        Just found m673 align plane on rotary axis. Alas, it doesn’t support xy axis! I wonder if there’s a workaround?

                        undefined 1 Reply Last reply 23 Jul 2022, 00:54 Reply Quote 0
                        • undefined
                          tyrod @tyrod
                          last edited by 23 Jul 2022, 00:54

                          @tyrod
                          I guess there’s not enough interest in this at this time since it’s mainly a cnc thing. I can still use a macro to probe twice on x axis then use tan on a calculator to get what I need. Maybe dc42 or another of the many smart contributors could comment on this idea? I think this may need its own gcode like the m673 align plane on rotary axis one. I’ll carry on and try to write a macro with a pause to input the g68 and degrees. Thanks to everyone who replied!

                          undefined 1 Reply Last reply 23 Jul 2022, 02:18 Reply Quote 0
                          • undefined
                            OwenD @tyrod
                            last edited by 23 Jul 2022, 02:18

                            @tyrod
                            You could put a request in the firmware wishlist section for an R parameter to be added to G10

                            http://www.linuxcnc.org/docs/2.6/html/gcode/gcode.html#sec:G10-L2_

                            undefined 1 Reply Last reply 23 Jul 2022, 04:40 Reply Quote 0
                            • undefined
                              tyrod @OwenD
                              last edited by 23 Jul 2022, 04:40

                              @owend
                              Thanks owend, I looked at the link and I noticed it says “ when a rotation is in affect jogging an axis will only move that axis in a positive of negative direction and not along the rotated axis” does that mean only jogging ignores the rotation but gcode follows the rotation? I assume so, I hope 😆

                              undefined 1 Reply Last reply 23 Jul 2022, 05:47 Reply Quote 0
                              • undefined
                                tyrod @tyrod
                                last edited by tyrod 23 Jul 2022, 05:47

                                @tyrod
                                Owend, I would still need to find the rotational offset required to shift xy axis to line up with my stock shown in my drawing. That’s why I thought g68 was a good way to go. I was looking at meta commands and found reference to tan under function subheading, dc42 was referring to deamon.g and I followed that link and that’s when I found it. I have some idea how to: 1st probe x, set to g92 x0 as the base, move, say,50mm and do second probe and that would give me the distance of the perpendicular. So now I know length of base and length of perpendicular to be able to use the tan function to calculate the degree rotation of xy plane. I think(not sure) I can use m114 to report x and y coordinates to host. From here I have no idea if it’s possible to get the required calculations performed by meta command(or daemon.g) or however it’s done to then add the angle in degrees to g68 and run it which would theoretically rotate the xy axis to match the stock material. Easy to remove by using g69 as well

                                undefined 1 Reply Last reply 23 Jul 2022, 20:13 Reply Quote 0
                                • undefined
                                  HebigT @tyrod
                                  last edited by HebigT 23 Jul 2022, 20:13

                                  @tyrod OwenD wrote an intro-document for g code meta commands. Check it out!

                                  https://forum.duet3d.com/topic/16495/conditional-g-code-introduction-tutorial-pdf

                                  undefined 1 Reply Last reply 24 Jul 2022, 16:04 Reply Quote 0
                                  • undefined
                                    tyrod @HebigT
                                    last edited by 24 Jul 2022, 16:04

                                    @hebigt
                                    Hey Hebigt, thanks for that! I read through it. While I now have a better understanding how I could make macros do a lot more work for me, unfortunately my knowledge on the language is nil. I think I have found a c++ program to calculate the angle in degrees that g68 needs. But have no idea how to use it🤔. I just don’t have the knowledge I would need and a crash course in c++ or whatever needed is not in the cards.

                                    undefined 1 Reply Last reply 26 Jul 2022, 14:48 Reply Quote 0
                                    • undefined
                                      tyrod @tyrod
                                      last edited by 26 Jul 2022, 14:48

                                      @tyrod I just found “Feature request-workpiece angle compensation CNC” by jay_s_uk and in it he wrote a script to do exactly what I wanted. I just searched for g68 and it’s on the second search page. I haven’t the time right now to try it. Thank you jay_s_uk! (And everyone else)!😀

                                      1 Reply Last reply Reply Quote 1
                                      • undefined tyrod has marked this topic as solved 28 Jul 2022, 14:50
                                      • First post
                                        Last post
                                      Unless otherwise noted, all forum content is licensed under CC-BY-SA