Warning: The homing of a motor involves the risk that the
motor moves all the way to the limit switches. Software limits
are ignored during the homing procedure. Make sure that the limit switches
are correctly cabled.
The homing procedure should be started from Online -tki. In the following
it is explained step by step, starting from scratch.
- make sure that the FlagEncoder property (Tango server) is set and that it has the value 1.
If you have to create this property and change its value, the Tango server
has to be restarted.
- open the Move widget
- open the Encoder widget from the Move widget (Options)
- move the motor a little bit forth and back to check that the
encoder reading changes.
- set the correct encoder conversion factor. This is a possible
procedure:
- move the motor to position 0 (Move widget).
- set the home position to 0 (Encoder widget).
- clear the motor step register (MotorProperties widget).
- clear the encoder position by clicking on Cali Enc. (Encoder widget).
- set the encoder conversion factor to 1 (Encoder widget).
- move the motor to 1 units (Move widget).
- the encoder raw position gives the encoder conversion factor (Encoder widget).
There may be tiny deviations between the actual value and the true value due
to hardware imperfections, e.g. if the encoder raw position
is 19988 the true conversion factor is most likely 20000.
- set the encoder conversion factor (Encoder widget).
- If the encoder conversion factor and the conversion factor
have different signs, set the FlagInvertEncoderDir to 1 and change the sign of
the encoder conversion factor. This fixes the bug that the encoderRatio
must not be negative.
- move back to 0. Check whether the encoder position is 0 and
the encoder raw position is 0.
- suppose the backlash is greater than 0: move the motor to a
position below the home position. If you have no idea
where the home position is, search it while standing in front of the axis.
The encoder LED changes its colour when moving over the home position.
If you have no clear indication where the home position is, ask an expert.
- make sure that the backlash is sufficiently large. It is a frequent
error that the backlash is too small.
- start the motor homing sequence (Encoder widget). While the
motor is homed, software limits are ignored. The motor moves
until it senses home (reference mark) or hits a limit switch.
If a limit switch is hit, the direction of the motion is reversed to search
for home. If the second limit switch is hit, the sequence is terminated.
- if the homing procedure was not successfull but the motor stopped near
the home position, this is most likely because the backlash was too small.
- the motor is homed now but the encoder position is meaningless, since
the correct home position has not been set yet. You have to
determine the current motor position somehow and set the home position
accordingly.
- set the correct motor unit limits. In general the homing
procedure changes them. That is because the step register is
cleared when the motor moves over the reference position.
However, the limit re-adjustment needs to be done only once
after the first homing procedure of a motor.
The function get_motor_unit_position_encoder() works only
after a motor has been homed. If this is not possible, the
function get_motor_encoder_raw() provides a relative
measurement. A virtual counter that uses the raw encoder reading
may look like this:
if( $method =~ /reset/i)
{
return 1;
}
if( $method =~ /read/i)
{
return Spectra::get_motor_encoder_raw( "mot25")/Spectra::get_motor_conversion_encoder( "mot25");
}