CAROUSEL(9)
π CAROUSEL(9) β HAL Component
okay so bestie, welcome to the CAROUSEL(9) manual page β it's a HAL Component and it's literally here to make toolchanger carousels make sense. no cap, it's giving β¨very usefulβ¨. let's get into it π
π NAME
carousel β orient a toolchanger carousel using various encoding schemes πΈ
β¨ SYNOPSIS
loadrt carousel pockets=N[,N] encoding=ssss[,sss] num_sense=N[,N]
dir=N[,N]
pocketsβ the number of pockets in each toolchanger. use up to 8 numbers separated by commas to create multiple carousel components. multi-carousel slay πencodingβ the position encoding. your options aregray,binary,bcd,index,edge,countsorsingle. Default ='gray'num_senseβ the number of position sense pins. Default = 4.dirβ set to 1 for unidirectional or 2 for bidirectional operation. Default = bidirectionalparityβ set to 1 for odd parity, 0 for even parity checking. Default = 0 (even)
π¦ DESCRIPTION
okay so this component is here to help you operate various types of carousel-type toolchangers. it's the bestie your toolchanger didn't know it needed π«Ά
You can configure it to work with binary, binary-coded decimal (BCD) or gray-coded position feedback (that's the 'binary', 'bcd' and 'gray' modes). Or, alternatively, it can work with an individual sensor for each tool position ('single' mode), or with a sensor at each tool position and a separate index ('index' mode). Systems using a stepper motor or quadrature encoder are also supported ('counts' mode). And edge? it's a special case of index mode for tool changers with pockets on both the rising and falling edges of the position sensor. (Seen on at least one Denford Orac.) π₯
Both unidirectional and bidirectional systems are supported β and yeah, that includes the ones that reverse against a stop when in position. iconic behaviour fr fr.
The number of carousel component instances created depends on the number of entries in the pockets modparam. For example:
loadrt carousel pockets=10,10,8
Would create 3 carousel instances with 10, 10 and 8 pockets. The other parameters are optional β if they're absent, then defaults will be used. Any missing entry will assume the previous value. lowkey convenient π
When the enable pin is set to true, the component will immediately set the "active" pin to true and then (for a bidirectional instance) calculate the shortest path to the requested pocket number. The appropriate motor direction output pins will then be set. Bit outputs for forward and reverse are provided as well as a three-state velocity output for driving a DC motor PWM or a velocity-mode stepgen. she's efficient, your honour β¨
The component will monitor the carousel position and, when the correct position is reached, set the motor-control pins to 0, set "active" to 0 and set "ready" to 1. mission accomplished π
In 'index', 'edge' or 'counts' mode there is a need to find the initial home position of the carousel. The first time that the "enable" pin is set; the carousel will rotate forwards searching for a home signal. In 'index' and 'edge' mode this is when both the index and pulse inputs are true. In 'counts' mode only the index input needs to be set to set home. Additionally in 'counts' mode the usual index-enable logic of the encoder counters is supported.
With some carousel designs the carousel will not stop immediately. To allow for this, set the align-dc pin to a low velocity to be used for a final latching move, and set the decel-time to a suitable value. Once the decel-time has expired the carousel will, if it was moving forwards, reverse back on to the position marker, off of the marker and then back on to the FWD edge. If moving in reverse it will continue off the marker and then reverse slowly on to the FWD edge. This alignment is only possible with a motor-vel controlled bidirectional carousel. Other combinations will be acepted but probably will not have the desired behaviour. Some tuning will be needed of align-dc and decel-time to achieve reliable operation. tuning arc unlocked π§
In the unusual case that the index and pulse signals do not align it is possible to use HAL logic to achieve the desired pin switching during homing. iykyk π§
Setting "enable" low does not halt the homing move, so if homing on first tool change is not needed then the enable pin can be toggled by an axis homing pin or a script and the homing process will continue even if that driving signal resets during the carousel homing move. she commits to the bit π
To operate the component with an encoder or stepgen use mode "C". The scale pin should be the number of steps or encoder counts between pocket centres. The width pin can be used to stop the motor some distance before the centre of the pocket to allow the motor time to decelerate. In mode "C" it is possible to use either the speed/direction control used in other modes or to use direct position mode using the counts-target pin. The internal scaling of the encoder or stepgen should be set to 1.0. A PID hal component will be needed for encoder applications whereas stepgen configurations can use a stepgen in position control mode or in velocity control mode with a PID. π§
For tool changers which lock the carousel against a stop the rev-pulse pin can be set to a non-zero value. The motor-rev pin will then be set for this many seconds at the completion of the tool search and at the same time the reverse duty/cycle velocity value will be sent to the motor-vel pin. periodt π
π FUNCTIONS
carousel.N(requires a floating-point thread)
π PINS
carousel.N.pocket-numbers32 inβ the pocket to move to when the.enablepin goes high. If the value passed is higher than the number of pockets specified in the"pockets"modparam then modulo arithmetic is used. This is intended to allow the use of multiple tools in the same holder, as is sometimes useful with lathes.carousel.N.enablebit inβ set this pin high to start movement. Setting it low will stop movement.carousel.N.activebit outβ indicates that the component is active.carousel.N.readybit outβ this pin goes high when the carousel is in-position.carousel.N.strobebit in (default: 1)β use this pin to indicate that the position feedback is valid. Often provided by binary encoders.carousel.N.paritybit inβ some encoders supply a parity bit, if this is connected then theparity-erroroutput bit will indicate parity errors.carousel.N.sense-Mbit in (M=0..personality)β carousel position feedback pins. In'index'mode there will be only 2 pins.sense-0is the index andsense-1is the pocket sensor.carousel.N.rev-pulsefloat inβ the duration in seconds for which a ratchet changer (Boxford, Emco) should pulse the reverse pin to lock the holder.carousel.N.fwd-dcfloat inβ velocity or duty cycle when forwards rotation is desired.carousel.N.rev-dcfloat inβ velocity or duty cycle when reverse rotation is desired.carousel.N.hold-dcfloat inβ duty cycle when carousel is in-position (to hold against stop).carousel.N.align-dcfloat inβ use this pin to set the speed of a slower alignment move once the changer is in position. Such a system almost certainly needsdecel-timesetting too.carousel.N.decel-timefloat inβ time to wait for carousel to stop before final alignment and position check.carousel.N.countss32 inβ connect to the rawcounts of an encoder or a stepgen in'counts'mode.carousel.N.scales32 in (default: 100)β the number of stepgen or encoder counts between successive pockets.carousel.N.widths32 in (default: 10)β how far each side of the exact scale to signal a new pocket.carousel.N.home-offsets32 in (default: 0)β the offset (in counts) between the index and pocket 1.carousel.N.index-enablebit ioβ used to home to an encoder index.carousel.N.jog-fwdbit inβ jog the carousel forwards one tool position.carousel.N.jog-revbit inβ jog the carousel in reverse (only ifdir = 2).
β οΈ bestie it is very important that these pins should be debounced and should probably also be interlocked to only operate when the machine is idle. do not skip this π
carousel.N.motor-fwdbit outβ indicates the motor should run forwards (bigger numbers).carousel.N.motor-revbit outβ indicates the motor should run reverse.carousel.N.parity-errorbit outβ indicates a parity error.carousel.N.current-positions32 outβ this pin indicates the current position feedback.carousel.N.motor-velfloat outβ the duty-cycle or velocity to drive a DC motor or stepgen.carousel.N.homedbit out (default: 0)β shows that homing is complete. Only used in index and edge modes.carousel.N.unhomebit in (default: 0)β should only really be necessary for testing.carousel.N.counts-targetfloat outβ target position for a stepgen or external PID controller.
π PARAMETERS
carousel.N.states32 r (default: 0)β current component state.carousel.N.homingbit r (default: 0)β shows that homing is in progress. Only used for index mode.carousel.N.timerfloat rβ shows the value of the internal timer.carousel.N.motor-dirs32 rβ internal tag for search direction.carousel.N.counts-offsets32 rβ internal offset of index pin.carousel.N.debounceu32 rwβ how many thread cycles to wait for the position to stabilise.carousel.N.targets32 rβ current target pocket, debug.carousel.N.base-countss32 r (default: 0)
π«Ά AUTHOR
Andy Pugh β the actual legend behind this π
β LICENSE
GPL β free as in freedom, bestie π
and that's the whole page!! huge thanks to LinuxCNC Documentation, dated 2026-03-17, for this one β CAROUSEL(9) out, go orient some toolchangers πβ¨π
π¦ where this page comes from
- ubuntu resolute: linuxcnc-uspace 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms