I've been back working on a few touch probing related plugins since getting UCCAM copy working. I figured that with some of the questions Keith was asking relative to digitizing ( http://www.forum.cncdrive.com/viewtopic.php?f=4&t=2383#p18893 ) made this a good opportunity to show what I'm working on despite it being no where near ready for anyone to use...
I had been wanting to port the 'ProbeIt' wizard from Mach3 code into UCCNC for some time, however almost every single probe routine in it is dependent on doing a combined X/Y G31 probe, which still isn't supported (insert sad face here ). But I was playing around a few weekends ago and came up with a way to create a simulated multi-axis G31 command using the 'Jog Safe Probing' feature that UCCNC has. After a little testing, came up with something to try and make it work....
Below video shows the first stages of porting ProbeIt code into UCCNC as a plugin, and running a probe calibration table for angles between 0 - 360 in increments of 10 degrees.
It has a long way to go, but it's a start!
In the end, I want to replicate all the features ProbeIt for Mach3 had and add a bunch more since programing in .Net is so much more powerfull than Mach3 wizard code allowed. Some things on the to-do list: profile tracing-save direct to DXF manual jog against part - save direct to DXF Include DXF recording of all basic probe routines (edge, center points, sides, etc) Incorporate 3d surface scanning (I'm pulling in the 'probecloud' plugin I started a while ago, and will build upon it)
Well, today we got a bunch of snow throughout the day here, so I spent a lot of time working on the ProbeIt re-write for UCCNC (when not shoveling...). Was finally able to get the 2D profile tracing working satisfactorily after losing much hair... but this was the part I was hoping to get working so I'm happy
The below video and some pics show a test tracing of a knife scale that I originally made by doing a profile trace by the UCamCopy plugin, so it was a good opportunity to compare by measuring a copy of a copy.
Pardon the poor video and audio, I really don't know how to take decent videos in my shop ....
And here is a comparison of the geometry after import into VCarve (no edits, just raw imported DXF)
Compare by overlaying (red is UCamCopy trace, black is test of ProbeIt code)
All things considered, to probe around a piece of wood on a rack and pinion driven CNC router, and get within ~ .010" on 3.6" dimension using a hack of a G31 probe command and with very little tweaking or calibrating shows promise. Now that the basic routines work, the rest is just a lot of cleanup of code and making a usable interface.
I really do enjoy programming in .Net for UCCNC, way better than Mach3/4.... Thanks CNCDrive!
Thanks for looking, and I hope this is of interest for what you were asking about Keith. I'll be working on it as time permits over the next few weeks.
The accuracy looks fine for my initial needs. Personally I'm not after super high accuracy, more just reproducing profiles for plasma cutting, and see if I can make a buck here and there in my back yard.
Thought it might be fun to share a little bit of the coding side of plugins, maybe it will help others, maybe someone will point out dumb things I've done and I can learn some more too. And Hopefully no real programmers reading this will puke at the sight of VB and poor coding... joking of course.
So this is what I came up with to emulate a G31 in the X/Y plane at some angle:
''' <summary> ''' This routine emulates a 'G31' command by using JSP mode, but only works in X/Y currently ''' </summary> ''' <param name="x"></param> ''' <param name="y"></param> ''' <param name="frate"></param>
Function XYJSPG31(ByVal x As Double, ByVal y As Double, ByVal frate As Double) As Int16 ' Returns 0 for no error, 1 for error
Dim dx, dy As Double Dim XSpd, YSpd As Double Dim angle As Double
XYJSPG31 = 1 ' Default to 'fail' flag
If UC.GetLED(37) Then MsgBox("Probe Active, aborting!") UC.AddStatusmessage("Probe is active!")
GetHitData() 'Routine to fill current location into hit positions
XYJSPG31 = 0 ' Set OK flag
UC.Callbutton(553) ' Turn off JSP to move off item
While UC.GetLED(246) ' Wait for JSP led to turn off Thread.Sleep(5) End While
End Function
''' <summary> ''' This provides similar funcitonality to 'ISMOVING', except will also flag if distance moved exceeds set probe distance to stop ''' </summary> ''' <returns></returns> Private Function ProbeIsMoving() As Boolean ProbeCheckFlag = True ' default the flags to TRUE, as false is the triggering condition... DistanceFlag = True Dim thrIsMoving As New Thread(Sub() CheckProbeIsMoving()) thrIsMoving.CurrentCulture = Thread.CurrentThread.CurrentCulture thrIsMoving.Start() While thrIsMoving.IsAlive End While Return ProbecheckFlag End Function
Private Sub CheckProbeIsMoving() IsMovingFlag = UC.IsMoving ' Standard check of 'IsMoving' from internal to UCCNC DistanceCheck() ' Custom check to see if the specified distance is met If IsMovingFlag = False Or DistanceFlag = False Then ProbecheckFlag = False End If End Sub
Private Sub DistanceCheck() Dim distance As Double DistanceFlag = True distance = ((UC.GetXpos - jspg31Xstart) ^ 2 + (UC.GetYpos - jspg31Ystart) ^ 2) ^ 0.5 'Just comparing current position to desired end position If distance >= jspg31distance Then ' If current position > or = desired, stop if not already stopped by JSP hit... DistanceFlag = False End If
End Sub
It's not real pretty, but it seems to get the job done. In my testing with jogging against parts with JSP mode on, I found that if I stayed under ~10 in/min, there was a negligible difference between where the axis stopped while jogging, and where it stopped using a true G31 move (most likely driven by my axis accel rates, so may be different for others...). Going faster obviously resulted in a greater deviation, but I figure that could potentially be calibrated out too, but on the other hand probing should not be happening at crazy speeds.
So in a nutshell, that is what the plugin is currently built upon at the lowest level. Of course there are many layers of code above that to make the actual routines, and figure out touch location by offsetting ball diameter at the traveling vector angle, etc.
As a side note, if multi-axis G31 becomes built into UCCNC and is available, I'll be able to go back through the plugin and just replace all of the calls of my 'fake' G31 routine with calls to the real version, and hopefully accuracy could be improved a little more.
I've been ever so slowly working on ProbeIt for UCCNC (an hour or two every night as time allows), and most of the basic functionality is now there without crashing! Figured I'd give a quick look at how it's coming along. I must admit, its taking far longer to repackage existing probe routines than I thought, as I struggle with the creation of the user interface side of things more than the back-end math routines... That and I can't seem to stop adding features as I go instead of getting a minimum set of functions completed.
This is another poorly done video that is much longer than it should be, but it gives an overview and shows some basic probing type routines working:
Functionality that is working: [*]Calibration routine for probe tip, and correction for all routines (perimeter, basic x/y, etc) [*]Perimeter probing in x/y, recording to a DXF and CSV file [*]Basic XY probing (side, corner, edge, bore/pocket, ridge/slot, post), recording data to DXF and CSV [*]G68 coordinate setup and rotation of coordinate system [*]Jog Probing, with this on, you can just jog into edges of parts, and it records location to CSV and DXF (with tip diameter correction for velocity vector at time of hit)
Still in process: [*]routines in X/Z and Y/Z planes [*]Getting surface probing portion fully working again (rolling in my ProbeCloud plugin and tying together w/ ProbeIt) [*]Issues w/ DXF when G68 rotations are on [*]Email/Text when error, finish cycle, etc occurs [*]Freshen up the graphics and user interface later
There is one 'gotcha' I've found with how the plugin is working that I'm not sure I can resolve on my own, and it may be a quirk that it lives with. Since all the probing is actually done by 'jogging w/ JSP' mode on, if UCCNC losses focus by user trying to multitask while a probe routine is running, the probing routines stop in their tracks. This is due to UCCNCs safety features of only allowing jogging if the app has focus, which is a good safety feature, it just messes with my 'hack' for probing.
Hopefully the video shows up correctly and isn't to awful to watch... i find that screen recording and additional web cam stuff to focus on is distracting. Testing is being done w/ a mini 'fanless' PC, on Win 10 x64. This little PC is almost pushed to its limit running UCCNC, a webcam, and screen recorder (as the screen recorder takes a little more than 50% CPU by itself). I should have gotten an i5 or i7 instead of a celeron...
I hope to fix a few more of the less critical bugs I know of, and put it out soon for general testing for anyone interested.
Do you have a link to the video. I don't know if it's some setting in my browser or my internet security software but I can't see any of the videos posted on this forum. There's only an empty box there.
I just did a quick check, and on both android phone or on PC using firefox I can see the videos embeded in the forum, but on chrome with both PC and phone they are blank squares.... some sort of chrome problem which is a little ironic.
nice looking screen you made. I'm personally more into bright colourful screens so I like your probing screen.
Videos show up in Internet Explorer too so it's starting to look like this might be a chrome only issue. A quick Google and some guy fixed this by un-installing chrome and re-installing. Might do that later.