Rumen Bogdanovski > NexStarCtl-0.09 > NexStarCtl

Download:
NexStarCtl-0.09.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.09   Source   Latest Release: NexStarCtl-0.13

NAME ^

 NexStarCtl - API to control NexStar compatible telescopes

SYNOPSIS ^

 use NexStarCtl;
 
 my $port = open_telescope_port("/dev/XXX"); 
 if (!defined $port) {
        print "Can not open communication port.\n";
        exit;
 }
 
 # check if the mount is aligned
 if (tc_check_align($port)) {
        print "The telescope is aligned.\n";
 } else {
        print "The telescope is not aligned.\n";
 }
 
 # Read the stored coordinates of the location
 my ($lon,$lat) = tc_get_location_str($port);
 if (! defined($lon)) {
        print "Telescope did not respond\n";
        close_telescope_port($port);
        exit;
 }
 print "Location coordinates:\n LON=$lon\n LAT=$lat\n";

 my ($date,$time,$tz,$dst) = tc_get_time_str($port);
 # ...
 # Do some other stuff
 # ...
 
 close_telescope_port($port);

DESCRIPTION ^

This module implements the serial commands supported by the Celestron NexStar hand control. This applies to the NexStar GPS, NexStar GPS-SA, NexStar iSeries, NexStar SE Series, NexStar GT, CPC, SLT, Advanced-VX, Advanced-GT, and CGE mounts.

Communication to the hand control is 9600 bits/sec, no parity and one stop bit via the RS-232 port on the base of the hand control.

For extended example how to use this perl module look in to the distribution folder for nexstarctl/nexstarctl.pl. This program is a complete console tool to control NexStar telesctopes based on NexStarCtl module.

TESCOPE COMMUNICATION ^

open_telescope_port(port_name)

Opens a comminication port to the telescope by name (like "/dev/ttyUSB0") and returns it to be used in other finctions. In case of error undef is returned.

read_telescope(port, len)

Reads data from the telescope. On error or in case less than len bytes are read undef is returned.

write_telescope(port, data)

Writes data to the telescope and the result of write is returned.

close_telescope_port(port)

Closes the communication port to the telescope.

TELESCOPE COMMANDS ^

tc_check_align(port)

If the telescope is aligned 1 is returned else 0 is returned. If no response received undef is returned.

tc_goto_rade(port, ra, de)
tc_goto_rade_p(port, ra, de)

Slew the telescope to RA/DEC coordinates ra, de (in decimal degrees). Function tc_goto_rade_p uses precise GOTO. If RA is not in [0;360] function returns -1. If DEC is not in [-90;90] -2 is returned. If no response received undef is returned.

tc_goto_azalt(port, az, alt)
tc_goto_azalt_p(port, az, alt)

Slew the telescope to AZ/ALT coordinates az, alt (in decimal degrees). Function tc_goto_azalt_p uses precise GOTO. If AZ is not in [0;360] function returns -1. If ALT is not in [-90;90] -2 is returned. If no response received undef is returned.

tc_get_rade(port)
tc_get_rade_p(port)

Returns the the current telescope RA/DEC coordinates ra, de (in decimal degrees). Function tc_get_rade_p uses precise GET. If no response received undef is returned.

tc_get_azalt(port)
tc_get_azalt_p(port)

Returns the the currents telescope AZ/ALT coordinates az, alt (in decimal degrees). Function tc_get_azalt_p uses precise GET. If no response received undef is returned.

tc_sync_rade(port, ra, de)
tc_sync_rade_p(port, ra, de)

Syncs the telescope to RA/DEC coordinates ra, de (in decimal degrees). Function tc_goto_azalt_p uses precise sync. If RA is not in [0;360] function returns -1. If DEC is not in [-90;90] -2 is returned. If no response received undef is returned.

tc_goto_in_progress(port)

Returns 1 if GOTO is in progress else 0 is returned. If no response received undef is returned.

tc_goto_cancel(port)

Cancels the GOTO operation. On success 1 is returned. If no response received undef is returned.

tc_echo(port, char)

Checks the communication with the telecope. This function sends char to the telescope and returns the echo received. If no response received undef is returned.

tc_get_model(port)

This function returns the mount model as a number. See CELESTRON documentation. If no response received undef is returned.

tc_get_version(port)

This function returns the mount version as a number. See CELESTRON documentation. If no response received undef is returned.

tc_get_location(port)

This function returns the stored location coordinates lon, lat in decimal degrees. Negative longitude is WEST. Negative latitude is SOUTH. If no response received undef is returned.

tc_get_location_str(port)

