- Posts: 19306
- Thank you received: 0
G33 does not adjust IPM after the first one. 2.9.0 pre-3376
RBC wrote: Also, which file holds the codes for G33 behaviour? So I can understand how it works in detail. Thanks.
G33 is a special case of a straight move:
github.com/LinuxCNC/linuxcnc/blob/master...erp_convert.cc#L4749
The tricky part of using a stepgen to emulate an encoder is that there is no index pulse.
Ideally you would add a physical index pulse from a sensor on the spindle, then modigy the stepgen.c code to output a scaled version of the stepgen counts that latches to zero whenever index-enable is high and the index pulse is seen.
Ideally you do really want to use an actual index, though you could emulate it at a modulus of the stepgen counts if the spindle to motor gearing is fixed (eg toothed belt not friction belt)
The position output pin should zero at index (but only when enabled) then count up by exactly 1.0 for ever revolution of the spindle.
Please Log in to join the conversation.
From all this information, I decided to use a microcontroller to get the step counts and output 3 pins into a mesa encoder's A,B and Z.
Do you see any issues with this approach?
Please Log in to join the conversation.
Hmm.... If you configure a second Mesa stepgen to run alongside the main one, but in quadrature mode, you could loop that straight back to an encoder counter. (Or configure your stepper drive for quadrature input, if it can do that)
Then you could use an actual real index sensor on the spindle.
There is a sim_encoder HAL component, but it would need to run in a base thread and probably isn't fast enough.
Please Log in to join the conversation.
The idea to run another stepgen in quadrature mode is promising. I will try that idea first.
Please Log in to join the conversation.
andypugh wrote: Hmm.... If you configure a second Mesa stepgen to run alongside the main one, but in quadrature mode, you could loop that straight back to an encoder counter. (Or configure your stepper drive for quadrature input, if it can do that) .
Would this be a physical connection from the quadrature output to encoder counter or a hal pin connection?
But there will no index pulse as you said. So microcontroller will also solve that problem.
Please Log in to join the conversation.
A physical index detector will work properly, the uP approach won't give a consistent index run-to-run. Admittedly that only matters if you start a thread one day, shut down and complete it the next day.
Please Log in to join the conversation.
One thing I notice using G33, it does not seem to obey the max Velocity setting on Axis. It probably should throw and error at some point that the IPM cannot catch up with the RPM requested.
Please Log in to join the conversation.
RBC wrote: It probably should throw and error at some point that the IPM cannot catch up with the RPM requested.
There is a fix for that. I am trying to figure out if it went in or not.
github.com/LinuxCNC/linuxcnc/pull/479
Please Log in to join the conversation.
