Lathe C axis homing

More
10 Apr 2026 08:00 #345386 by jetbadger
Replied by jetbadger on topic Lathe C axis homing
I _will_ try to do the feedbback test again as I think I only connected the stepgen fb to joint fb, not pid fb aswell.

The drive is at 10000 PPR and around 1.45:1 spindle:motor overdrive, from my calculations 6k rpm spindle speed is around the limit. there is a 2500 step/10k line encoder on the spindle itself I use for feedback.

I am looking through the HAL again and wondering maybe I DO have the scaling wrong? Though the positions and speeds report correct, maybe the scales are backwards, the end math turns out correct, but calculations midway are off? I'm trying to think of anything now, really.
  • -ENCODER_SCALE is 10000
  • -Spindle SCALE is 114.83 (10000/1.45/60) (not sure why it needs to be divided by 60 though? I assume because RPS instead of RPM, but I thought this value should not be bound by time, only steps/rev? I'm not sure...
  • -JOINT_2 (C axis in my case) SCALE is 19.07 (10000/1.45/360). I turned on the scale switching in M102/103, not sure how you get it to work without that?
What makes me think that I have something off is the scaling by 360 of the enc-pos signal in the HAL. As in I have 10000 lines per rev, so multiplying it by 360 instead of dividing makes no sense to me the way I have it now. 

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

More
10 Apr 2026 18:24 #345401 by spumco
Replied by spumco on topic Lathe C axis homing
Yea, scaling and all the math made my brain hurt.

First, it helped me to stop thinking of INI file terms like ENCODER_SCALE whenever they are used to set the value of something in HAL.  Think about the underlying pins when working on the math, not the arbitrary INI parameter name.  I got confused (still do) between all the various 'NNN_SCALE' things in INI and would mix up what was affecting what.  Helps when you write them out all in one place:
  • encoder.N.scale = [SPINDLE_N] ENCODER_SCALE = 10000
  • stepgen.N.position-scale = yada yada yada

So hurdle #1 - spindle and c-axis are in different units.  Spindle is in revolutions, c-axis is in degrees.  This causes brain hurt.

#2 - as you noticed, spindle scale is a velocity thing, so it's a RPM/RPS formula not steps per degree.

#3 - remember that my spindle drive is internally in velocity mode ONLY, and my stepgen is always in velocity-mode... so I don't switch the stepgen position-scale via M102/103.

If you are switching the drive internally, you will almost certainly need to change the stepgen scale for each drive mode.

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

Time to create page: 0.613 seconds
Powered by Kunena Forum