i think it can be done without any mods to the linuxcnc by a wrapper component for hm2.encoder, HOME_USE_INDEX and using the ini.X.home_offset pin to set the abs position.
1. wait joint.X.index-enable -> set encoder.latch-enable 2. wait for encoder.latch-enable to reset (on 1st index mark) -> save encoder.position-latched, set encoder.latch-enable and encoder.index-enable 3. wait for encoder.index-enable to reset (on 2nd index mark). calculate abs position using previously latched pos and current latched pos. set ini.X.home_offset accordingly, reset joint.X.index-enable i don't know if index-enable and latch-enable work simultaneously, but see no reason why they shouldn't the wrapper can emulate the joint.X.home-sw-in so that linuxcnc will go looking for an index right away /dmiry On Fri, Apr 16, 2021 at 11:45 AM andy pugh <[email protected]> wrote: > > I am intrigued by the puzzle of how to support distance-coded scales > in LinuxCNC. > > https://forum.linuxcnc.org/12-milling/42195-retrofitting-mikron-wf41c?start=10#205856 > > Support for the basic protocol can be handled either by a HAL > component, or by tweaks to the encoder drivers. Either can supply an > absolute position on a HAL pin. > > Unfortunately there is currently no way that I am aware of to use that > information during the home sequence. When LinuxCNC sees index-enable > toggle false (as far as I know) it sets the machine position to > HOME_OFFSET. > > HOME_ABSOLUTE_ENCODER changes this behaviour, in that the value on the > position-fb pin is taken to be the true position. But with this option > set there is no search move for the indices. > > So, I can see a few ways round this. > > 1) Add distance-coded scales to the homing code. This would need a > couple of new INI entries, which is easy, but would also need a new > pin to get the rawcounts (or a position version of the same) to the > homing code so that the system can measure the distance between marks. > There is _probably_ a way to do this with the "latch-enable" but that > doesn't, by default, use the index pulse to latch (AFAIK) and the > latched-position still needs to be linked in to homing. > > 2) Add a variant ot HOME_ABSOLUTE_ENCODER (type 3?) which behaves > normally except for taking the current position-fb as being "true" at > the point that hominf completes (either by index or home-sw) > > 3) Some other way that I have not thought of. > > I think I prefer 2, as being less intrusive (and more adaptable to > other schemes). But 1 might be technically preferable. > > Thoughts? > > -- > atp > "A motorcycle is a bicycle with a pandemonium attachment and is > designed for the especial use of mechanical geniuses, daredevils and > lunatics." > — George Fitch, Atlanta Constitution Newspaper, 1912 > > > _______________________________________________ > Emc-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-developers _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
