@Lcvette-
Carousel doesn't create a joint or axis in the normal sense. It might help to think of a carousel-controlled motor as a rotary axis outside the normal framework, which is commandable via gcode (using motion.analog-out and digital-in/out), but which is not synchronized to the other axes.
If using carousel in counts mode, it is physically connected like a step/dir axis.
If using one of the other modes, it uses gpio to turn on/off a 'dumb' motor. Your 3-phase induction motor with relays (or digital IO to the vfd) would be an example of using a non-counts mode.
For a '
counts' (stepgen) version of carousel my basic architecture looks like this:
- stepgen physical pins connected to Mesa step/dir output
- could be parallel port, or other pins fast enough for your particular system
- stepgen (software or Mesa in my case) set up in hal
- Usual stepgen settings in INI file (scale, accel, velocities, type) like an axis
- stepgen input connected to carousel output
- stepgen.N.counts <= carousel.N.counts
- stepgen.N.position-command <= carousel.N.counts-target
- desired pocket number command via gcode
- carousel.N.pocket-number <= motion.analog-out-NN
- carousel position, homing, and other feedback connected via gpio
- Counts mode only requires a single index pin - no per-pocket sensor required
For one of the other carousel modes (grey, binary, bcd, etc) the ATC requires an encoder of some sort depending on the mode selected.
- Encoder can be complicated or simple
- "Index" mode requires a home (index) sensor as well as a per-pocket sensor
- I've seen at least one example on the forum of a BCD encoder which uses four proxys and a four-track series of holes drilled in the ATC platter to create an absolute encoder for carousel
- Carousel uses the encoder feedback to turn on/off gpio outputs to the motor at the appropriate time
- Fine alignment, both for homing or pocket-to-spindle, can be adjusted in carousel settings
- carousel.N.home-offset
- carousel.N.align-dc (and other related settings)
Beyond that, commanding carousel is virtually identical to what you cooked up in Probe Basic... except the M10/M11/M12 subroutines are no longer necessary. Instead of doing the destination pocket math in the subroutine, carousel handles distant & shortest-path and reports back to LCNC (via carousel.N.current-position) when the target position is reached.
In my config, I connect the "P" parameter (passed to M10) to carousel instead of passing it on to M11/M12.
Code:
;***Rotate ATC***
M68 E0 Q#<P> ; Set carousel destination pocket
M64 P0 ; Rotate carousel to selected-pocket
G4 P0.5 ; Pause required before M66 check
M66 P0 L3 Q10 ; Wait for carousel finished
; Stop motor
O120 if [#5399 LT 0]
(abort, failed to align carousel)
O120 endif
M65 P0
So all the math & motor enable/disable is done inside carousel.
Does this help?