point package¶
Submodules¶
point.nexstar module¶
NexStar hand controller command API.
Contains a single class NexStar which provides an API for the NexStar hand controller command set. The serial command protocol is documented here: http://www.nexstarsite.com/download/manuals/NexStarCommunicationProtocolV1.2.zip
-
class
point.nexstar.NexStar(device, read_timeout=3.5)¶ Bases:
objectImplements the serial commands used by NexStar telescope mount hand controllers.
-
exception
ReadTimeoutException¶ Bases:
ExceptionRaised when read from NexStar times out.
-
exception
ResponseException(response, *args, **kwargs)¶ Bases:
ExceptionRaised on bad command responses from NexStar.
-
response¶ The byte array which was received but was deemed invalid. This can be inspected to see what the (possibly partial) bad response looks like. Do not expect this buffer to necessarily match the expected response length; it could be shorter or longer. Note also that the terminating ‘#’ character is not included.
Type: bytes
-
-
alignment_complete()¶ Checks if alignment has been completed.
Returns: True if mount is aligned, False otherwise. Return type: bool
-
cancel_goto()¶ Cancels any GOTO operation that is in progress.
Has no effect when no GOTO operation is in progress.
-
echo(echo_val)¶ Send an echo command.
This command can be used to test the integrity of the serial interface. A single byte value is sent with the command that the hand controller will echo back.
Parameters: echo_val (int) – An integer in range(0, 256) to be sent.
Returns: The value in the response from the hand controller, which will always be the same as echo_val. If the response does not match echo_val an exception is raised.
Return type: int
Raises: ValueError– When echo_val is not in range(0, 256).ResponseException– When the response from the hand controller does not contain echo_val.
-
get_azalt()¶ Get current mount position in horizontal (azimuth/altitude) coordinates.
Note that if an alignment has not been performed the horizontal coordinates reported by the hand controller will be relative to where the mount was pointed when powered on.
Returns: A pair of angles (azimuth, altitude) in degrees. Azimuth range is [0,360) and altitude range is [-180,180). Return type: tuple of floats
-
get_device_version(dev)¶ Get device firmware version.
Parameters: dev (int) – A value from the following table (from protocol documentation): 16 = AZM/RA Motor 17 = ALT/DEC Motor 176 = GPS Unit 178 = RTC (CGE only) Returns: Device firmware version number as (major, minor) tuple. Return type: tuple of ints Raises: ResponseException– When the device does not respond. In this case the response length will be 3 bytes rather than the usual 2, but the actual content of the response is garbage. See the Developer Notes section of the serial protocol documentation for details.
-
get_gps_location()¶ Get the GPS position in geographic (latitude/longitude) coordinates.
Returns: A pair of angles (latitude, longitude) in signed degrees format. Return type: tuple of floats
-
get_gps_lock_status()¶ Get the status of GPS lock
Returns: True if GPS is linked (locked?), false if GPS is not linked (no lock?) Return type: bool
-
get_gps_time()¶ Get the current GPS time in seconds since the Unix epoch.
Returns: A Unix timestamp (seconds since 1 Jan 1970 in UTC minus leap seconds) Return type: int
-
get_location()¶ Get the mount location on Earth in geographic (latitude/longitude) coordinates.
Returns: A pair of angles (latitude, longitude) in signed degrees format. Return type: tuple of floats
-
get_model()¶ Get mount model.
Returns: Mount model encoded as an integer. According to V1.2 of the protocol documentation this can be decoded using the following table: 1 = GPS Series 3 = i-Series 4 = i-Series SE 5 = CGE 6 = Advanced GT 7 = SLT 9 = CPC 10 = GT 11 = 4/5 SE 12 = 6/8 SE Return type: int
-
get_radec()¶ Get current mount position in equatorial (right ascension/declination) coordinates.
Note that the equatorial position reported by the hand controller will not be meaningful until an alignment has been performed.
Returns: A pair of angles (right ascension, declination) in degrees. Return type: tuple of floats
-
get_time()¶ Get the current time from the hand controller in seconds since the Unix epoch.
Timezone information and daylight savings time are not currently supported. If the hand controller is set to a non-zero UTC offset or if daylight savings time is enabled the Unix timestamp returned by this function will most likely be incorrect.
Returns: A Unix timestamp (seconds since 1 Jan 1970 in UTC minus leap seconds) Return type: int
-
get_tracking_mode()¶ Get the current tracking mode.
Returns: The current tracking mode where 0 = Off 1 = Alt/Az 2 = EQ North 3 = EQ South Return type: int
-
get_version()¶ Get hand controller firmware version.
Returns: Firmware version number as (major, minor) tuple. Return type: tuple of ints
-
goto_azalt(az, alt)¶ Go to a position in horizontal (azimuth/altitude) coordinates.
Parameters: - az (float) – Azimuth angle in degrees.
- alt (float) – Altitude angle in degrees.
-
goto_in_progress()¶ Check if a GOTO command is in progress.
Note that this cannot be used to detect if the mount is in motion because the return value will only be True when the mount is performing a GOTO operation. If the mount is slewing for any other reason, such as when slew_var or slew_fixed are called, this method will return False.
Returns: True if a GOTO is in progress, False otherwise. Return type: bool
-
goto_radec(ra, dec)¶ Go to a position in equatorial (right ascension/declination) coordinates.
Parameters: - ra (float) – Right ascension angle in degrees.
- dec (float) – Declination angle in degrees.
-
set_location(lat, lon)¶ Set the mount location on Earth in geographic (latitude/longitude) coordinates.
Parameters: - lat (float) – Latitude in signed degrees format.
- lon (float) – Longitude in signed degrees format.
-
set_time(timestamp=None)¶ Set the time on the hand controller.
Timezone information and daylight savings time are not currently supported. When this method is called, the UTC offset will be set to 0 and daylight savings time will be disabled. This effectively means that the hand controller clock will be set to UTC.
Parameters: timestamp (int) – A Unix timestamp (seconds since 1 Jan 1970 in UTC minus leap seconds). If omitted, the time will be obtained from the clock of the machine running this Python program.
-
set_tracking_mode(mode)¶ Set the tracking mode.
This command has no effect before an alignment is performed. Prior to alignment, the tracking mode will always be 0 (off).
Parameters: mode (int) – The mode to set. Must be one of the following values: 0 = Off 1 = Alt/Az 2 = EQ North 3 = EQ South
-
slew_fixed(axis, rate)¶ Fixed-rate slew command.
Fixed-rate means that only the nine rates supported on the hand controller keypad are available.
Parameters: - axis (str) – The mount axis to command. Use ‘az’ or ‘alt’ for AZ/ALT mounts. Use ‘ra’ or ‘dec’ for equatorial mounts.
- rate (int) – The desired slew rate from -9 to +9. Use value 0 to stop motion.
-
slew_var(axis, rate)¶ Variable-rate slew command.
Variable-rate simply means that the angular rate can be specified precisely in arcseconds per second, in contrast to the nine fixed rates available on the hand controller keypad.
Parameters: - axis (str) – The mount axis to command. Use ‘az’ or ‘alt’ for AZ/ALT mounts. Use ‘ra’ or ‘dec’ for equatorial mounts.
- rate (float) – The desired slew rate in arcseconds per second. Value may be positive or negative. The maximum rate may be mount dependent. The maximum advertised rate for the NexStar 130SLT is 3 deg/s. However the maximum commandable rate for the same model was found by experimentation to be 16319 arcseconds per second or ~4.5 deg/s.
-
sync(ra, dec)¶ Sync mount to a position in equatorial (right ascension/declination) coordinates.
This command informs the hand controller that the mount is currently pointed at the provided coordinates to improve accuracy of future nearby goto commands. See NexStar command reference for details.
Parameters: - ra (float) – Right ascension angle in degrees.
- dec (float) – Declination angle in degrees.
-
exception