Crate zwo_mount_control

Crate zwo_mount_control 

Source
Expand description

ZWO Mount Control - Rust library for controlling ZWO AM5/AM3 telescope mounts

This library provides a comprehensive interface for controlling ZWO telescope mounts via serial communication, with built-in support for satellite tracking using the space-dust crate for TLE/SGP4 propagation.

§Features

  • GoTo/Slewing: Command the mount to slew to any celestial coordinates
  • Manual Motion: Control axis motion at various speeds (guide to max slew)
  • Tracking: Enable/disable tracking with sidereal, lunar, solar, or custom rates
  • Alt-Az & Equatorial Modes: Switch between altitude-azimuth and equatorial tracking
  • Autoguiding: Send guide pulses for autoguiding applications
  • Satellite Tracking: Track satellites using TLE data and SGP4 propagation
  • Mock Mount: Test your application without physical hardware

§Quick Start

§Connect to a Real Mount

use zwo_mount_control::{SerialMount, Mount, EquatorialPosition};

// Connect via serial port (typical on Linux/Mac)
let mut mount = SerialMount::new("/dev/ttyUSB0");
mount.connect()?;

// Get current position
let pos = mount.get_position()?;
println!("RA: {}h, Dec: {}°", pos.ra, pos.dec);

// Slew to Vega
let vega = EquatorialPosition::from_hms_dms(18, 36, 56, 38, 47, 1);
mount.goto_equatorial(vega)?;

§Use the Mock for Testing

use zwo_mount_control::{MockMount, Mount, EquatorialPosition};

let mut mount = MockMount::new();
mount.connect().unwrap();
mount.unpark().unwrap();

// Get current position
let pos = mount.get_position().unwrap();
println!("Position: {}", pos);

§Satellite Tracking

use zwo_mount_control::{SatelliteTracker, MockMount, Mount};

// ISS TLE data
let line1 = "1 25544U 98067A   24001.50000000  .00016717  00000-0  10270-3 0  9025";
let line2 = "2 25544  51.6400 208.9163 0006703  35.6028  75.3281 15.49560066429339";

let mut tracker = SatelliteTracker::from_tle(line1, line2)?;

// Set observer location (Los Angeles)
tracker.set_observer_location(34.0522, -118.2437, 71.0);

// Find next pass
let pass = tracker.find_next_pass(chrono::Utc::now(), 24.0)?;
if let Some(p) = pass {
    println!("Next pass: {}", p);
}

// Track with a mount
let mut mount = MockMount::new();
mount.connect()?;
tracker.track_pass(&mut mount)?;

§Module Overview

ModuleDescription
mountCore Mount trait and mount status types
serial_mountSerial port mount implementation
mock_mountSimulated mount for testing
protocolSerial command definitions
coordinatesCoordinate conversion utilities
satellite_trackerSatellite tracking with TLE propagation
errorError types

§Coordinate Systems

The mount supports two coordinate systems:

§Equatorial Coordinates (RA/Dec)

  • Right Ascension (RA): Decimal hours (0-24)
  • Declination (Dec): Decimal degrees (-90 to +90)

§Horizontal Coordinates (Az/Alt)

  • Azimuth (Az): Degrees from North (0-360°, clockwise)
  • Altitude (Alt): Degrees above horizon (0-90°)

Re-exports§

pub use coordinates::Coordinates;
pub use coordinates::EquatorialPosition;
pub use coordinates::HorizontalPosition;
pub use coordinates::TrackingRates;
pub use error::MountError;
pub use error::MountResult;
pub use mock_mount::MockMount;
pub use mount::Mount;
pub use mount::MountStatus;
pub use mount::SimulatedMount;
pub use mount::SiteLocation;
pub use protocol::Direction;
pub use protocol::MountMode;
pub use protocol::SlewRate;
pub use protocol::TrackingRate;
pub use satellite_tracker::CableWrapCheck;
pub use satellite_tracker::CableWrapState;
pub use satellite_tracker::PidController;
pub use satellite_tracker::SatellitePass;
pub use satellite_tracker::SatelliteTracker;
pub use satellite_tracker::TrackingConfig;
pub use satellite_tracker::TrackingMode;
pub use satellite_tracker::TrackingState;
pub use serial_mount::SerialConfig;
pub use serial_mount::SerialMount;

Modules§

coordinates
Coordinate conversion utilities for telescope mount control.
error
Error types for ZWO mount control operations.
mock_mount
Mock mount implementation for testing without physical hardware.
mount
Mount trait defining the interface for telescope mount control.
protocol
ZWO AM5/AM3 Serial Protocol Commands
satellite_tracker
Satellite tracking module using space-dust for TLE propagation.
serial_mount
Serial mount implementation for real ZWO AM5/AM3 hardware.

Constants§

VERSION
Library version

Functions§

dec
Convenience function to create a Dec value from degrees, minutes, seconds.
ra
Convenience function to create an RA value from hours, minutes, seconds.