3 unstable releases

0.2.0 Sep 30, 2023
0.1.1 Jun 6, 2023
0.1.0 Jun 6, 2023

#15 in #star

42 downloads per month

MIT/Apache

335KB
1.5K SLoC

phd2

This crate provides support for the EventMonitoring api for controlling and monitoring phd2. See; https://openphdguiding.org/ for more details on phd2.

For documentation see: https://docs.rs/phd2/

Contributing

Contributions are welcome.

In general, we follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!


lib.rs:

A general purpose library for interacting with phd2.

PHD2 is telescope guiding software that simplifies the process of tracking a guide star, letting you concentrate on other aspects of deep-sky imaging or spectroscopy. For more information on phd2 see the project's website here.

The purpose of this crate is to provide a convinent way to interact with phd2 using the using the EventMonitoring protocol. Details on the protocol can be found here.

Simple usage.

The simpliest way to use this crate is to convert a TcpStream to a Phd2Connection to send commands and receive events.

Example

use phd2::{serialization::Event, Phd2Connection};

#[tokio::main]
async fn main() {
    let mut phd2: Phd2Connection<_>= tokio::net::TcpStream::connect("localhost:4400")
        .await
        .expect("Connecting to phd2")
        .into();
    let mut pixel_scale = phd2.get_pixel_scale().await.expect("Getting pixel scale.");
    
    let mut sub = phd2.subscribe().await;

    while let Ok(event) = sub.recv().await {
        if let Event::GuideStep(guide) = &event.event {
            let delta = pixel_scale * (guide.dx.powi(2) + guide.dy.powi(2)).sqrt();
            println!("guide event: {} arcsec.", delta);
        }
        if let Event::ConfigurationChange(_) = &event.event {
            pixel_scale = phd2.get_pixel_scale().await.expect("Getting pixel scale.");
        }
    }
}

Dependencies

~4–11MB
~106K SLoC