Encoder (OMS-MAXV)

The following functions are used for OMS-MAXV stepper controllers that have encoders, e.g. RENISHAW RGH24.

get_motor_unit_position_encoder( id), gmupe()
returns the motor position calculated from the encoder reading. e.g.:
* = gmupe(mot1)

get_motor_encoder_raw( id), gmeraw()
returns the raw encoder reading. e.g.:
* = gmeraw(mot1)

get_motor_home_position( id), gmhp()
set_motor_home_position( id), smhm()
returns/sets the position of the home switch, e.g.:
* = gmhp( mot1)
smhp(mot1) = 50.186

get_motor_conversion_encoder( id), gmce()
set_motor_conversion_encoder( id), smce()
returns/sets the conversion factor that converts encoder values to units, e.g.:
* = gmce( mot1)
smce(mot1) = 20000

The encoder homing sequence is started by:

move/home mot1

The command returns an error, if

For the homing procedure Online determines the direction from where to approach home by looking at the sign of the unit-backlash. Consider the following setup: A motor can be moved from 0 to 100, home is at 50. If we start the homing procedure at 40, the motor is directly moved into home. If we start at 60, the motor is reflected at the limit switch near 100 before it finds home. For the coarse appoach Online uses the default slew rate, for the final appoach a value of 2000 steps/s is chosen. The general rule is: if the unit-backlash is greater than 0, the homing should start below the home position to save time.

Here is a log for a homing procedure:

 > Home thread begins 
writeMaxv: AX;VB20;AC200000;VL100000; 
 > set base, acceleration and slew
writeMaxv: AX;HR;ID; 
 > find home at full speed (using reverse direction) and set DONE
test-bit-done 1 
writeMaxv: AX;CA; 
 > clear DONE flag
clear-bit-done 
 > clear DONE bit
writeMaxv: AX;RP; 
readMaxv: 12492
 > read motor position
writeMaxv: AX;RE; 
readMaxv: 12495
 > read encoder position, motor and encoder are identical, 
 > makes no sense since we have -2 encs per step
writeMaxv: AX;LO-24990; 
 > set the motor position to the encoder position
HomeThread: moving to the start position of the final, slow approach 
writeMaxv: AX;MR36990;GO;ID; 
 > move to the starting point of the final, slow approach, use 
 > backlash and correct for the overtravel from the fast approach
test-bit-done 1 
writeMaxv: AX;CA; 
clear-bit-done 
HomeThread: starting final,slow approach 
writeMaxv: AX;RE; 
readMaxv: -5901
writeMaxv: AX;RP; 
readMaxv: 12000
 > that's where we start
writeMaxv: AX;#UR8192;VL2000;HR;ID; 
 > chose update rate, slew to 2000 and find home
test-bit-done 1 
writeMaxv: AX;CA; 
clear-bit-done 
writeMaxv: AX;RP; 
readMaxv: 6
writeMaxv: AX;RE; 
readMaxv: 11
writeMaxv: AX;LO-22; 
 > we are close to home, still we update the motor position
 > using the encoder 
writeMaxv: AX;VB20;AC200000;VL100000;MR12000;GO;MA0;GO;ID; 
 > moving back and forth (backlash) to hit the exact home position
test-bit-done 1 
writeMaxv: AX;LO0; 
 > sent by the calibration routine
 > home thread ends

If we start at the wrong position, a limit switch fires during the procedure:

 > Home thread begins 
writeMaxv: AX;VB20;AC200000;VL100000; 
writeMaxv: AX;HR;ID; 
HomeThread: limit switch fired 
 > we find a limit switch before we find home
writeMaxv: AX;#UR8192;VB20;AC200000;VL100000; 
writeMaxv: AX;HM;ID; 
 > so reverse the direction and search home again
test-bit-done 1 
writeMaxv: AX;CA; 
clear-bit-done 
writeMaxv: AX;RP; 
readMaxv: -12558
writeMaxv: AX;RE; 
readMaxv: -12560
writeMaxv: AX;LO25120; 
HomeThread: moving to the start position of the final, slow approach 
writeMaxv: AX;MR-13120;GO;ID; 
 > move to the starting point of the final, slow approach, use 
 > backlash and correct for the overtravel from the fast approach  
 > notice that we come from the other direction, compared to the
 > case above. That's why the relative move is different. Still
 > we start the final appoach at the same position. From now on
 > the procedure is identical to the one above.
test-bit-done 1 
writeMaxv: AX;CA; 
clear-bit-done 
HomeThread: starting final,slow approach 
writeMaxv: AX;RE; 
readMaxv: -6040
writeMaxv: AX;RP; 
readMaxv: 12000
writeMaxv: AX;#UR8192;VL2000;HR;ID; 
test-bit-done 1 
writeMaxv: AX;CA; 
clear-bit-done 
writeMaxv: AX;RP; 
readMaxv: 6
writeMaxv: AX;RE; 
readMaxv: 10
writeMaxv: AX;LO-20; 
writeMaxv: AX;VB20;AC200000;VL100000;MR12000;GO;MA0;GO;ID; 
test-bit-done 1 
writeMaxv: AX;LO0; 
 > home thread ends