Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
cs
 
 
cxx
 
 
 
 
 
 
 
 
 
 

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.

About

Sample client code for PHD2 server API

Resources

License

Releases

No releases published

Packages

No packages published