carousel − Orient a toolchanger carousel using various encoding schemes


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.

encoding The position encoding.

gray, binary, bcd, index or single. Default = ’gray’

num_sense The number of position sense pins.

Default = 4.

dir Set to 1 for unidirectional or 2 for bidirectional operation.

Default = bidirectional parity Set to 1 for odd parity, 0 for even parity checking. Default = 0 (even)


This component is intended to help operate various types of carousel-type toolchangers. The component can be configured to operate with binary, binary-coded decimal (BCD) or gray-coded position feedback, with an individual sensor for each tool position or with a sensor at each tool position and a separate index.

At the moment it is best-suited to Geneva-mechanism type systems where the motor is either on or off. Both unidirectional and bidirectional systems are supported.

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 absent then defaults will be used. Any missing entry will assume the previous value.

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 pin will then be set.

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.

In index mode the behaviour is slightly different. The first time that the "enable" pin is set; the carousel will rotate forwards until both the index and pulse inputs are true. If there is no pulse line at the index position then a HAL "or2" function can be used to allow the index sensor to toggle both inputs. 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.




carousel.N.pocket-number s32 in

The pocket to move to when the .enable pin goes high. If the value passed is gigher than the number of pockests 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.enable bit in

Set this pin high to start movement. Setting it low will stop movement bit out

indicates that the component is active

carousel.N.ready bit out

This pin goes high when the carousel is in-position

carousel.N.strobe bit in (default: 1)

Use this pin to indicate that the position feedback is valid. Often provided by binary encoders

carousel.N.parity bit in

Some encoders supply a parity bit, if this is connected then the parity-error output bit will indicate parity errors

carousel.N.sense-M bit in (M=0..personality)

Carousel position feedback pins. In ’index’ mode there will be only 2 pins. sense-0 is the index and sense-1 is the pocket sensor.

carousel.N.jog-fwd bit in

Jog the carousel forwards one tool position

carousel.N.jog-rev bit in

Jog the carousel in reverse (only if dir = 2). It is very important that these pins should be debounced and should probably also be interlocked to only operate when the machine is idle.

carousel.N.motor-fwd bit out

Indicates the motor should run forwards (bigger numbers)

carousel.N.motor-rev bit out

Indicates the motor should run reverse.

carousel.N.parity-error bit out

Indicates a parity error

carousel.N.current-position s32 out

This pin indicates the current position feedback


carousel.N.state s32 r (default: 0)

Current component state

carousel.N.homing bit r (default: 0)

Shows that homing is in progress. Only used for index mode

carousel.N.homed bit r (default: 0)

Shows that homing is complete. Only used in index mode


andy pugh