Homing

Homing Specifications

Introduction

The following document describes the expected behavior for different types of homing routine. It is written as expectations of what a motion controller can do; additional constraints may be added by the plug-in. Routines are roughly categorized by their dependence on other motors. Each routine may be supplemented, where applicable, by an offset or torque balancing.

For all homing routines, a motor has parameters for direction, acceleration, deceleration, and maximum velocity. These values may be different from during normal operation. It is assumed that any start of motion will happen at the homing acceleration, any stop of motion will happen at the homing deceleration, and any movement will not exceed the homing velocity. All homing routines should begin motion in the homing direction (i.e. positive or negative). This is true for all types of homing described below.

Some sections will refer to extra parameters needed for that particular style of homing. These parameters should be allowed for when configuring homing for a given motor, but can be safely ignored during homing routines that do not use them

Single-Motor Homing

Set Position

For the Set Position homing routine, the motor does not move. The motor then should do a controlled move to its offset position.

This method is also called "Home to Current Position."

Marker / Index Pulse

For the Marker / Index Pulse homing routine, the motor will move in its homing direction until the marker pulse on the encoder is found. The motor then should do a controlled move to its offset position.

Limit Switch

For the Input Switch homing routine, the motor will move in its homing direction until the limit input of the correct direction is triggered. If the motor is moving positive, then it should watch for the positive limit switch. If the motor is moving negative, it should watch for the negative limit switch. Upon capture of the limit trigger, the motor should perform a controlled deceleration. In order to capture an accurate position, the limit input must be a high-speed input. After capturing the rising edge, the motor should move at a specified speed in the opposite direction from homing direction, which may be slower than the initial homing speed, until the falling edge is captured. After capturing the falling edge, which is the home position, the motor should come to a controlled stop. The motor then should do a controlled move to its offset position.

It is strongly suggested that each limit is wired separately. However, in the event that the limits are wired together (i.e. hitting either switch will cause both limits to trigger), then while homing, the limit in the non-homing direction should be ignored. So, while homing positive, if the negative limit is triggered, the motion should continue until the positive limit is triggered. If they are wired together, the limits will activate at the same time. Additionally, if the deceleration from capturing the rising edge of the limit allows the motor to travel past the limit, thus creating a falling edge on the "wrong side" of the limit, the drive should ignore that falling edge and still move back the other direction until the correct falling edge is detected.

Limit Switch then Marker

For the Input Switch/Marker homing routine, the motor will perform a Input Switch routine as normal, without applying an offset move, and then perform a Marker/Index Pulse routine. However, for the Input Switch/Marker routine, the initial movement to find the marker pulse will be in the opposite direction from the homing direction, thus ensuring that the motor will move away from the limit, into a safe area. So, if the homing direction is positive, then the marker pulse will be searched for in the negative direction. If the homing direction is negative, the marker pulse will be searched for in the positive direction. The motor then should do a controlled move to its offset position.

Sensor Switch

For the Latch Switch homing routine, the motor will move in its homing direction until the input sensor is triggered. Upon capture of the input, the motor should perform a controlled deceleration. In order for this position to be accurate, the input should be wired to a high-speed input. After capturing the rising edge, the motor should move at a specified speed in the opposite direction from homing direction, which may be slower than the initial homing speed, until the falling edge is captured. After capturing the falling edge, which is the home position, the motor should come to a controlled stop. The motor then should do a controlled move to its offset position.

If the deceleration from capturing the rising edge of the limit allows the motor to travel past the limit, thus creating a falling edge on the "wrong side" of the limit, the drive should ignore that falling edge and still move back the other direction until the correct falling edge is detected.

The difference between Sensor Switch homing and Limit Switch homing is that during Limit Switch homing, the functionality of the limit switch is disabled. During Sensor Switch homing, if a limit is activated, motion should stop and homing should cancel.

Sensor Switch then Marker

For the Latch Switch/Marker homing routine, the motor will perform a Sensor Switch routine as normal, without applying an offset move, and then perform a Marker/Index Pulse routine. However, for the Marker/Index Pulse routine, the initial movement to find the marker pulse will be in the opposite direction from the homing direction, thus ensuring that the motor will move away from the sensor, into a safe area. So, if the homing direction is positive, then the marker pulse will be searched for in the negative direction. If the homing direction is negative, the marker pulse will be searched for in the positive direction. The motor then should do a controlled move to its offset position.

