NAME

TASS::Control - Controls a TASS Mark IV telescope.


SYNOPSIS

 use TASS::Control;
 $ts = TASS::Control->new;


DESCRIPTION

Provides a nice interface to control the telescope through TASS::Control::Driver. To ease use, any problems encountered from TASS::Control::Driver calls will cause this module to attempt to shut down all motors and then exit. Retries on all commands are handled through TASS::Control::Driver. Although restrictive sounding, I've not had many problems of premature exit through 50+ sunset to sunrise runs.

In order to provide orderly shutdown (and not leave the RA drive on), both INT and TERM signals are caught and directed through exit to call the object destructor, which shutdown down all motors.

This module forks one process to handle every picture download, so it also captures the CHLD signal and sets it to 'IGNORE' in case the parent manages to exit without telling the child to quit. This prevents zombie processes from accumulating.


METHODS

New
OBJREF = TASS::Control->new
OBJREF = TASS::Control->new( SCALAR )
OBJREF = TASS::Control->new( SCALAR, HASH )
Creates a Tass Control object and returns a reference to the object. Either takes nothing, or an initialization file name and hash of attributes. If the file name is not defined (first form or third form with 'undef' as the file name), the file 'tass-control.cfg' will be created with default values based on ROB. The same will occur if a file name is given but that file doesn't exist, it will be created with default values. Valid values within the hash will override the configuration file parameters.

For Example
 $tc = TASS::Control->new;
 $tc = TASS::Control->new( 'my_config.file' );
 $tc = TASS::Control->new( undef, ( 'port' => '/dev/ttyS1' ) );
Start
$tc->start
Instantiates the internal TASS::Control::Driver object with the configured port and baud. No other methods can be used without first executing this method. Additionally, loads the 'MPX' register with 0.

For Example
 $tc->start;
Initialize Telescope
$tc->init_telescope
Initializes the telescope for use. Turns off all motors, closes the dec clamp, drives the dec motor to it's limit, drives the ra motor to it's limit, closes the camera shutters.

For Example
 $tc->init_telescope;
All Off
$tc->all_off
Turns off all motors (ra, both focus, dec drive and dec_clamp). Generally not required to be called by the user as when a TASS::Control object is deleted, part of the process is to shut down the system automatically.

For Example
 $tc->all_off;
Dec Clamp Close
$tc->dec_clamp_close
Closes the DEC clamp by driving the motor in the amount specified in the configuration variable dec_clamp_in. Only closes the clamp if the current position is known to be open. Turns off the DEC drive motor after closure is complete. Leaves the DEC clamp motor off.

For Example
 $tc->dec_clamp_close;
Dec Clamp Open
$tc->dec_clamp_open
Opens the DEC clamp by driving the motor out the amount specified in the configuration variable dec_clamp_out. Only opens the clamp if the current position is known to be closed. Turns on the DEC drive motor before the open is executed. Leaves the DEC clamp motor off.

For Example
 $tc->get_clamp_open;
Dec Drive Move Steps
$tc->dec_drive_move_steps( SCALAR )
Moves DEC drive motor the specified number of steps. Positive steps move South declination, negative steps North. Will open and close dec clamp, but only if the clamp is closed. If the clamp is open, it will remain open. Program will exit if commanded to move below 0 or above the configurable max range parameter dec_drive_range.

For Example
 $tc->dec_drive_move_steps( 500 );
Dec Drive Move to Elevation
$tc->dec_drive_move_to_elev( SCALAR )
Moves DEC drive to the specified absolute elevation (given in degrees). Level North is 0 degrees, with 90 straight up and 180 South. See dec_drive_move_steps for specifics. Uses dec_drive_steps_degree for conversion to steps.

For Example
 $tc->dec_drive_move_to_elev( 70 );
Dec Drive Move Degree
$tc->dec_drive_move_degree( SCALAR )
Moves DEC drive relative to the current position the number of degrees given. See dec_drive_move_steps for specifics. Uses dec_drive_steps_degree for conversion to steps.

For Example
 $tc->dec_drive_move_degree( -1 );
Dec Drive Move to Degree
$tc->dec_drive_move_to_degree( SCALAR )
Moves DEC drive to the specified absolute declination degree. See dec_drive_move_steps for specifics. Uses dec_drive_steps_degree for conversion to steps.

For Example
 $tc->dec_drive_move_to_degree( 0 );
Dec Drive Current Degree
SCALAR = $tc->dec_drive_current_degree
Returns the current declination degree. Uses latitude, dec_drive_level_from_limit and dec_drive_steps_degree along with the current position.

For Example
 $location = $tc->dec_drive_current_degree;
Dec Drive to Limit
$tc->dec_drive_to_limit
Moves DEC drive to the North declination limit switch. If the limit is currently tripped, moves South declination for a maximum of 500 steps until it's off the limit. If the 500 step limit is reached, the program exists. Next, move North in steps of 100 until either the limit switch is reached or dec_drive_range is exceeded. Again, if it moves to far, the program exists. Once the limit is reached, steps of 1 are used moving South until the limit is cleared, and then move North 1 step at a time until the limit is reached one last time. The last move will give one measure of the backlash.

For Example
 $tc->dec_drive_to_limit;
Delay
$tc->delay( SCALAR )
Method to use if any delays are required. Floating point seconds accepted. Will send a command every 9 seconds to keep the stamp from timing out. Additionally, will check for RA moving beyond range in either direction. If excessive RA movement is detected, the program will exit.

For Example
 $tc->delay( 4.5 );
RA Motor ON
$tc->ra_on
Turns on the RA motor to the specified speed. If no speed is given, turns on to sidereal rate. Negative speed will move RA opposite sidereal. Speed has to be give in powers of 2.

$tc->ra_on( SCALAR )
For Example
 $tc->ra_on;
 $tc->ra_on( -32 );
RA Motor Off
$tc->ra_off
Turns off RA motor.

For Example
 $tc->ra_off;
RA to Limit
$tc->ra_to_limit
$tc->ra_to_limit( SCALAR )
Moves RA drive into it's limit flag. If a single argument is specified, that is the starting speed and direction. The direction given may be positive if the RA drive is beyond the flag sensor on the 'wrong' side. The RA limit flag is checked as fast as possible during this operation. Once the flag is seen, the speed is halved and reversed, then when the flag is cleared, the speed is halved and reversed again. This occurs until the speed is -1 and the flag is encountered for the final time. By finding the limit switch in this manner, a high speed move is used while still maintaining accuracy in finding the flag's position. If the flag is not found within the configured range of travel, the module will exit with an error logged.

For Example
 $tc->ra_to_limit;
 $tc->ra_to_limit( -16 );
 $tc->ra_to_limit( 8 );
RA Time Left
SCALAR = $tc->ra_time_left
Returns the number of sidereal seconds availabel until the configured range of travel is exceeded.

For Example
 $seconds = $tc->ra_time_left;
RA Current Degree
SCALAR = $tc->ra_current_degree
Returns the current RA position is decimal degrees.

For Example
 $where = $tc->ra_current_degree;
RA Current Hour
Returns the current RA position is decimal hour angle.
$tc->ra_current_hour
For Example
 $hour = $tc->ra_current_hour;
RA Current Second
$tc->ra_current_second
Returns the current second position from the limit switch.

For Example
 $second = $tc->ra_current_second;
RA Check Position
$tc->ra_check_position
Checks if the current RA position is beyond the configured range at either end of travel, and exists the program with an error if the limits are exceeded. Primarily used as an internal sanity check, but exported for the insane.

For Example
 $tc->ra_check_position;
RA to Meridian
$tc->ra_to_meridian
$tc->ra_to_meridian( SCALAR, SCALAR )
Moves RA to the meridian. Two optional parameters may be given which specify the offset from meridian and the speed to move at.

For Example
 $tc->ra_to_meridian;
 $tc->ra_to_meridian( 30, 8 );
 $tc->ra_to_meridian( undef, 8 );
RA Move Second
$tc->ra_move_second( SCALAR )
$tc->ra_move_second( SCALAR, SCALAR )
Moves RA relative the number of seconds given, with the speed to move an optional parameter.

For Example
 $tc->ra_move_second( 459 );
 $tc->ra_move_second( 459, -8 );
 $tc->ra_move_second( -459, 8 );
Dec Drive at Limit
SCALAR = $tc->dec_drive_at_limit
For Example
 $limit = $tc->dec_drive_at_limit;
RA at Limit
SCALAR = $tc->ra_at_limit
For Example
 $limit = $tc->ra_at_limit;
Camera 0 at Limit
SCALAR = $tc->camera_0_at_limit
For Example
 $limit = $tc->camera_0_at_limit;
Camera 1 at Limit
SCALAR = $tc->camera_1_at_limit
For Example
 $limit = $tc->camera_1_at_limit;
Current RA Range
(SCALAR, SCALAR) = $tc->current_ra_range
For Example
 ($start, $end ) = $tc->current_ra_range;
Shutter 0 Open
$tc->shutter_0_open
For Example
 $tc->shutter_0_open;
Shutter 1 Open
$tc->shutter_1_open
For Example
 $tc->shutter_1_open;
Shutter 0 Close
$tc->shutter_0_close
For Example
 $tc->shutter_0_close;
Shutter 1 Close
$tc->shutter_1_close
For Example
 $tc->shutter_1_close;
Get File Names
(SCALAR, SCALAR) = $tc->get_file_names
For Example
 ($camera_0_file, $camera_1_file) = $tc->get_file_names;
Clear CCDs
$tc->clear_ccds
For Example
 $tc->clear_ccds;
Take Object Pictures
$tc->take_object_pictures( SCALAR, SCALAR )
For Example
 $tc->take_object_pictures( 15, 100 );
Take Object Pictures Move
$tc->take_object_pictures_move( SCALAR, SCALAR, SCALAR, SCALAR )
For Example
 $tc->take_object_pictures_move( 10, 60, undef, 4 );
 $tc->take_object_pictures_move( 10, 60, -30, undef );
 $tc->take_object_pictures_move( 10, 100, -50, -1 );
Take Dark Pictures
$tc->take_dark_pictures( SCALAR, SCALAR )
For Example
 $tc->take_dark_pictures( 2, 60 );
Take Bias Pictures
$tc->take_bias_pictures( SCALAR )
For Example
 $tc->take_bias_pictures( 1 );
DAC Start
$tc->dac_start
For Example
 $tc->dac_start;
Dac End
$tc->dac_end
For Example
 $tc->dac_end;