On Sunday 12 November 2017 05:12:54 andy pugh wrote: > On 12 November 2017 at 01:49, Gene Heskett <[email protected]> wrote: > > If I write a hal thing that changes the value pushed into the > > encoder's scale input, how much of a time lag might there be to make > > it effective? > > The scaling does not happen in the Mesa layer, it happens in the HAL > driver. > > But, the encoder scale is a parameter, not a pin, so you can't change > it in HAL. > > What I would do would be to pass the hm2_..._position and > hm2..._...velocity through a pair of "scale" HAL functions with the > scaling factor for both chosen by a "mux2" controlled by the gear > selection before connecting to the motion... pins. > > You might be able to use the "gearchange" component for this (or, > specifically, two more instances of the component) as this is > basically what it does, ie switch between two scales.
That I can do, but it does bring up a related question. Actually 2 or 3. 1. How long, probably in cycles, does it take motion to recover when it finds a huge change in either its position, or velocity inputs which the scale switching causes? 2. at what point does the accumulated position overflow? or is position reset to zero on the index pulse? Seems to me like it ought to be, but I don't recall anyone saying. I intend to temporarily set up a counter to be frozen and reset in one pulse, useing probably an edge module to tap the index pulse to transfer the counter to a sample-hold, then reset the counter when the edge recovers from a very short output pulse, with the sample-hold becoming the value for the 2 scale modules for that gear. By running the motor slow, I ought to be able to define the unknown, in this case the actual gear ratio when in each of its 2 gears. Or maybe even use it as the scale.n.gain input since its a pin, however I'd expect a count or more to be skipped at the higher motor speeds and that would confuse the scale values derived. Not a Good Thing. Best to carve it into the ini file once determined. Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