Torque

For the Torque homing routine, the motor should move in its homing direction until the homing torque limit is reached, still operating in speed mode and not exceeding the maximum homing velocity. The motor should then do a controlled deceleration to a full stop, before doing a controlled move to its offset position

Torque then Marker

For the Torque/Marker homing routine, the motor will perform a Torque routine as normal, then perform a Marker/Index Pulse routine. However, for the Marker/Index Pulse routine, the initial movement to find the marker pulse will be in the opposite direction from the homing direction, thus ensuring that the motor will move away from the torque limit, into a safe area. So, if the homing direction is positive, then the marker pulse will be searched for in the negative direction. If the homing direction is negative, the marker pulse will be searched for in the positive direction. The motor then should do a controlled move to its offset position

Multi-Motor Homing

For clarity in this section, the master motor and all slaves that it owns will all be referred to as slaved motors.

For slaved motors, it is most important that if one motor starts a homing routine, all motors must start their homing routine. Each motor in a set should be able to have its own homing style and is not required to use the same homing method as others in its set. The motion controller should not report that homing is complete until all motors have completed their routine.

The following sections include the descriptions of the most basic forms of homing expected for slaved motors. Extra features, such as offsets or balancing, are discussed later. In addition to each method below, any slaved motor should be able to perform a non-slaved homing routine

Mechanical Specifications

Slaving of two motors does not require identical mechanical specifications. This is due to some systems requiring their motors to move together, while not necessarily physically connecting them. Such an example would be multiple drills on a table; all drills together may be considered one axis and must move together, but they can have completely independent mechanics.

However, they are restricted to have the same acceleration, deceleration, and velocity parameters, in order to facilitate their coordination. Except in special circumstances, this should not be enforced by the motion controller, but instead should be enforced by the plugin. The plugin should facilitate selecting the minimum acceleration, deceleration, and velocity from all slaved motors and send those values to the motion controller. Because the mechanics of each motor may be different, the motion controller may see different values for each motor. The exception, of course, is if the motion controller takes these values as units, rather than as encoder counts.

Given that the above is met, all methods should work equally well with motors that do have identical mechanics.

Master Homing

In order to use Master Homing, the master motor must be using a homing option defined above, and each slave that wishes should select Master Homing. Any homing method that employs Marker/Index Pulse should be restricted from use. This should be enforced by the motion controller; ideally, the plugin should be enforcing this rule as well. All motors in the set will start their homing routine. The master motor will be performing a normal routine, and all slaves using the Master Homing routine will be following the position of the master motor. Upon completing the homing routine, and before applying any offsets or balancing, the master motor must communicate to its slaves that homing was completed. Any slave that was not using Master Homing should ignore the communication and continue with their normal homing routine. Then the master motor and all slaves using Master Homing will do their offset moves together; note: the slaves do not need to have the same offset as the master motor.

While in this mode, the slaves will still obey their homing acceleration, deceleration, and maximum velocity. Additionally, if a slave encounters a limit switch or torque limit, the slave should stop motion, alert the master motor, and homing for those motors should be canceled.

Additional Parameters

Home Offset

Offsets are a way to change the reported position of a homing operation. In this document, an unqualified offset generally refers to a motor home offset.

If a motor offset is to be applied to a motor, it will be given to the controller as a directional distance to travel. The distance is always given from the trigger position. For Input Switch and Latch Switch homing, this means it is a distance from the falling edge of the signal, not the position the motor finished its deceleration at. Similarly for Marker/Index Pulse and Torque homing, it is a distance from the position where the marker pulse was found or where the torque limit was exceeded, not from where the deceleration ended. The motor must finish its normal homing routine and then move the offset distance. If the offset distance is 0, then the motor would move to exactly where the falling edge, torque limit, or marker pulse was found. After the move is complete, this new position should be set to zero, and then the motion controller should report to the plugin that homing is complete.

Home Condition

This is where the homing condition is met: current position, index pulse, home switch active, etc.

Motor Home Offset

The motor home offset is the amount (in position units) added to the physical home position that the motor position will report zero.

This quantity is referred to as slave misalignment by the HiCON.

Axis Home Offset

The (Mach 4) axis home offset is the position that Mach 4 will display when the motor is at the home position.

No Home Offsets

