Green Swamp Software

GS Server manual

22 SkyWatcher API

This list contains the definition for the available API commands.

public interface ISky
{
    /// <summary>
    /// Tells GSS not to process any AsCoM moment commands for external programs using the AsCoM driver.
    /// </summary>
    /// <returns>bool</returns>
    bool AscomOn { get; set; }
    /// <summary>
    /// Starts the AutoHome slew to home sensors
    /// </summary>
    /// <param name="degreelimit"></param>
    /// <param name="offsetdec"></param>
    void AutoHomeStart(int degreelimit = 100, int offsetdec = 0);
    /// <summary>
    /// Stops Auto home from completing
    /// </summary>
    void AutoHomeStop();
    /// <summary>
    /// Move axis number of micro steps, not marked as slewing
    /// </summary>
    /// <param name="axis">>axis number 1 or 2</param>
    /// <param name="steps">number of micro steps</param>
    /// <returns>nothing</returns>
    void AxisMoveSteps(int axis, long steps);
    /// <summary>
    /// Send a pulse command
    /// </summary>
    /// <param name="axis">Axis 1 or 2</param>
    /// <param name="guideRate">GuideRate degrees, 15.041/3600*.5, negative value denotes direction</param>
    /// <param name="duration">length of pulse in milliseconds, always positive numbers</param>
    /// <param name="backlashSteps">Positive micro steps added for backlash</param>
    /// <returns>nothing</returns>
    void AxisPulse(int axis, double guideRate, int duration, int backlashSteps = 0);
    /// <summary>
    /// Goto position in degrees
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="targetPosition">position in degrees</param>
    /// <returns>nothing</returns>
    void AxisGoToTarget(int axis, double targetPosition);
    /// <summary>
    /// Slew axis based on a rate in degrees.  Use this for small movements
    /// like pulse guiding, rate changes, guiding changes, not go tos
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="rate">rate/sec in degrees</param>
    /// <returns>nothing</returns>
    void AxisSlew(int axis, double rate);
    /// <summary>
    /// K Slows to a stop movement of an Axis
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    void AxisStop(int axis);
    /// <summary>
    /// L Abruptly stops movement of an Axis
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns>nothing</returns>
    void AxisStopInstant(int axis);
    /// <summary>
    /// q Axes slews must start independently
    /// </summary>
    bool CanAxisSlewsIndependent { get; }
    /// <summary>
    /// q Does mount support AZ/EQ mode
    /// </summary>
    bool CanAzEq { get; }
    /// <summary>
    /// q Does mount support dual encoders
    /// </summary>
    bool CanDualEncoders { get; }
    /// <summary>
    /// q Does mount support half current tracking
    /// </summary>
    bool CanHalfTrack { get; }
    /// <summary>
    /// q Does mount support home sensors
    /// </summary>
    bool CanHomeSensors { get; }
    /// <summary>
    /// q Does mount support a polar LED
    /// </summary>
    bool CanPolarLed { get; }
    /// <summary>
    /// q Does mount support PPec
    /// </summary>
    bool CanPPec { get; }
    /// <summary>
    /// q Does mount support WiFi
    /// </summary>
    bool CanWifi { get; }
    /// <summary>
    /// Bypass for mount commands
    /// </summary>
    /// <param name="axis">1 or 2</param>
    /// <param name="cmd">The command char set</param>
    /// <param name="cmdData">The data need to send</param>
    /// <param name="ignoreWarnings">ignore serial response issues?</param>
    /// <returns>mount data, null for IsNullOrEmpty</returns>
    /// <example>CmdToMount(1,"X","0003","true")</example>
    string CmdToMount(int axis, string cmd, string cmdData, string ignoreWarnings);
    /// <summary>
    /// Sets the amount of steps added to Dec for reverse backlash pulse
    /// </summary>
    int DecBacklash { get; set; }
    /// <summary>
    /// Gets the number of steps from the angle in rad
    /// </summary>
    /// <param name="axis"></param>
    /// <param name="angleInRad"></param>
    /// <returns>Steps in rad</returns>
    long GetAngleToStep(int axis, double angleInRad);
    /// <summary>
    /// e Gets versions of axis in long format
    /// </summary>
    /// <param name="axis"></param>
    /// <returns>long axis version</returns>
    long GetAxisVersion(int axis);
    /// <summary>
    /// e Gets version of axis in string readable format
    /// </summary>
    /// <param name="axis"></param>
    /// <returns>string axis version as string</returns>
    string GetAxisStringVersion(int axis);
    /// <summary>
    /// j Gets current axis position in degrees
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns>Get Current Axis position as double</returns>
    double GetAxisPosition(int axis);
    /// <summary>
    /// j Gets axis position counter
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="raw">false to subtract 0x00800000</param>
    /// <returns>Cardinal encoder count as long</returns>
    long GetAxisPositionCounter(int axis, bool raw = false);
    /// <summary>
    /// d Gets Axis Current Encoder count
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns>count as double</returns>
    double GetEncoderCount(int axis);
    /// <summary>
    /// Get :j data only not dependent on the advanced set
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="raw">false to subtract 0x00800000</param>
    /// <returns>Cardinal encoder count as long</returns>
    double Get_j(int axis, bool raw);
    /// <summary>
    /// Multiply the value of radians/second by this factor to get a 32-bit integer for the set speed used by the motor board.
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns>factor used to get the speed</returns>
    double GetFactorRadRateToInt(int axis);
    /// <summary>
    /// Inquire motor high speed ratio
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns>Ratio used to determine high speed</returns>
    long GetHighSpeedRatio(int axis);
    /// <summary>
    /// q Get Home position
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    long GetHomePosition(int axis);
    /// <summary>
    /// h Get Current "goto" target
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    double GetLastGoToTarget(int axis);
    /// <summary>
    /// i Get Current "slew" speed
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    long GetLastSlewSpeed(int axis);
    /// <summary>
    /// Margin used to move from high speed to low speed
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns></returns>
    long GetLowSpeedGotoMargin(int axis);
    /// <summary>
    /// e Gets the complete version string
    /// </summary>
    /// <returns></returns>
    string GetMotorCardVersion(int axis);
    /// <summary>
    /// s Inquire PEC Period ":s(*1)", where *1: '1'= CH1, '2'= CH2, '3'= Both.
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    double GetPecPeriod(int axis);
    /// <summary>
    /// Capture axes position and timestamp. 8 hex for ra, 8 hex for dec, 16 hex in microseconds
    /// </summary>
    /// <param name="raw"></param>
    /// <returns></returns>
    string GetPositionsAndTime(bool raw);
    /// <summary>
    /// c Micro steps from target where the ramp down process begins
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    double GetRampDownRange(int axis);
    /// <summary>
    /// D Sidereal rate in axis speed
    /// </summary>
    /// <returns></returns>
    /// <param name="axis">axis number 1 or 2</param>
    long GetSiderealRate(int axis);
    /// <summary>
    /// Gets the angle in rad from amount of steps
    /// </summary>
    /// <param name="axis"></param>
    /// <param name="steps"></param>
    /// <returns></returns>
    double GetStepToAngle(int axis, long steps);
    /// <summary>
    /// a Steps per revolution
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns>Step Count</returns>
    long GetStepsPerRevolution(int axis);
    /// <summary>
    /// b Frequency of stepping timer
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns>Frequency of stepping timer</returns>
    long GetStepTimeFreq(int axis);
    /// <summary>
    /// The current Declination guide rate
    /// </summary>
    double GuideRateDeclination { get; set; }
    /// <summary>
    /// The current Right Ascension guide rate
    /// </summary>
    double GuideRateRightAscension { get; set; }
    /// <summary>
    /// F Initialize both Axes
    /// </summary>
    void InitializeAxes();
    /// <summary>
    /// Is the auto home process running
    /// </summary>
    bool IsAutoHomeRunning { get; }
    /// <summary>
    /// Is mount in a connected serial state
    /// </summary>
    bool IsConnected { get; }
    /// <summary>
    /// Starts or Stops mount and connection
    /// </summary>
    bool IsMountRunning { get; set; }
    /// <summary>
    /// Is mount parked
    /// </summary>
    bool IsParked { get; }
    /// <summary>
    /// q Is the mount collecting PPec data
    /// </summary>
    bool IsPPecInTrainingOn { get; }
    /// <summary>
    /// q Does the mount have PPec turned on
    /// </summary>
    bool IsPPecOn { get; }
    /// <summary>
    /// j Is axis at full stop
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns></returns>
    bool IsFullStop(int axis);
    /// <summary>
    /// j Is axis in high speed mode
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns></returns>
    bool IsHighSpeed(int axis);
    /// <summary>
    /// Is mount type set to SkyWatcher
    /// </summary>
    bool IsServerSkyWatcher { get; }
    /// <summary>
    /// f Is axis slewing normal mode
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns></returns>
    bool IsSlewing(int axis);
    /// <summary>
    /// f Is axis slewing in a positive direction
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns></returns>
    bool IsSlewingForward(int axis);
    /// <summary>
    /// f Is axis slewing in goto mode
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <returns></returns>
    bool IsSlewingTo(int axis);
    /// <summary>
    /// Last known error from the AutoHome Process
    /// </summary>
    string LastAutoHomeError { get; }
    /// <summary>
    /// e Identify type of mount
    /// </summary>
    string MountType { get; }
    /// <summary>
    /// e Identify board version
    /// </summary>
    bool MountVersion { get; }
    /// <summary>
    /// Park mount to the current selected park position
    /// </summary>
    void Park();
    /// <summary>
    /// Get parked selected or Set to an existing park position name
    /// </summary>
    string ParkPosition { get; set; }
    /// <summary>
    /// Turns PPec off during movements and then back on for error correction moves
    /// </summary>
    /// <param name="on"></param>
    void SkySetAlternatingPPec(bool on);
    /// <summary>
    /// E Reset the position of an axis
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="position">degrees</param>
    void SetAxisPosition(int axis, double position);
    /// <summary>
    /// E Reset the position of an axis
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="position">degrees</param>
    void SetAxisPositionCounter(int axis, int position);
    /// <summary>
    /// M Set the break point increment
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="stepsCount">The steps count.</param>
    void SetBreakPointIncrement(int axis, long stepsCount);
    /// <summary>
    /// Turns on or off converting a Dec pulse guide into a Dec GoTo
    /// </summary>
    /// <param name="on"></param>
    void SetDecPulseToGoTo(bool on);
    /// <summary>
    /// W 4-5 Turn on off encoders
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="on"></param>
    void SetEncoder(int axis, bool on);
    /// <summary>
    /// W 6 Enable or Disable Full Current Low speed
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="on"></param>
    void SetFullCurrentLowSpeed(int axis, bool on);
    /// <summary>
    ///  H Set the goto target increment in steps
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="stepsCount"></param>
    void SetGotoTargetIncrement(int axis, long stepsCount);
    /// <summary>
    /// W 8 Reset the home position index
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    void SetHomePositionIndex(int axis);
    /// <summary>
    /// J Start motion based on previous settings
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    void StartMotion(int axis);
    /// <summary>
    /// G Set a different motion mode
    /// </summary>
    /// <param name="axis">Axis number 1 or 2</param>
    /// <param name="func">'0' high speed GOTO slewing,'1' low speed slewing mode,'2' low speed GOTO mode,'3' High slewing mode</param>
    /// <param name="direction">0=forward (CW) right, 1=backward (CCW) left, also based on observatory settings</param>
    void SetMotionMode(int axis, int func, int direction);
    /// <summary>
    /// W 2-3 Turn on off PPec
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="on"></param>
    void SetPPec(int axis, bool on);
    /// <summary>
    /// W 0-1 Turn on off PPEC training
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="on"></param>
    void SetPPecTrain(int axis, bool on);
    /// <summary>
    /// I Set slewing rate, seems to relate to amount of skipped step counts.
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="stepSpeed">StepSpeed = 1 motor step movement, higher counts means slower movements</param>
    void SetStepSpeed(int axis, long stepSpeed);
    /// <summary>
    /// Set simulator goto rate
    /// </summary>
    /// <param name="rate">1-20</param>
    void SetSimGotoSpeed(int rate);
    /// <summary>
    /// S Set absolute goto target
    /// </summary>
    /// <param name="axis">axis number 1 or 2</param>
    /// <param name="position"></param>
    void SetTargetPosition(int axis, double position);
    /// <summary>
    /// shutdown and close the server
    /// </summary>
    void ShutdownServer();
    /// <summary>
    /// UnPark mount
    /// </summary>
    void UnPark();
}