turret idl routines

Last modified: Thu Mar 16 13:07:13 2023.


List of Routines


Routine Descriptions

TURCHECKENDIAN - CHECK WHETHER THE DATA NEEDS TO BE FLIPPED OR NOT.

[Next Routine] [List of Routines]
NAME:
turcheckendian - check whether the data needs to be flipped or not.
SYNTAX: needsflip=turcheckendian(d)
ARGS:
	d	: 	{turloginp} data to check for endian nes..
RETURNS:
	needsflip: int	1 need to flip data, 0 data in current machine format.
DESCRIPTION:
	turcheckendian will check if the data needs to be flipped (via swap_endian)
or not.

(See /pkg/rsi/local/libao/phil/tur/turcheckendian.pro)


TURINPDAY - INPUT A DAYS WORTH OF TUR ARCHIVE DATA.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
turinpday - input a days worth of tur archive data.
  SYNTAX:  n=turinpday(yymmdd,tur,fname=fname)
    ARGS:
  yymmdd:long  day to input
KEYWORDS:
fname :string  use this for the input file. Def: /share/phildat/tur/turyymmdd.dat
RETURNS:
      n:long   number of samples we found
  tur[n]:{}     structure holding the turret data. 

DESCRPIPTION:
   Input a days worth of the turret archive data. This info is written
once a second. the default data returned is:

IDL> help,tur,/st
** Structure TURLOG, 10 tags, length=216, data length=216:
   STATWD          LONG                15
   SECM            FLOAT           0.00000
   POS             FLOAT           285.816
   DEVSTAT         LONG              1025
   LASTREQPOS      FLOAT           285.791
   IOTRY           LONG          15662510
   IOFAIL          LONG              1322
   DAT             STRUCT    -> TURDATA Array[1]
   DATTM           FLOAT     Array[22]
    FLTS            STRUCT    -> FLTLOG Array[7]
help,tur.dat,/st
** Structure TURDATA, 22 tags, length=44, data length=44:
   AI_PS24P        INT           3035
   AI_PS24N        INT          -1568
   AI_PSB24P       INT           3199
   AI_PSENC5P      INT           2052
   AI_VELFB        INT             -2
   AI_MAMPCURMON   INT              0
   AI_MAMPSPDMON   INT             -5
   AI_SAMPCURMON   INT              0
   AI_SAMPSPDMON   INT             -4
   AI_ACCEL        INT              0
   AI_RATEPOTPCU   INT            196
   AO_VELCMD       INT           2001
   DI_LS           INT          -1113
   DI_UIO1         INT           1535
   DI_UIO2         INT          -6157
   DI_UIO3         INT           2627
   DO_LSUIO1       INT              0
   DO_UIO2_3       INT             40
   ST_MDRV         INT              2                            
   ST_SLDRV        INT              2                                                   
   ST_SAFLIMLOCKAXIS INT        28946                                                   
   ST_FAULT        INT           1537                       

this is the same as the online data strcuture: see ~phil/vw/h/tieProgState.h

(See /pkg/rsi/local/libao/phil/tur/turinpday.pro)


TURLAB - RETURN LABELS FOR VARIOUS TURRET BITMAPS

[Previous Routine] [Next Routine] [List of Routines]
NAME:
turlab - return labels for various turret bitmaps
SYNTAX: lab=turlab(type)
ARGS  :
       type    : string :
           'devstat': device status
           'dils'   : digital input little star
           'di1'    : digital uio 1 
           'di2'    : digital uio 2
           'di3'    : digital uio 3
           'dols_2' : digital out little star and uio2 out
       'drv_fltstat': drive and fault status

RETURNS:
lab[n] : strarr    labels for each bit in the word

DESCRIPTION:
   This routine is normally called from turplotsum(). It provides
the labels for all of the status bits.

Warning:
 the order of the labels returned has been modified slightly. Some
of the original status words had coded sets of bits rather than individual
bits. This routine provides a decoded list. See turplotsum to see
what you have to do with the binary numbers to use these labels.

(See /pkg/rsi/local/libao/phil/tur/turlab.pro)


TURPLOTSUM - PLOT A SUMMARY OF THE TIEDOWN DATA.

[Previous Routine] [List of Routines]
NAME:
turplotsum - plot a summary of the tiedown data.
SYNTAX: turplotsum,d,title=title,tmrange=tmrange,$
                  vpos=vpos,vvel=vvel,vtq=vtq,tqinc=tqinc,tqsmo=tqsmo,$
                  win=win,wait=wait,page=page,fl=fl,zerooff=zerooff
ARGS:
    d[] :{turlog} data to display. read via turinpday()

KEYWORDS:
   title: string title for each plot (eg date..)'
tmrange[2]:long  if provided, then limit the plots to
                 the tmrange[0],tmrange[1] time range. the units are hours.
   vpos[2]:float min max for pos vs time
   vvel[2]:float min max for commanded and feedback velocity..-2048,2048
    vtq[2]:float min max for torque plots
    tqinc :float display offset between each motor tq plot. def=0
   tqsmo  :int   number of seconds to smooth motor tqs. def=1 (no smoothing)
     win[]:int   window numbers to plot each page in..
     wait :      if set then wait for user to hit a key between each plot
      fl[]:float list of hours to flag in each page
     page :int   plot just one page of the info. default is all
zerooff   :float zero offset for vel cmd. default=50
fittime   :      if set then do linear fit for time. Useful
                 if there are time dropouts

DESCRIPTION:
    Plot the turret data and status info. The data comes from:
n=turinpday(yymmdd,tur) .. 

    You can plot a subset of the data in tur by using the tmr=[hr1,hr2] keyword
to limit the plots to between hr1 and hr2 hours of the day.

    the keyword page=n will output a single page (1..7)
    By default pages are output one after another with stopping. This is
normally used when plotting to a file. For inspection from a terminal,
use /wait so the program pauses after each page waiting for keyboard input.

    The output consists of analog data as well as status bits. 

    The analog data is output for both motors.The outputs are:
        torques: black=master, red=slave
		
    The status plots:
   -  Each bit is plotted as a line vs time
   -  The left side shows the bit label as well as a colored *.
   -  The * is the value=0 position the bit, value=1 moves the line 
      farther up.
   -  Labels that start with - (eg -CRmEmgS) negate the label.
       eg. -CRmEmgSt 1 value means control room emergency stop is off.

The pages are:
   
page 1; position, commanded and feedback velocity
page 2: the tiedown device status vs time
page 3: the little star digital inputs 
page 4: digital uio 1 and 2 inputs
page 5: little star digital output
page 6: drive and fault status
page 7: motor torques (for all 3 tiedowns)

To use these routines:
idl71
@phil
@turinit
yymmdd=150913
n=turinpday(yymmdd,tur)
turplotsum,td,/wait

to send output to a ps file:

pscol,'junk.ps',/full
turplotsum,d
hardcopy
x

(See /pkg/rsi/local/libao/phil/tur/turplotsum.pro)