Instrument Neutral Distributed Interface INDI  2.0.2
paramount.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2017 Jasem Mutlaq. All rights reserved.
3 
4  Driver for using TheSky6 Pro Scripted operations for mounts via the TCP server.
5  While this technically can operate any mount connected to the TheSky6 Pro, it is
6  intended for Paramount mounts control.
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License version 2 as published by the Free Software Foundation.
11  .
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16  .
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 *******************************************************************************/
22 
23 #pragma once
24 
25 #include "indiguiderinterface.h"
26 #include "inditelescope.h"
27 #include "inditimer.h"
28 
30 {
31  public:
32  Paramount();
33  virtual ~Paramount() = default;
34 
35  virtual const char *getDefaultName() override;
36  virtual bool Handshake() override;
37  virtual bool ReadScopeStatus() override;
38  virtual bool initProperties() override;
39  virtual bool updateProperties() override;
40 
41  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
42  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
43 
44  protected:
45  virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override;
46  virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override;
47  virtual bool Abort() override;
48 
49  virtual bool updateTime(ln_date *utc, double utc_offset) override;
50 
51  virtual bool SetParkPosition(double Axis1Value, double Axis2Value) override;
52  virtual bool Goto(double, double) override;
53  virtual bool Park() override;
54  virtual bool UnPark() override;
55  virtual bool Sync(double ra, double dec) override;
56 
57  // Tracking
58  virtual bool SetTrackMode(uint8_t mode) override;
59  virtual bool SetTrackRate(double raRate, double deRate) override;
60  virtual bool SetTrackEnabled(bool enabled) override;
61 
62  // Parking
63  virtual bool SetCurrentPark() override;
64  virtual bool SetDefaultPark() override;
65 
66  // Guiding
67  virtual IPState GuideNorth(uint32_t ms) override;
68  virtual IPState GuideSouth(uint32_t ms) override;
69  virtual IPState GuideEast(uint32_t ms) override;
70  virtual IPState GuideWest(uint32_t ms) override;
71  // these all call these two functions
72  IPState GuideNS(int32_t ms);
73  IPState GuideWE(int32_t ms);
74 
75  private:
76  void mountSim();
77  bool getMountRADE();
78  bool isSlewComplete();
79 
80  bool sendTheSkyOKCommand(const char *command, const char *errorMessage, uint8_t timeout = 3);
81  bool isTheSkyParked();
82  bool isTheSkyTracking();
83  bool startOpenLoopMotion(uint8_t motion, uint16_t rate);
84  bool stopOpenLoopMotion();
85  bool setTheSkyTracking(bool enable, bool isSidereal, double raRate, double deRate);
87 
88  // Homing
89  bool findHome();
90 
91  double currentRA { 0 };
92  double currentDEC { 90 };
93  double targetRA { 0 };
94  double targetDEC { 0 };
95 
96  unsigned int DBG_SCOPE { 0 };
97 
98  // Jog Rate
99  INumber JogRateN[2];
100  INumberVectorProperty JogRateNP;
101 
102  // Guide Rate
103  INumber GuideRateN[2];
104  INumberVectorProperty GuideRateNP;
105 
106  // Tracking Mode
107  ISwitch TrackModeS[4];
108  ISwitchVectorProperty TrackModeSP;
109 
110  // Homing
111  ISwitchVectorProperty HomeSP;
112  ISwitch HomeS[1];
113 
114  // Timers
115  INDI::Timer m_NSTimer;
116  INDI::Timer m_WETimer;
117  // Tracking Rate
118  // INumber TrackRateN[2];
119  // INumberVectorProperty TrackRateNP;
120 };
The Timer class provides repetitive and single-shot timers.
Definition: inditimer.h:41
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
Definition: paramount.cpp:1099
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: paramount.cpp:598
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
Definition: paramount.cpp:164
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
Definition: paramount.cpp:1014
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
Definition: paramount.cpp:999
virtual bool initProperties() override
Called to initialize basic properties required all the time.
Definition: paramount.cpp:107
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
Definition: paramount.cpp:1082
virtual bool SetTrackRate(double raRate, double deRate) override
SetTrackRate Set custom tracking rates.
Definition: paramount.cpp:1077
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
Definition: paramount.cpp:1009
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
Definition: paramount.cpp:797
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
Definition: paramount.cpp:719
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
Definition: paramount.cpp:542
IPState GuideNS(int32_t ms)
Definition: paramount.cpp:1019
IPState GuideWE(int32_t ms)
Definition: paramount.cpp:1043
virtual bool ReadScopeStatus() override
Read telescope status.
Definition: paramount.cpp:356
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
Definition: paramount.cpp:773
virtual bool Goto(double, double) override
Move the scope to the supplied RA and DEC coordinates.
Definition: paramount.cpp:405
virtual bool UnPark() override
Unpark the telescope if already parked.
Definition: paramount.cpp:582
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
Definition: paramount.cpp:660
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
Definition: paramount.cpp:780
virtual bool Park() override
Park the telescope to its home position.
Definition: paramount.cpp:562
virtual bool Handshake() override
perform handshake with device to check communication
Definition: paramount.cpp:239
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
Definition: paramount.cpp:680
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
Definition: paramount.cpp:1004
virtual bool SetParkPosition(double Axis1Value, double Axis2Value) override
SetParkPosition Set desired parking position to the supplied value. This ONLY sets the desired park p...
Definition: paramount.cpp:808
virtual const char * getDefaultName() override
Definition: paramount.cpp:102
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: paramount.cpp:631
virtual ~Paramount()=default
double ra
double dec
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
INDI_DIR_WE
Definition: indibasetypes.h:55
INDI_DIR_NS
Definition: indibasetypes.h:48
One number descriptor.
One switch descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367