epics-motor / motorNewport

EPICS motor drivers for Newport controllers
4 stars 6 forks source link

Why ESP300 IOC's .DRBV returns 0 when UEIP=ON #10

Closed LeeYangLBLBCS closed 1 year ago

LeeYangLBLBCS commented 2 years ago

With encoder present on ESP300, the DRBV always reads 0 if UEIP = YES. Is this the correct behavior?

MarkRivers commented 2 years ago

Does the stage you are using have an encoder?

LeeYangLBLBCS commented 2 years ago

Yes, they have encoders. The first two axes are servos. Encoder required. Axis 3 is a stepper. Also has an encoder

On Tue, Apr 12, 2022, 6:44 PM Mark Rivers @.***> wrote:

Does the stage you are using have an encoder?

— Reply to this email directly, view it on GitHub https://github.com/epics-motor/motorNewport/issues/10#issuecomment-1097464655, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSYGNECG5XJWUBSXQLKHT3VEYRIJANCNFSM5TJCH4QA . You are receiving this because you authored the thread.Message ID: @.***>

MarkRivers commented 2 years ago

Do you mean it reads 0 at startup, or even after you do a move?

LeeYangLBLBCS commented 2 years ago

It changes from a non zero value to 0 when UEIP is toggled to ON from OFF. And back to non zero when toggled back to OFF.

LeeYangLBLBCS commented 2 years ago

It happened after moves.

On Tue, Apr 12, 2022, 6:54 PM Mark Rivers @.***> wrote:

Do you mean it reads 0 at startup, or even after you do a move?

— Reply to this email directly, view it on GitHub https://github.com/epics-motor/motorNewport/issues/10#issuecomment-1097470355, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSYGNHMRINQJ7XJ7256NWTVEYSO5ANCNFSM5TJCH4QA . You are receiving this because you authored the thread.Message ID: @.***>

MarkRivers commented 2 years ago

I see the problem. It is in drvESP300.cc. The poller is supposed to return 2 positions for each axis:

Many controllers have separate commands to read these two positions. For example the MM4000 has a "TP" command to read the actual position and a "TH" command to read the theoretical position. The ESP300 does not, it only has the TP command. https://www.manualslib.com/manual/1601201/Newport-Esp300-Series.html?page=181#manual

drvESP300.cc sets motor_info->encoder_position=0 in the initialization function motor_init(). It only sets motor_info->position in the poller function in this line: https://github.com/epics-motor/motorNewport/blob/63b90d2f652437eb23e59bd2779f7455bc973e52/newportApp/src/drvESP300.cc#L274

The problem can be fixed by adding this line after that one:

motor_info->encoder_position = newposition;

It will not give you an real new functionality, because the encoder and theoretical positions will always be the same, but at least the encoder position won't be 0.

kmpeters commented 2 years ago

With encoder present on ESP300, the DRBV always reads 0 if UEIP = YES. Is this the correct behavior?

This behavior will also occur if the motor record's ERES field is 0.

Edit: I'm wrong. The motor record will set the ERES to the MRES if a user attempts to set it to 0. A similar behavior is seen if the RRES is set to zero and URIP is set to Yes.