Git Product home page Git Product logo

phd2client's Introduction

phd2client

Sample client code for PHD2 server API - C++, C#, and python versions. If you need a different language binding please let me know.

C++

dependencies:

#include "guider.h"

// instantiate a guider object that will connect to PHD2 running on "localhost"
Guider guider("localhost");

// connect to PHD2
bool ok = guider.Connect();
if (!ok)
    std::cerr << "could not connect to phd2: " << guider.LastError() << std::endl;

// connect gear in the equipment profile named Simulator
ok = guider.ConnectEquipment("Simulator");
if (!ok)
    std::cerr << "could not connect equipment: " << guider.LastError() << std::endl;

// start guiding with settle tolerance of 2.0 pixels, 10 second settle time, 100-second timeout
ok = guider.Guide(2.0, 10.0, 100.0);

See phd2client.cpp for a more complete example.

C# (.NET)

using guider;

...
    using (Guider guider = Guider.Factory("localhost"))
    {
        try
        {
            // connect to PHD2
            guider.Connect();

            // connect equipment in profile "Simulator"
            guider.ConnectEquipment("Simulator");

            // start guiding with settle tolerance of 2.0 pixels, 10 second settle time, 100-second timeout
            guider.Guide(2.0, 10.0, 100.0);
         }
         catch (GuiderException ex)
         {
             // Guider exception
             Console.WriteLine("Guider Error: {0}", ex.Message);
         }
    }

See SampleClient.cs for a more complete example.

python

from guider import Guider, GuiderException

...
    with Guider("localhost") as guider:
        try:
            # connect to PHD2
            guider.Connect()

            # connect equipment in profile "Simulator"
            guider.ConnectEquipment("Simulator")

            # start guiding with settle tolerance of 2.0 pixels, 10 second settle time, 100-second timeout
            guider.Guide(2.0, 10.0, 100.0)
        except GuiderException as ex:
            print(f"Guider Error: {ex}")

See phd2client.py for a more complete example.

phd2client's People

Contributors

agalasso avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.