Instrument Neutral Distributed Interface INDI  2.0.2
simple_telescope_simulator.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "indiguiderinterface.h"
5 #include "inditelescope.h"
7 
9 {
10  public:
12 
13  protected:
14  bool Abort() override;
15  bool canSync();
16  bool Connect() override;
17  bool Disconnect() override;
18  const char *getDefaultName() override;
19  bool Goto(double ra, double dec) override;
20  bool initProperties() override;
21  bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
22  char *formats[], char *names[], int n) override;
23  bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
24  bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
25  bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
26  bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override;
27  bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override;
28  bool ReadScopeStatus() override;
29  bool Sync(double ra, double dec) override;
30  void TimerHit() override;
31  bool updateLocation(double latitude, double longitude, double elevation) override;
32 
33  private:
34  static constexpr long MICROSTEPS_PER_REVOLUTION { 1000000 };
35  static constexpr double MICROSTEPS_PER_DEGREE { MICROSTEPS_PER_REVOLUTION / 360.0 };
36  static constexpr double DEFAULT_SLEW_RATE { MICROSTEPS_PER_DEGREE * 2.0 };
37  static constexpr long MAX_DEC { (long)(90.0 * MICROSTEPS_PER_DEGREE) };
38  static constexpr long MIN_DEC { (long)(-90.0 * MICROSTEPS_PER_DEGREE) };
39 
40  enum AxisStatus
41  {
42  STOPPED,
43  SLEWING,
44  SLEWING_TO
45  };
46  enum AxisDirection
47  {
48  FORWARD,
49  REVERSE
50  };
51 
52  AxisStatus AxisStatusDEC { STOPPED };
53  AxisDirection AxisDirectionDEC { FORWARD };
54  double AxisSlewRateDEC { DEFAULT_SLEW_RATE };
55  long CurrentEncoderMicrostepsDEC { 0 };
56  long GotoTargetMicrostepsDEC { 0 };
57 
58  AxisStatus AxisStatusRA { STOPPED };
59  AxisDirection AxisDirectionRA { FORWARD };
60  double AxisSlewRateRA { DEFAULT_SLEW_RATE };
61  long CurrentEncoderMicrostepsRA { 0 };
62  long GotoTargetMicrostepsRA { 0 };
63 
64  // Tracking
65  INDI::IEquatorialCoordinates CurrentTrackingTarget { 0, 0 };
66 
67  // Tracing in timer tick
68  int TraceThisTickCount { 0 };
69  bool TraceThisTick { false };
70 
71  unsigned int DBG_SIMULATOR { 0 };
72 };
This class encapsulates all the alignment subsystem classes that are useful to driver implementations...
The ScopeSim class provides a simple mount simulator of an equatorial mount.
bool ReadScopeStatus() override
Read telescope status.
bool Abort() override
Abort any telescope motion including tracking if possible.
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
bool Disconnect() override
Disconnect from device.
bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
void TimerHit() override
Called when setTimer() time is up.
bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
bool initProperties() override
Called to initialize basic properties required all the time.
const char * getDefaultName() override
bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override
Process the client newBLOB command.
double ra
double dec
ISState
Switch state.
Definition: indiapi.h:150
INDI_DIR_WE
Definition: indibasetypes.h:55
INDI_DIR_NS
Definition: indibasetypes.h:48