Fake encoder index for simulation

More
08 Jun 2023 21:32 #273218 by drummond
I got around to trying this, with little hope for success because I'm currently running the lathe spindle with a stepper motor in velocity mode and I wasn't sure how I might integrate stepperspindle.

I'm using 2.8.4 on an RPI4 with 7C81

It was an interesting exercise getting Halcompile to work, but I learned that raspbian responds to a right click on a file with a menu that includes "copy path(s)", click on that and you can paste the complete path into a terminal.

Once I had the comp file compiled and installed, I added the HAL entries as originally shown along with the amendments suggested by GaryLa

I loaded linuxcnc from a terminal (it's easier to find errors this way)  it didn't finish loading but:

./turner.hal:207: Pin 'stepperspindle.0.revs' does not exist

line 207 read: net spindle-pos stepperspindle.0.revs motion.spindle.0.revs
commenting it out resulted in linuxcnc loading without error.

a look at halshow pins under stepperspindle then 0 showed no pin with that name, but there was a very similar stepperspindle.0.spindle-revs and subbing this in resulted in that error going away, but

./turner.hal:207: Pin 'motion.spindle.0.revs' does not exist

Rinse and repeat finds we just need spindle.0.revs without the 'motion'

Now it loads without error.

Does it work, well that's a story for another day

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

More
08 Jun 2023 22:24 - 09 Jun 2023 14:34 #273220 by PCW
Note that you can use index with step/dir driven spindles
with LinuxCNC 2.9 and Mesa cards with the correct firmware.
This allows spindle synchronized moves without an encoder,
though an index input is still required.

 
Last edit: 09 Jun 2023 14:34 by PCW. Reason: clarify

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

More
09 Jun 2023 13:08 #273237 by andypugh

./turner.hal:207: Pin 'motion.spindle.0.revs' does not exist

Sorry, that was an error on my part, I typoed the older pin name by accident (now fixed in the original post) 

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

More
09 Jun 2023 21:17 #273251 by drummond
When I look at HAL configuration there are four pins associated with Stepperspindle: index-enable, rawcounts, spindle-revs, time.

I'm running the lathe motor with the following in the ini file:

MOTOR_SCALE 3200 // stepper takes 3200 steps per revolution
STEP_SCALE  1600 // lathe spindle has a 2:1 relationship with the motor, stepper revolves once, lathe spindle revolves twice.

I wondered how this might gel with:

setp stepperspindle.0.steps-per-rev 1600

Which went in HAL file per the original instructions, it seems correct- but how could I be so lucky?

Got the motor running and watched the first 3 pins.

Results:

index-enable=nothing
rawcounts=count is going but with a minus sign in front of it
spindle-revs=count is going but with a minus sign in front of it

I can "correct" the minus on spindle revs by changing the HAL entry to:

setp stepperspindle.0.steps-per-rev -1600, which feels wrong somehow because the originals in the ini file are both positive and produce counterclockwise rotation with M4

rawcounts seems less trivial to fix

from the comp file:

.......signed steps-per-rev = 100 "stepper steps per rev / per index";

If that means what I think it means it will produce indexes far more frequently than I was expecting?

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

More
10 Jun 2023 11:06 #273266 by andypugh
Negative scales are not unusual to reverse specific functions.
Counts being negative is not a problem for the fake index comp.
But I suspect that you might have a misconfiguration if M4 is normal rotation unless this is a back-tool lathe.

Looking down the spindle towards the tailstock, M3 should be clockwise and count up.

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

More
10 Jun 2023 16:16 #273273 by drummond
Well, that was a typo combined with an interruption leading to an incomplete message being sent (!) Sorry about that

What it should have read is: "the originals in the ini file  are NOW both positive and produce counterclockwise motion with M3, to correct this I have to set them both back to negative

I could never get to watch the index changing by watching it on HAL configuration even with a spindle speed of 1 rpm (stepper running at 0.5 rpm)

I tried a simple g33 routine "in air" and everything seems to work, spindle synchronized motion without an encoder.  Thank you.

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

Time to create page: 0.072 seconds
Powered by Kunena Forum