Adding support for optional axes

More
03 Mar 2021 13:08 #200898 by JetForMe
I'd like to add support to LinuxCNC for optional axes, like a removable 4th axis. Can someone point me to the area of the code I want to look at to modify? Thanks!

Ideally there'd be a Python hook for this.

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

More
03 Mar 2021 13:20 #200899 by cmorley
Could you explain - in detail how you want this to work?

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

More
03 Mar 2021 23:39 #200955 by andypugh
I think that it is difficult, because by the time that it is possible to detect the hardware quite a lot has been set up.

The typical way to do this is to have two separate INI files which use a set of common HAL files where there is commonality, and different ones where there is not.

For example my milling machine has 4 different configs, that can set it up as a vertical mill, horizontal mill, 5 axis mill (manual B axis) or gear hobber.

What can be done, for a removable rotary, is to switch the feedback with a mux component between the commanded position and the actual position from the encoder. This prevents following errors if an attempt is made to operate the axis, but still leaves the DRO entries etc for that axis.

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

More
04 Mar 2021 04:03 - 04 Mar 2021 04:04 #200991 by JetForMe
I want to get into the source code and enhance it to support this notion. It only needs to ignore homing certain axes when the user initiates a home operation, IF certain signals are present. I can think of several ways to enable this. One might be to add pins to the component that handles homing.

But the source is large and spread across many files, and I have no idea where homing is implemented.
Last edit: 04 Mar 2021 04:04 by JetForMe.

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

More
04 Mar 2021 04:06 - 04 Mar 2021 04:07 #200992 by JetForMe

Could you explain - in detail how you want this to work?


My use case is this: I have a removable 4th-axis. If I remove it from my router table, homing never completes, because the servo and limit switch aren't connected. I want to be able to indicate to LinuxCNC that it should ignore that axis for the purposes of homing (or really, ignore its existence for anything, e.g. path planning, etc. Ideally it would complain if gcode tried to move that axis).

The way to signal the presence or absence of the axis should be flexible (e.g. a UI button, or maybe the hardware detects its presence and asserts a pin on the IO card).
Last edit: 04 Mar 2021 04:07 by JetForMe.

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

More
04 Mar 2021 04:12 - 04 Mar 2021 07:51 #200993 by JetForMe
On a hunch I took a look at motion. It has motion.homing-inhibit, so I'll try to find that code and take a look at it. Maybe I can add something like axis.L.disable-homing. I guess joint.N.homing-disabled is a better name, as it seems homing is by Joint, not axis.
Last edit: 04 Mar 2021 07:51 by JetForMe.

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

More
04 Mar 2021 09:31 #201008 by tommylight
Having 2 configs would be the easiest solution and gets rid of all the complications with homing.
Or am i missing something ?

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

More
04 Mar 2021 10:59 #201013 by JetForMe
I want to be able to change it from the UI, rather than having to launch a different config. I don't want to start having different configs.

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

More
04 Mar 2021 11:10 #201014 by JetForMe
After spending a few hours in the code, it seems that most of what I'd like to do is handled in the code already by checking GET_JOINT_ACTIVE_FLAG(). That flag is a bit in a word in an internal data structure (in mot_priv.h; well, in motion.h emcmot_joint_t), and is not exposed as a pin. But it seems like it could be.

The flag is set at the end of joint initialization. It is never cleared, as far as I can tell. I'm tempted to try to wrap it in a joint pin.

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

More
05 Mar 2021 09:12 #201085 by JetForMe

The typical way to do this is to have two separate INI files which use a set of common HAL files where there is commonality, and different ones where there is not.


This seems quite onerous. I tried to do this, but I don't see how not to duplicate config. If I don't include the stuff for my joint 4 in the INI, then the HAL config fails (it tries to configure stuff based on Joint 4 parameters specified in the INI file). I can't add subsequent [HAL] sections in later .inc files (doesn't work; I tried it). I really don't want to have duplicated config, that's asking for trouble next time I change something.

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

Time to create page: 0.115 seconds
Powered by Kunena Forum