API Reference¶
This section contains the automatically generated documentation for the project modules.
INDI Driver¶
Celestron AUX INDI Driver
This module implements an INDI driver for Celestron mounts using the AUX protocol. It uses the indipydriver library for INDI communication and ephem for astronomical calculations.
Configuration is loaded from config.default.toml and config.toml.
- class celestron_aux.celestron_indi_driver.CelestronAUXDriver(driver_name: str = 'Celestron AUX')[source]¶
Bases:
IPyDriverINDI Driver for Celestron mounts.
Manages INDI properties, hardware communication via AUX bus, and coordinate transformations with multi-point SVD alignment support.
- async equatorial_to_steps(ra_hours: float, dec_deg: float, time_offset: float = 0, base_date: Any | None = None) Tuple[float, float][source]¶
Converts RA/Dec to motor encoder steps.
- async get_tracking_rates(ra: float, dec: float, base_date: Any | None = None) Tuple[float, float][source]¶
Calculates current tracking rates in steps/second.
- async goto_position(target_azm: int, target_alt: int, ra: float | None = None, dec: float | None = None, force_approach: str | None = None) bool[source]¶
Executes a GoTo movement with optional anti-backlash approach. Checks against slew limits before moving.
- async handle_cordwrap(event: Any) None[source]¶
Enables or disables cord wrap prevention on the mount.
- async handle_cordwrap_pos(event: Any) None[source]¶
Sets the cord wrap prevention position on the mount.
- async handle_equatorial_goto(event: Any) None[source]¶
Handles GoTo or Sync command using RA/Dec coordinates.
- async handle_gps_refresh(event: Any) None[source]¶
Manually refreshes location and time from the GPS module.
- is_move_allowed(azm_steps: float, alt_steps: float) bool[source]¶
Checks if the given position (in steps) is within configured limits.
- async read_mount_position(base_date: Any | None = None) None[source]¶
Periodically reads encoder steps and updates RA/Dec.
- async slew_by_rate(axis: AUXTargets, rate: int, direction: int) None[source]¶
Sends a rate-based slew command to a motor axis.
- async slew_to(axis: AUXTargets, steps: int, fast: bool = True) bool[source]¶
Sends a position-based GoTo command to a motor axis.
- async steps_to_equatorial(azm_steps: float, alt_steps: float, base_date: Any | None = None) Tuple[float, float][source]¶
Converts motor encoder steps to RA/Dec.
- celestron_aux.celestron_indi_driver.apply_refraction(alt_deg: float) float[source]¶
Adds atmospheric refraction to true altitude to get apparent altitude.
- celestron_aux.celestron_indi_driver.deep_merge(base: dict, override: dict) dict[source]¶
Recursively merges two dictionaries.
AUX Protocol¶
Celestron AUX Protocol Library
This module implements the binary communication protocol used by Celestron telescope mounts via the AUX bus. It provides classes for command creation, parsing, and asynchronous communication over Serial or TCP.
References
NexStar AUX Command Set documentation
indi-celestronaux C++ implementation
- class celestron_aux.celestron_aux_driver.AUXCommand(command: AUXCommands, source: AUXTargets, destination: AUXTargets, data: bytes = b'')[source]¶
Bases:
objectRepresents a single Celestron AUX bus command packet.
- command¶
The command to execute.
- Type:
- source¶
The sender of the command.
- Type:
- destination¶
The target device.
- Type:
- MAX_CMD_LEN = 32¶
- START_BYTE = 59¶
- fill_buf() bytes[source]¶
Serializes the command into a byte buffer for transmission.
- Returns:
The complete packet (START | LEN | SRC | DST | CMD | DATA… | CS).
- Return type:
- get_data_as_int() int[source]¶
Converts command data bytes to a big-endian integer.
- Returns:
The integer value of the payload.
- Return type:
- classmethod parse_buf(buf: bytes) AUXCommand[source]¶
Parses a byte buffer into an AUXCommand object.
- Parameters:
buf (bytes) – Received bytes.
- Returns:
The parsed command object.
- Return type:
- Raises:
ValueError – If the start byte is invalid or buffer is too short.
- class celestron_aux.celestron_aux_driver.AUXCommands(value)[source]¶
Bases:
EnumEnumeration of Celestron AUX bus commands.
- FOC_GET_HS_POSITIONS = 44¶
- GET_VER = 254¶
- GPS_GET_DATE = 59¶
- GPS_GET_LAT = 1¶
- GPS_GET_LONG = 2¶
- GPS_GET_SATS = 56¶
- GPS_GET_TIME = 51¶
- GPS_LINKED = 55¶
- GPS_SET_DATE = 60¶
- GPS_SET_LAT = 49¶
- GPS_SET_LONG = 50¶
- GPS_SET_TIME = 52¶
- GPS_TIME_VALID = 54¶
- MC_AUX_GUIDE = 38¶
- MC_AUX_GUIDE_ACTIVE = 39¶
- MC_DISABLE_CORDWRAP = 57¶
- MC_ENABLE_CORDWRAP = 56¶
- MC_GET_APPROACH = 252¶
- MC_GET_AUTOGUIDE_RATE = 71¶
- MC_GET_CORDWRAP_POS = 60¶
- MC_GET_MODEL = 5¶
- MC_GET_POSITION = 1¶
- MC_GOTO_FAST = 2¶
- MC_GOTO_SLOW = 23¶
- MC_LEVEL_DONE = 18¶
- MC_LEVEL_START = 11¶
- MC_MOVE_NEG = 37¶
- MC_MOVE_POS = 36¶
- MC_POLL_CORDWRAP = 59¶
- MC_SEEK_DONE = 24¶
- MC_SEEK_INDEX = 25¶
- MC_SET_APPROACH = 253¶
- MC_SET_AUTOGUIDE_RATE = 70¶
- MC_SET_CORDWRAP_POS = 58¶
- MC_SET_NEG_GUIDERATE = 7¶
- MC_SET_POSITION = 4¶
- MC_SET_POS_GUIDERATE = 6¶
- MC_SLEW_DONE = 19¶
- PWR_GET_CURRENT = 2¶
- PWR_GET_STATUS = 3¶
- PWR_GET_VOLTAGE = 1¶
- SIM_GET_SKY_POSITION = 255¶
- class celestron_aux.celestron_aux_driver.AUXCommunicator(port: str, baudrate: int = 19200, timeout: float = 1.0)[source]¶
Bases:
objectHandles asynchronous communication with the AUX bus.
Supports Serial (via pyserial-asyncio) and TCP (via socket:// prefix). Implements echo-skipping for one-wire bus environments.
- async connect() bool[source]¶
Establishes connection to the AUX bus.
- Returns:
True if successful, False otherwise.
- Return type:
- async send_command(command: AUXCommand) AUXCommand | None[source]¶
Sends an AUX command and waits for a response.
Implements echo skipping: if the received packet matches the sent one (common on AUX bus), it is ignored, and the next packet is read.
- Parameters:
command (AUXCommand) – Command to send.
- Returns:
The response packet, or None on failure/timeout.
- Return type:
- class celestron_aux.celestron_aux_driver.AUXTargets(value)[source]¶
Bases:
EnumEnumeration of devices on the AUX bus.
- ALT = 17¶
- ANY = 0¶
- APP = 32¶
- AZM = 16¶
- BAT = 182¶
- CHG = 183¶
- FOCUS = 18¶
- GPS = 176¶
- HC = 4¶
- HCP = 13¶
- LIGHT = 191¶
- MB = 1¶
- WiFi = 181¶
Alignment Model¶
Alignment Subsystem for Telescope Mounts
Provides mathematical models for coordinate transformation based on alignment stars.
- class celestron_aux.alignment.AlignmentModel[source]¶
Bases:
objectManages N-point alignment transformation using a 6-parameter geometric model. Compensates for Rotation, Cone Error, Non-Perpendicularity, and Index Offsets.
- add_point(sky_vec: List[float] | ndarray, mount_vec: List[float] | ndarray, weight: float = 1.0, sector_size: float = 15.0, max_per_sector: int = 2) None[source]¶
Adds an alignment point using Residual-Aware Grid Thinning. Ensures even sky coverage by managing points in angular sectors.
- get_local_matrix(target_sky_vec: List[float] | ndarray, local_bias: float) ndarray[source]¶
Returns a weighted SVD matrix (Fallback for small point counts).
- celestron_aux.alignment.angular_distance(az1: float, alt1: float, az2: float, alt2: float) float[source]¶
Calculates angular distance between two points in degrees.
- celestron_aux.alignment.vector_from_altaz(az_deg: float, alt_deg: float) List[float][source]¶
Converts Alt/Az to a 3D unit vector.
- celestron_aux.alignment.vector_from_radec(ra_hours: float, dec_deg: float) List[float][source]¶
Converts RA/Dec to a 3D unit vector.