pcdshub / engineering_tools

A repository of scripts, configuration useful for the PCDS team
Other
4 stars 26 forks source link

mismatch between title variable and actual edm screen title for some motors #226

Open KaushikMalapati opened 3 days ago

KaushikMalapati commented 3 days ago

Expected Behavior

motor-expert-screen should finish executing and move the screen to the cursor irrespective of the type of motor

Current Behavior

For certain types of motors including but not limited to pulsepickers, aerotechs, and smaracts, the variabel title will not match the actual title of the screen opened, resulting in xdotool search --sync hanging forever, the screen never being aligned to the cursor, and motor-expert-screen never completing.

Possible Solution

I think the way title is set should be changed. Instead of having on if-elif-else block to set the title, and another to open the screen, we should only have one block where we set the title variable and another variable containing the command that will open the screen. At the end of the block, xdotool search for old windows, then execute the command. This will make it easier to make sure each different type of screen correctly sets the title variable.

Steps to Reproduce (for bugs)

  1. Run motor-expert-screen with a pv for a pulsepicker, aerotech, or smaract motor (XPP:SB2:MMS:29, XCS:SND:T1:Y1, or XPP:MCS2:01:m1 respectively)
  2. Observe that motor-expert-screen never finishes executing, it just stays in the foreground until you manually terminate it, and that the screen is never moved to your mouse by xdotool.

Context

I noticed it while working on #233. I also feel like I've noticed this before but never paid it much attention.

Your Environment

KaushikMalapati commented 3 days ago

Mismatches I have found so far

Type        PV          MES title           actual title
PP          XPP:SB2:MMS:29      Aerotech motor      IMS Motor Control
AeroTech    XCS:SND:T1:Y1       Aerotech motor      SmarAct Motor Control
SmarAct     XPP:MCS2:01:m1      Aerotech motor      SmarAct Motor Control

How title variables are set (no fall through)

title
Newport XPS Positioner      rtyp == xps8p
IMS Motor Control -- Main   rtyp == ims
Typhos Suite - $(PREFIX)    rtyp == motor and caget "${PREFIX}:PLC:nErrorId_RBV"
Aerotech motor          rtyp = motor
IMS Motor Control -- Main   rtyp != motor and caget "$PREFIX.PN"
IMS Motor Control       rtyp != motor

How the screen is decided (also no fall through)

screen
typhos              rtyp == motor and caget "${PREFIX}:PLC:nErrorId_RBV"
xps8                rtyp == xps8p
mmc             rtyp == mmca
pcds_motion         rtyp == motor and caget "$PREFIX:PN"
mcs2_main           rtyp == motor and ($PREFIX == *"MCS2"* || $(caget "$PREFIX:PTYPE_RBV") and enc == *"Yes"*
mcs2_openloop           rtyp == motor and ($PREFIX == *"MCS2"* || $(caget "$PREFIX:PTYPE_RBV") and enc != *"Yes"*
aerotech            rtyp == motor
ims             rtyp != motor