A simple GOTO telescope that simulator slewing operation.
#include <cmath>
#include <memory>
static std::unique_ptr<SimpleScope> simpleScope(
new SimpleScope());
{
}
{
return true;
}
{
return true;
}
{
return "Simple Scope";
}
{
char RAStr[64] = {0}, DecStr[64] = {0};
fs_sexa(DecStr, targetDEC, 2, 3600);
LOGF_INFO(
"Slewing to RA: %s - DEC: %s", RAStr, DecStr);
return true;
}
{
return true;
}
{
static struct timeval ltv
{
0, 0
};
struct timeval tv
{
0, 0
};
double dt = 0, da_ra = 0, da_dec = 0, dx = 0, dy = 0;
int nlocked;
gettimeofday(&tv, nullptr);
if (ltv.tv_sec == 0 && ltv.tv_usec == 0)
ltv = tv;
dt = tv.tv_sec - ltv.tv_sec + (tv.tv_usec - ltv.tv_usec) / 1e6;
ltv = tv;
da_ra = SLEW_RATE * dt;
da_dec = SLEW_RATE * dt;
{
nlocked = 0;
dx = targetRA - currentRA;
if (fabs(dx) * 15. <= da_ra)
{
nlocked++;
}
else if (dx > 0)
else
dy = targetDEC - currentDEC;
if (fabs(dy) <= da_dec)
{
nlocked++;
}
else if (dy > 0)
else
if (nlocked == 2)
{
LOG_INFO(
"Telescope slew is complete. Tracking...");
}
break;
default:
break;
}
char RAStr[64] = {0}, DecStr[64] = {0};
fs_sexa(RAStr, currentRA, 2, 3600);
fs_sexa(DecStr, currentDEC, 2, 3600);
DEBUGF(DBG_SCOPE,
"Current RA: %s Current DEC: %s", RAStr, DecStr);
return true;
}
void setSimulation(bool enable)
Toggle driver simulation status A driver can run in simulation mode if Simulation option is enabled b...
void addDebugControl()
Add Debug control to the driver.
TelescopeStatus TrackState
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
bool Handshake() override
perform handshake with device to check communication
bool Goto(double, double) override
Move the scope to the supplied RA and DEC coordinates.
const char * getDefaultName() override
bool Abort() override
Abort any telescope motion including tracking if possible.
bool initProperties() override
Called to initialize basic properties required all the time.
bool ReadScopeStatus() override
Read telescope status.
int fs_sexa(char *out, double a, int w, int fracbase)
Converts a sexagesimal number to a string. sprint the variable a in sexagesimal format into out[].
Implementations for common driver routines.
#define LOGF_INFO(fmt,...)
#define DEBUGF(priority, msg,...)
Construct a basic INDI telescope device that simulates GOTO commands.
static Logger & getInstance()
Method to get a reference to the object (i.e., Singleton) It is a static method.
int addDebugLevel(const char *debugLevelName, const char *LoggingLevelName)
Adds a new debugging level to the driver.