When no offsets are employed, the physical location where the homing condition is active is where the Mach 4 will report a motor's position as zero.

After homing an axis, the motor will be at the physical location of the homing condition and Mach will report the current position as 0.0000.

Motor Home Offset

When a motor home offset is configured, the reported motor position of zero is the physical location of the homing condition with the motor home offset added to it.

If move to zero is configured, the motor will move to that position at the end of the homing routine.

A motor home offset might be useful if you wanted your zero position to be a small amount away from the home/limit switch to ensure that commanding a move to zero wouldn't accidentally trigger the switch.

After homing an axis with a motor offset of 0.25, the motor will be 0.25 units in the positive direction past the physical location of the homing condition and Mach will report the current position as 0.0000.

Axis Home Offset

When an axis home offset is configured, the reported motor position at the physical location of the homing condition corresponds to the Mach 4 position equal to the axis offset.

If a move to zero is configured, the motor will be commanded to the physical location where the homing condition is active.

An axis home offset might be useful if the physical axis location of zero is not actually reachable by the axis, but the physical location is useful as a reference point.

After homing an axis with an axis offset of -5.0000, the motor will be at the physical location of the homing condition and Mach 4 will report the axis position as -5.0000.

Motor and Axis Home Offsets

When both offsets are configured, the physical zero position that would correspond to the offset home position corresponds to the the Mach 4 position equal to the axis offset.

If a move to zero is configured, the motor will be commanded to the physical location of the motor home offset past where the homing condition is active. It will not move the the Mach 4 axis position of zero.

After homing an axis with a motor home offset of 0.75 units and an axis offset of 6.0000, the motor will be 0.75 units past the physical location of the homing condition and Mach 4 will report the axis position as 6.0000.

Multi-Motor

For a set of slaved motors, any motor which has an offset to move, cannot move until all motors in the set have completed their normal homing routine. This allows for motors to be physically connected and not pull the system into an unsafe position. So then, all motors in a set will start their normal homing procedure together, and then start their offset procedure together. The procedure itself will be the same as if the motor were un-slaved.

Balancing

Torque balancing of a motor is only relevant for slaved motors that are physically connected. As such, any motion controller that provides a torque balancing option for slaved motors must be able to disable that feature for any given motor in a slaved set. Any motor which has torque balancing enabled will do its balancing after all motors in the set have applied any homing offset they may have. The routine is such that the motor will move in the positive direction until the balancing torque limit is reached, then move in the negative direction until the balancing torque limit is reached. The motor will then move to the midpoint of these positions, where the torque should be minimized. Note that the value used for balancing torque is not the same as the value used for Torque homing.

Absolute Encoders

Motors which use absolute encoders should have the manner in which they are commanded to home restricted. Any axis for which all motors assigned use absolute encoders should only allow their homing routines to be commanded from the plug-in configuration dialog. Any axis which contains only incremental encoders, or mix of both types, should allow homing commands from either the on-screen buttons or through the plug-in configuration dialog.

Reporting Home Status

The drive is expected to be able to report if it has been homed since it has successfully homed, or to otherwise provide a way to calculate that information. Many drives will indicate an alarm when there is an encoder battery error (i.e. loss of power). This alarm will cause the drive to no longer be homed. The user can clear this alarm, and so its presence (or lack thereof) is not a complete indicator of if the drive is currently homed.

Once the home status of the drive has been determined, the plug-in should relay this information to Mach by setting the appropriate output signal (i.e. OSIG_HOMED_X). Note that homing is reported for an axis, not for individual motors. In order to report homed for an axis, all drives assigned to that axis must be reporting that they are homed. Otherwise, it should be assumed that the axis is not homed.

Commanding Homing Routines

The plug-in is expected to prevent accidental homing of drives using absolute encoders. This is done by preventing the use of on-screen homing buttons. Instead, any axis that contains only absolute encoders must have its homing routine commanded from the plug-in configuration dialog. Any axis containing only incremental encoders, or a mix of absolute and incremental encoders, may be commanded from the on-screen buttons or through the plug-in configuration dialog. The plug-in must implement a method for determining if a homing command has come from the proper avenue given the type of encoders on the axis, and should alert the user if homing must be done in a different manner.

Use-Case Scenarios

The following sections contain various types of mechanical and software configurations.

Unslaved Motors

Set Position with Offset