This function returns the stored location coordinates lon and lat as strings. If no response received undef is returned.

tc_set_location(port,lon,lat)

This function sets the location coordinates lon, lat in decimal degrees. Negative longitude is WEST. Negative latitude is SOUTH. If the coordinates are invalid -1 is returned. If no response received undef is returned.

tc_get_time(port)

This function returns the stored time (in unixtime format), timezone (in hours) and daylight saving time(0|1). If no response received undef is returned.

tc_get_time_str(port)

This function returns the stored date, time (as strings), timezone (in hours) and daylight saving time(0|1). If no response received undef is returned.

tc_set_time(port, time, timezone, daylightsaving)

This function sets the time (in unixtime format), timezone (in hours) and daylight saving time(0|1). On success 1 is returned. If no response received undef is returned. If the mount is known to have RTC (currently only CGE and AdvancedVX) the date/time is set to RTC too.

tc_get_tracking_mode(port)

Reads the tracking mode of the mount and returns one of the folowing: TC_TRACK_OFF, TC_TRACK_ALT_AZ, TC_TRACK_EQ_NORTH, TC_REACK_EQ_SOUTH. If no response received undef is returned.

tc_set_tracking_mode(port, mode)

Sets the tracking mode of the mount to one of the folowing: TC_TRACK_OFF, TC_TRACK_ALT_AZ, TC_TRACK_EQ_NORTH, TC_REACK_EQ_SOUTH. If the mode is not one of the listed -1 is returned. If no response received undef is returned.

tc_slew_fixed(port, axis, direction, rate)

Move the telescope the telescope around a specified axis in a given direction with fixed rate.

Accepted values for axis are TC_AXIS_RA_AZM and TC_AXIS_DE_ALT. Direction can accept values TC_DIR_POSITIVE and TC_DIR_NEGATIVE. Rate is from 0 to 9. Where 0 stops slewing and 9 is the fastest speed.

On success 1 is returned. If rate is out of range -1 is returned. If no response received undef is returned.

tc_slew_variable(port, axis, direction, rate)

Move the telescope the telescope around a specified axis in a given direction with specified rate.

Accepted values for axis are TC_AXIS_RA_AZM and TC_AXIS_DE_ALT. Direction can accept values TC_DIR_POSITIVE and TC_DIR_NEGATIVE. Rate is the speed in arcsec/sec. For example 3600 represents 1degree/sec.

On success 1 is returned. If no response received undef is returned.

get_model_name(model_id)

Return the name of the mount by the id from tc_get_model(). If the mount is not known undef is returned.

UTILITY FUNCTIONS ^

notnum(n)

If "n" is a real number returns 0 else it returns 1.

precess(ra0, dec0, equinox0, equinox1)

Precesses coordinates ra0 and dec0 from equinox0 to equinox1 and returns the caclculated ra1 and dec1. Where ra and dec should be in decimal degrees and equinox should be in years (and fraction of the year).

round(n)

Returns the rounded number n.

d2hms(deg)

Converts deg (in decimal degrees) to string in hours, minutes and seconds notion (like "12h 10m 44s").

d2dms(deg)

Converts deg (in decimal degrees) to string in degrees, minutes and seconds notion (like "33:20:44").

d2dms(deg)

converts deg (in decimal degrees) to string in degrees and minutes notion (like "33:20").

dms2d(string)

converts string of the format "dd:mm:ss" to decimal degrees. If the string format is invalid format undef is returned.

hms2d(string)

Converts string of the format "hh:mm:ss" to decimal degrees. If the string format is invalid format undef is returned.

nex2dd(string)

Converts NexStar hexadecimal coordinate string (in fraction of a revolution) of the format "34AB,12CE" to two decimal degree coordinates.

pnex2dd(string)

Converts precision NexStar hexadecimal coordinate string (in fraction of a revolution) of the format "12AB0500,40000500" to two decimal degree coordinates.

dd2nex(deg1,deg2)

Converts coordinates deg1 and deg2 (in decimal degrees) to NexStar hexadecimal coordinate string (in fraction of a revolution) of the format "34AB,12CE".

dd2nex(deg1,deg2)

Converts coordinates deg1 and deg2 (in decimal degrees) to precise NexStar hexadecimal coordinate string (in fraction of a revolution) of the format "12AB0500,40000500".

SEE ALSO ^

http://www.celestron.com/c3/images/files/downloads/1154108406_nexstarcommprot.pdf

AUTHOR ^

Rumen Bogdanovski, <rumen@skyarchive.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2013 by Rumen Bogdanovski

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: