- Configuring LinuxCNC
- Advanced Configuration
- Possible to automatically compensate for irreguarities on the XY plane?
Possible to automatically compensate for irreguarities on the XY plane?
03 Oct 2023 05:10 #282121
by bhowiebkr
Hey, does LinuxCNC have the functionality to correct for irregularities on an axis surface plane like the XY on a gantry/router CNC? If I make a surface map file of offsets in the Z direction of the XY plane is it possible to have LinuxCNC automatically compensate for them? I’ve been doing a project involving a laser line projection onto a webcam sensor that is attached to a W axis and spring loaded so it can touch a surface It acts kinda like a CMM but only gives me about 2.5mm of range in Z to work with but does allow me to get down to a couple microns of measurement. I’ve still got some problems with it to work out but here a recent video on it’s progress
And here is how it operates
www.youtube.com/shorts/vuXR8RIW44o
What I’d like to do is generate an offset map of the XY plane by taking a grid of measurements with the sensor in the air (not touching anything) and then feed that data back into LinuxCNC to automatically compensate when running gcode.
Please Log in or Create an account to join the conversation.
03 Oct 2023 06:12 #282129
by Aciera
Replied by Aciera on topic Possible to automatically compensate for irreguarities on the XY plane?
Have a look at this:
forum.linuxcnc.org/10-advanced-configura...nting?start=0#167181
I think this is still python 2 which runs on linuxcnc version 2.8.x while version 2.9 and higher would require updating the code to python 3.
forum.linuxcnc.org/10-advanced-configura...nting?start=0#167181
I think this is still python 2 which runs on linuxcnc version 2.8.x while version 2.9 and higher would require updating the code to python 3.
Please Log in or Create an account to join the conversation.
03 Oct 2023 11:55 #282151
by andypugh
Replied by andypugh on topic Possible to automatically compensate for irreguarities on the XY plane?
I would argue (strongly) that the compensation should be a realtime HAL component.
This does make things more difficult as there is no file access from a realtime HAL component.
However, it would not be too unmanageable to pass a set of XYZ probe points in as a parameter array (max 4096 characters)
The main INI file could #INCLUDE a fixed filename for the height map
This file would be of the formatThen the HAL file could use
loadrt height_compensation map=[HEIGHTMAP]
Which would (I think) pass the ile contents in at load time.
This is all a bit clunky, but it saves coding and setting up a shared memory area.
A better way would be to have a pair of components, userspace (probably C for data representation reasons, but Python could probably work too) and realtime which used a private shared memory area for the height data.
I think that the latter approach is what Probekins used. (but Probekins didn't really work, for other reasons)
This does make things more difficult as there is no file access from a realtime HAL component.
However, it would not be too unmanageable to pass a set of XYZ probe points in as a parameter array (max 4096 characters)
The main INI file could #INCLUDE a fixed filename for the height map
This file would be of the format
[HEIGHTMAP]=12,5,20 15,25,30....
loadrt height_compensation map=[HEIGHTMAP]
Which would (I think) pass the ile contents in at load time.
This is all a bit clunky, but it saves coding and setting up a shared memory area.
A better way would be to have a pair of components, userspace (probably C for data representation reasons, but Python could probably work too) and realtime which used a private shared memory area for the height data.
I think that the latter approach is what Probekins used. (but Probekins didn't really work, for other reasons)
Please Log in or Create an account to join the conversation.
03 Oct 2023 11:59 #282153
by andypugh
Replied by andypugh on topic Possible to automatically compensate for irreguarities on the XY plane?
Hmmm..... Now we have 64 bit HAL pins, I wonder if the userspace component would be able to rtapi_kmalloc a C struct of height date, then populate it, and just pass a pointer to that struct to the realtime code?
Though this is really just a rather bad way of spoofing a shared mamery region.
Though this is really just a rather bad way of spoofing a shared mamery region.
Please Log in or Create an account to join the conversation.
03 Oct 2023 22:20 #282221
by rodw
Replied by rodw on topic Possible to automatically compensate for irreguarities on the XY plane?
I wonder if somehow a hal_port could be used to pass a point array, much like a survey grid format
The component could extrapolate the height at a given point as you would plot a contour line and adjust the height using external offsets in real time.
The component could extrapolate the height at a given point as you would plot a contour line and adjust the height using external offsets in real time.
Please Log in or Create an account to join the conversation.
03 Oct 2023 23:52 #282226
by andypugh
Replied by andypugh on topic Possible to automatically compensate for irreguarities on the XY plane?
I gave this more thought cycling home from work, and reckon that there should be a Python front-end which either does the probing there and then, or loads a file. Then it can be a well-defined square grid, to make life easier.
A good application of this would be engraving uneven surfaces, jog the probe to the corners of the area to be probed, hit a GUI button, run the probe sequence, load the height map, engrave away.
A good application of this would be engraving uneven surfaces, jog the probe to the corners of the area to be probed, hit a GUI button, run the probe sequence, load the height map, engrave away.
Please Log in or Create an account to join the conversation.
04 Oct 2023 02:56 - 04 Oct 2023 03:08 #282238
by bhowiebkr
Replied by bhowiebkr on topic Possible to automatically compensate for irreguarities on the XY plane?
Yeah if the hardware exists. In python I store the numpy data array in a python pickle file and 10,000 (100x100 grid) sample points is less than 100kb. It’d be good to have no constraints on grid size. Keeping things in python to extrapolate a given height position allows you to leverage scipy and all the many interpolation options it has.
I’m running a build of LinuxCNC that got pushed to the Debian packages and it’s running python3. I wouldn’t be caught dead writing python2 these days.
I’m really interested in trying to get this working in LinuxCNC because it would allow you through software to improve the capabilities of a machine through further calibration. You could run it like the 3d printers do with automatic bed leveling for engraving or you could give it a calibration map with more points and that would be used for more conventional cnc machining.
If such a thing were to be integrated into linuxcnc, it would be good if it could be overwritten easily as to how the data acquisition works. For instance I use a second computer running windows and a python tool that solely is made to read the webcam sensor values of the laser position. That way I don’t overload the processing power on the linuxcnc machine. The tool driving linuxcnc remotely really just wraps gcode in python with some extra steps where it requests sample data from the other computer over a socket connection. Then it controls LinuxCNC with MDI commands.
I’ll have to sit down and read through what scotta got working with the code on github. I’ve never tried python component in linuxcnc but it looks like it could be a good starting off point.
I’m running a build of LinuxCNC that got pushed to the Debian packages and it’s running python3. I wouldn’t be caught dead writing python2 these days.
I’m really interested in trying to get this working in LinuxCNC because it would allow you through software to improve the capabilities of a machine through further calibration. You could run it like the 3d printers do with automatic bed leveling for engraving or you could give it a calibration map with more points and that would be used for more conventional cnc machining.
If such a thing were to be integrated into linuxcnc, it would be good if it could be overwritten easily as to how the data acquisition works. For instance I use a second computer running windows and a python tool that solely is made to read the webcam sensor values of the laser position. That way I don’t overload the processing power on the linuxcnc machine. The tool driving linuxcnc remotely really just wraps gcode in python with some extra steps where it requests sample data from the other computer over a socket connection. Then it controls LinuxCNC with MDI commands.
I’ll have to sit down and read through what scotta got working with the code on github. I’ve never tried python component in linuxcnc but it looks like it could be a good starting off point.
Last edit: 04 Oct 2023 03:08 by bhowiebkr. Reason: math typo
Please Log in or Create an account to join the conversation.
04 Oct 2023 03:07 #282239
by bhowiebkr
Replied by bhowiebkr on topic Possible to automatically compensate for irreguarities on the XY plane?
I’ve got a bunch of changes (software and hardware) that should improve the way I’m taking samples. I also think adding a sensitive temp sensor and including those data points with time could allow me to correct for thermal expansion drift that I find happens. The machine takes 2-3 hours to take 100x100 samples and that is enough time to warm up the garage and all the metal parts.
I’m not sure how out-of-flat my XY plan of my cnc machine is. I’ll probably run a high number of samples over the entire work area just to get a clearer picture of it and reduce the numpy array size after if necessary.
I’m not sure how out-of-flat my XY plan of my cnc machine is. I’ll probably run a high number of samples over the entire work area just to get a clearer picture of it and reduce the numpy array size after if necessary.
Please Log in or Create an account to join the conversation.
04 Oct 2023 11:03 #282266
by andypugh
Python HAL components are _always_ non-realtime.
Replied by andypugh on topic Possible to automatically compensate for irreguarities on the XY plane?
Yes, but the actual offset value _must_ be calcuated in Realtime, and that means in C in a realtime HAL component.Keeping things in python to extrapolate a given height position allows you to leverage scipy and all the many interpolation options it has.
Python HAL components are _always_ non-realtime.
Please Log in or Create an account to join the conversation.
- Configuring LinuxCNC
- Advanced Configuration
- Possible to automatically compensate for irreguarities on the XY plane?
Time to create page: 0.122 seconds