A single motor that is configured to use the Set Position homing routine and has a home offset of -1000 counts exists on the X axis. The motor has no master and no slaves. Upon receiving a command to home, the motor will do a controlled acceleration and deceleration to move 1000 counts in the negative direction. Once arriving and stopping all motion, the motor will set its current position to 0 and inform the controller that it has completed homing.

Limit / Marker Homing

A single motor that is configured to use the Input Switch/Marker homing routine in the negative direction and has a home offset of 0 counts exists on the X axis. The motor has no master and no slaves. Upon receiving a command to home, the motor will do a controlled acceleration up to its maximum homing velocity, moving in the negative direction. At the trigger of the limit switch, the motor will do a controlled deceleration to a full stop. It so happens that the deceleration causes the motor to move fully past the switch, so that the limit is no longer active. The motor will then move slowly in the positive direction until it detects the fall of the limit switch, ignoring the initial rising edge as it comes back onto the switch. The motor will then continue to move in the positive direction until finding the first marker pulse on the encoder. When the marker pulse has been found, the motor will do a controlled deceleration to a full stop. The motor will then calculate the end position it should to be at and go to that position, which because the offset is 0 counts will be precisely where the marker was found, and do a controlled move to that position. After the motor has settled in position, the motor will set its current position to 0 and inform the controller that it has completed homing.

Torque Homing with Offset

A single motor that is configured to use the {\TQ} homing routine in the positive direction and has a home offset of -1000 counts exists on the X axis. The motor has no master and no slaves. Upon receiving a command to home, the motor will do a controlled acceleration up to its maximum homing velocity, moving in the positive direction. When the torque limit is reached, the motor will perform a controlled deceleration to a full stop. The motor will then calculate the end position it should be at, which should be 1000 counts back past where torque limit was reached, and do a controlled move to this position. After the motor has settled at the offset position, the motor will set its current position to 0 and inform the controller that it has completed homing.

Slaved Motors

Two Unconnected Motors with Different Routines

Two motors exist on the Z axis. There is no physical connection between them; they are both drills on the same table. The master motor is configured for Latch Switch homing in the positive direction, with an offset of -1000 counts. The slave motor is configured for Marker/Index Pulse homing in the positive direction, with an offset of 100 counts. When the axis receives a command to home, both motors start their homing routine immediately. The slave will move positively until it finds its marker pulse, and then do a controlled deceleration. The master will move positively until the sensor is triggered. Once the master has found the sensor and the slave has found its marker pulse, then both motors will move their respective offsets. Once each motor has completed its offset move, it will set its current position to 0 and inform the controller that it has completed homing.

Two Connected Motors with Different Offsets

Two motors exist on the X axis. There is a physical gantry connecting them. Both motors are configured for Input Switch homing in the negative direction. The master motor has an offset configured for 1000 counts and the slave has an offset configured for 500 counts. When the axis receives a command to start homing, both motors will start moving in the negative direction. Each motor will stop when it triggers its respective limit switch. Upon both motors finding their limit switches, both motors will move their respective offsets. Each motor will set its current position to 0 and inform the controller that it has completed homing, after it has settled at its offset position.

Three Motors with Different Routines and Offsets

There exist three motors on the Y axis. The master motor and slave 0 are both configured for Master Homing homing in the positive direction. Both motors have an offset of -1000 and slave 0 is configured to use torque balancing. Slave 1 is configured for Latch Switch / Marker homing in the negative direction, with no offset. When the Y axis is commanded to home, all motors start moving together. The master and slave 0 move in the positive direction and slave 1 moves in the negative direction. When the master reaches its sensor, it broadcasts to slave 0 and slave 1 that the sensor has been reached. Slave 0 immediately performs a deceleration; slave 1 ignores the transmission and continues. After slave 1 completes the Latch Switch / Marker homing, then the master and slave 0 will complete their offset moves. Meanwhile, slave 1 will set its current position to 0 and inform the controller that it has completed homing. After the master and slave 0 complete the offset move, the master motor will set its current position to 0 and inform the controller that it has completed homing. Slave 0 will then move in the positive direction until the balancing torque limit is reached, then it will move in the negative direction until the balancing torque limit is reached, and then it will move to the calculated middle, where the torque is minimized. Once slave 0 has settled its position, it will set its current position to 0 and inform the controller it has completed homing.