/*****************************************************************************/ /* decerror.c Reports or changes the following shared memory (wiro.h) */ /* variable: */ /* #define DEC_ERR_COEFF tinfo->dec_enc_err_coeff */ /* double dec_enc_err_coeff; */ /* a constant equal to (Dec Encoder Error / DES_DEC) */ /* Syntax: decerror [new DEC_ERR_COEFF] */ /* Synopsis: Without the optional argument, decerror returns the current */ /* DEC_ERR_COEFF. If the optional argument is provided, decerror over- */ /* writes the current value for DEC_ERR_COEFF with the value of the */ /* argument. If the syntax or coefficient are unexpected then this help is*/ /* printed. */ /* Argument: a double within the range -0.005 to +0.005. Dimensionless. */ /* Obtained by first zeroing DEC_ERR_COEFF. Use two stars of different */ /* declination near zenith whose positions are well known. Center and icol */ /* on the first. Follow the second. Offset as required to center the second*/ /* star. Divide the dec offset by the known distance in dec to obtain */ /* DEC_ERR_COEFF. */ /* Background: Telescope gearing requires that one turn of a telescope */ /* encoder correspond to 0.5 degree on-sky. Both telescope encoders are */ /* Heidenhain ROQ-437. Ideally, the counting periodicity of an encoder's */ /* digital outputs should equal the angular periodicity of an encoder's */ /* shaft. This is not the case for the ROQ-437. Seperate scale factors for */ /* RA and Dec are stored within the ACU at SiteSetup>EncoderOffsetWindow. */ /* If the value of the scale factor is properly selected, then the */ /* encoder's digital periodicity will equal the encoder's shaft */ /* periodicity. */ /* Diagnosis: This scaling algorithm is broken for Dec. */ /* New Algorithm: When tracking utilities "follow", "fixed" or "planet" */ /* precipitate a slew to a new object, the trackloop pre-compensates for */ /* the dec encoder error by pre-loading the appropriate dec encoder-offset */ /* within the ACU at SiteSetup>EncoderOffsetWindow. This encoder-offset is*/ /* calculated by multiplying DEC_EFF_COEFF times DES_DEC. The ACU adds the */ /* encoder-offset to the actual Dec coordinate before the slew begins. No */ /* evidence of the offset remains after the slew is completed except within*/ /* the SiteSetup>EncoderOffsetWindow. The encoder-offset will be changed */ /* again before the next slew. JSW 23May2011 */ /*****************************************************************************/ #include #include #include #include #include #include "wirotypes.h" #include "track.h" #include "GPIBports.h" #include "wiro.h" void log_entry( char *comment ); struct wiro_memory *tinfo, *get_tinfo(); main( int argc, char *argv[] ) { double val; char log_message[ 64 ]; tinfo = get_tinfo(); if( argc < 2 ) { printf("\n%9.6f \n", DEC_ERR_COEFF); exit( 0 ); } else if( argc == 2 ) { if( sscanf( argv[ 1 ], "%lf", &val ) != 1 ) { help(); exit( 1 ); } if(( val < -0.005 ) || ( +0.005 < val )) { printf("\nArgument is out-of-range: %s\n", argv[ 1 ]); help(); exit( 2 ); } DEC_ERR_COEFF = val; sprintf( log_message, "Load new Dec encoder offset: %9.6f\n", DEC_ERR_COEFF); log_entry( log_message ); } else if (argc > 2) { printf("\nToo many arguments.\n"); help( ); exit( 5 ); } exit( 0 ); } /* end main */ help( ) { printf("\ndecerror.c Reports or changes the following shared memory\n"); printf(" (wiro.h) variable:\n"); printf(" #define DEC_ERR_COEFF tinfo->dec_enc_err_coeff\n"); printf(" double dec_enc_err_coeff;\n"); printf(" \\* a constant equal to (Dec Encoder Error / DES_DEC) *\\\n"); printf(" Command Syntax: decerror [new DEC_ERR_COEFF]\n"); printf(" Synopsis: Without the optional argument, decerror returns the\n"); printf(" current DEC_ERR_COEFF. If the optional argument is provided,\n"); printf(" decerror overwrites the current value for DEC_ERR_COEFF with\n"); printf(" the value of the argument. If the syntax or coefficient are\n"); printf(" unexpected then this help is printed.\n"); printf(" Argument: a double within the range -0.005 to +0.005.\n"); printf(" Dimensionless. Obtained by first zeroing DEC_ERR_COEFF. Use\n"); printf(" two stars of different declination near zenith whose positions\n"); printf(" are well known. Center and icol on the first. Follow the\n"); printf(" second. Offset as required to center the second star. Divide\n"); printf(" the dec offset by the known distance in dec to obtain\n"); printf(" DEC_ERR_COEFF.\n"); printf(" Background: Telescope gearing requires that one turn of a\n"); printf(" telescope encoder correspond to 0.5 degree on-sky. Both\n"); printf(" telescope encoders are Heidenhain ROQ-437. Ideally, the\n"); printf(" counting periodicity of an encoder\'s digital outputs should\n"); printf(" equal the angular periodicity of an encoder\'s shaft. This is\n"); printf(" not the case for the ROQ-437. Seperate scale factors for RA\n"); printf(" and Dec are stored within the ACU at\n"); printf(" SiteSetup>EncoderOffsetWindow. If the value of the scale\n"); printf(" factor is properly selected, then the encoder\'s digital\n"); printf(" periodicity will equal the encoder\'s shaft periodicity.\n"); printf(" Diagnosis: This scaling algorithm is broken for Dec.\n"); printf(" New Algorithm: When tracking utilities \"follow\", \"fixed\" or\n"); printf(" \"planet\" precipitate a slew to a new object, the trackloop\n"); printf(" pre-compensates for the dec encoder error by pre-loading the\n"); printf(" appropriate dec encoder-offset within the ACU at\n"); printf(" SiteSetup>EncoderOffsetWindow. This encoder-offset is\n"); printf(" calculated by multiplying DEC_EFF_COEFF times DES_DEC. The ACU\n"); printf(" adds the encoder-offset to the actual Dec coordinate before\n"); printf(" the slew begins. No evidence of the offset remains after the\n"); printf(" slew is completed except within the\n"); printf(" SiteSetup>EncoderOffsetWindow. The encoder-offset will be\n"); printf(" changed again before the next slew. JSW 23May2011\n\n"); }