Configure a non-motorized axis with a linear scale (DRO mode) - Solved

More
02 Feb 2025 17:28 - 04 Feb 2025 20:32 #320432 by TangentAudio
In my mill conversion, the quill is manually operated, but it has a magnetic scale, and the scale is connected to a Beckhoff EL5101 encoder input module in my EtherCAT chain.

I'd like it to behave like a simple DRO within LinuxCNC, simply allowing me to "home" it manually when it's retracted and then touch it off in each WCS and show me the relative reading on the DRO.  I have it halfway working by simply assigning the output pin of the encoder (which is configured to be in machine units) to joint.2 motor-pos-fb.  This lets me to see the value in AXIS and home it, so it shows 0.000 when retracted, and will read down to the max extension around -5.000 inches.


# it's a 5um scale, 5080 counts per inch, negative to swap direction so it reads negative on extension
setp lcec.0.5.enc-pos-scale -5080
net 2-pos-fb => joint.2.motor-pos-fb <= lcec.0.5.enc-pos


However, touch-off doesn't work.  It pops up the touch-off dialog in AXIS, but this never changes what the DRO for Z shows. 

Another issue is that I also have to crank up FERROR to more than the full travel so it doesn't think there's a follow error with the joint moving on its own when I use it.

I can also reset the EL5101's encoder counts with it's enc-reset input pin, and I tried setting up something with a HAL oneshot component triggered off of the joint homing signal to force the encoder to reset.  It did reset the counts to 0 when homing, but it didn't help otherwise.

I can't help but think there's a better approach to this, any suggestions?

thanks,
Steve
Last edit: 04 Feb 2025 20:32 by TangentAudio.

Please Log in or Create an account to join the conversation.

More
04 Feb 2025 01:05 #320550 by TangentAudio
Digging in a bit more, I think I understand what's happening.

In the AXIS source code, the "Touch Off" dialog issues a G10 L20 via the MDI, for example G10 L20 P1 Z1.0 to touch off Z in WCS 1 to 1.0

I haven't yet gone digging into the G-Code parser part of LinuxCNC yet, but I imagine it uses the joint's COMMANDED position, not the ACTUAL position.  With my non-motorized axis, the commanded position is 0, even if the actual position changes via the magnetic scale.

Using the MDI manually, I can get the effect I'm looking for by applying the ACTUAL position plus the desired touchoff offset to the G10 L20 command.

So I see two potential approaches...
  • dig into the G-Code parser, extend G10 L20 so it can be told to use the actual position instead of the commanded
  • modify AXIS (or whatever GUI) so it applies the actual position plus whatever manual offset is entered by the user
I found a post from a few years ago that's at least in the same ballpark... but no real solution on offer.  It sounds like Probe Basic might do something like what I want out of the box though.
forum.linuxcnc.org/qtpyvcp/46910-g10-l20...s-offset-like-g10-l2
 

Please Log in or Create an account to join the conversation.

More
04 Feb 2025 13:47 #320607 by TangentAudio
I spent some time digging into the rs274ngc code last night.  I don't think it's viable to modify the G10 L20 at that level to use the "actual" position of the joint.  I didn't see any references to "actual" position in the structures that contain setup/block info in that code.

I did learn along the way that the Z axis "touch off" offset value is stored in numbered parameter [5203 + (P * 20)] , in other words the Z axis workpiece offset for P1 (aka G54) is stored at #5223.  This parameter value can be viewed via an MDI debug command (debug, #5223) after a touch-off.  Writing the value directly with #5223 = 123.456 doesn't do anything useful.

So I'm probably best off trying to accomplish something via a small GUI modification, or maybe something with a clever G code remapping?
 

Please Log in or Create an account to join the conversation.

More
04 Feb 2025 20:22 - 04 Feb 2025 20:22 #320651 by TangentAudio
I made a surgical modification to the AXIS GUI to optionally modify the behavior of an axis to use the ACTUAL_POSITION value as part of the offset value sent to the G10 L20 command during a workpiece touch-off.  This is only done if TOUCHOFF_ACTUAL = TRUE is set in the appropriate [AXIS_x] section in your .INI file.

This may not be the most general approach and may yet prove to have some bugs (e.g. i have not tested metric mode yet), but it works for my situation right now anyway.

I'm not sure if this is worthy of creating a PR to include in LinuxCNC, but for anyone who might want to see the change you can view the diff here:
github.com/tangentaudio/linuxcnc/compare...025%7D?diff=split&w=

cheers,
Steve
 
Last edit: 04 Feb 2025 20:22 by TangentAudio.

Please Log in or Create an account to join the conversation.

More
08 Feb 2025 00:01 #320946 by cmorley
I was thinking about this, trying to think of a general process.
Thinking out loud:
What you are asking for is similar to coupling axes on DROs.
In your case it seems Z (linuxcnc controlled?) axis is the bed and your manual one is the quill.

This is quite a common machine layout.

I feel like using an linuxcnc's extra joint for the manual quill would be appropriate.
This would display the extra joint position in the GUI.
Then tell the GUI to couple the joints for Z for touch off.
maybe the GUI could be set up to show the extra joint position naked when 'uncoupled' and combined when 'coupled'.
Not that far from what you are doing anyways, just feels a little more official/
AXIS sim has a sample config to show extra joints so you could see the idea with the DRO display.

Thoughts?

Please Log in or Create an account to join the conversation.

More
08 Feb 2025 13:33 #320993 by TangentAudio
I'm working towards getting a servo on the knee/bed of this machine, but I'm not there yet.  I will have a glass scale on the knee axis soon, but adding the servo is a bit of a project that will take some time.  For now I just have servos on X and Y, and W and Z will be manual.

I have not read up on the extra joint functionality so I'm not familiar with how it works.  I'll give it a look!

FYI I did end up submitting this as a PR ... github.com/LinuxCNC/linuxcnc/pull/3324#issuecomment-2642569284

-Steve


 

Please Log in or Create an account to join the conversation.

Time to create page: 0.127 seconds
Powered by Kunena Forum