Hi,
Usually it’s best to try to keep MRES and ERES the same sign, which is overall less confusing. However, if you can’t do that, setting ERES negative
is the correct solution, assuming you can’t reinstall the encoder so it’s the correct direction. Or, the motor direction could be changed so that it matches the encoder (which may also mean re-wiring the limits).
However, if you can’t fix the hardware, you have the encoder stall issue because the driver expect the encoder to be moving in the same direction
as the motor. This check can be disabled either by disabling the encoder in the motor record (setting UEIP=No), or by setting the encoder tolerance to be a very high number. The encoder tolternace is a feature of the Galil driver, these two records:
$(P)$(M)_ENC_TOLERANCE_SP
$(P)$(M)_ENC_TOLERANCE
If you set the tolerance to a large value (say 1,000,000) it will effectively disable the direction check.
Cheers,
Matt
From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Chiang, Liang-Chih [???] via Tech-talk
Sent: Monday, March 27, 2023 4:58 AM
To: tech-talk at aps.anl.gov
Subject: [EXTERNAL] Encoder Stall happens when increasing direction of motor pulses is opposite of that of encoder count
I use Galil DCM 4080 motor controller and Renishaw absolute encoder.
When the increasing direction of motor pulses is opposite of that of encoder count,
which is, encoder count decreases while motor pulse increases,
my solution is to set motor record's ERES to be negative.
However, this solution will cause "Encoder Stall" problem.
The source of this problem cames from GalilAxis.cpp of Galil support module,
in the following function, encDirOk_ will be set to false because of opposite direction:
void GalilAxis::setStatus(bool *moving)
//Encoder direction ok flag
encDirOk_ = (encoder_direction == direction_) ? true : false;
...
then in the following function, because of encDirOk_ is false,
after a period of time, it will be regards as "Encoder Stall" and stop motor.
//Called by poll without lock
//When encoder problem detected
//May stop motor via pollServices thread
void GalilAxis::checkEncoder(void)
if (((ueip_ || ctrlUseMain_) && !done_ && !deferredMove_ && (!encoderMove_ ||
!encDirOk_)))
1. Is my solution "negative ERES"
ok?
2.What would be a good fix to Galil support module? Just remove checking of encDirOk_?