18 #include <gtest/gtest.h>
32 double round(
double value,
int decimal_places)
34 const double multiplier = std::pow(10.0, decimal_places);
35 return std::round(value * multiplier) / multiplier;
38 TEST(ALIGNMENT_TEST, Test_TDVRoundTripEquatorial)
45 double ra = 18.6156,
dec = 38.78361;
55 ASSERT_DOUBLE_EQ(RaDec.rightascension, RaDecResult.
rightascension);
56 ASSERT_DOUBLE_EQ(RaDec.declination, RaDecResult.
declination);
59 TEST(ALIGNMENT_TEST, Test_TDVRoundTripAltAz)
65 double alt = 35.7, az = 80.0;
80 TEST(ALIGNMENT_TEST, Test_ThreeSyncPointsEquatorial)
86 double VegaJ2000RA = 18.6156972;
87 double VegaJ2000Dec = 38.7856944;
89 double ArcturusJ2000RA = 14.2612083;
90 double ArcturusJ2000Dec = 19.1872694;
92 double MizarJ2000RA = 13.3988500;
93 double MizarJ2000Dec = 54.9254167;
96 s.
Sync(VegaJ2000RA, VegaJ2000Dec);
97 s.
Sync(ArcturusJ2000RA, ArcturusJ2000Dec);
98 s.
Sync(MizarJ2000RA, MizarJ2000Dec);
100 double VegaSkyRA, VegaSkyDec;
104 ASSERT_DOUBLE_EQ(
round(VegaJ2000RA, 1),
round(VegaSkyRA, 1));
105 ASSERT_DOUBLE_EQ(
round(VegaJ2000Dec, 3),
round(VegaSkyDec, 3));
107 double VegaMountRA, VegaMountDec;
109 ASSERT_DOUBLE_EQ(
round(VegaJ2000RA, 1),
round(VegaMountRA, 1));
110 ASSERT_DOUBLE_EQ(
round(VegaJ2000Dec, 3),
round(VegaMountDec, 3));
113 TEST(ALIGNMENT_TEST, Test_ThreeSyncPointsAltAz)
119 double VegaJ2000RA = 18.6156972;
120 double VegaJ2000Dec = 38.7856944;
122 double ArcturusJ2000RA = 14.2612083;
123 double ArcturusJ2000Dec = 19.1872694;
125 double MizarJ2000RA = 13.3988500;
126 double MizarJ2000Dec = 54.9254167;
129 ASSERT_TRUE(s.
Sync(VegaJ2000RA, VegaJ2000Dec));
130 ASSERT_TRUE(s.
Sync(ArcturusJ2000RA, ArcturusJ2000Dec));
131 ASSERT_TRUE(s.
Sync(MizarJ2000RA, MizarJ2000Dec));
133 double testPointAlt = 35.123456, testPointAz = 80.123456;
134 double skyRA, skyDec;
147 double roundTripAlt, roundTripAz;
150 ASSERT_DOUBLE_EQ(
round(testPointAlt, 1),
round(roundTripAlt, 1));
151 ASSERT_DOUBLE_EQ(
round(testPointAz, 1),
round(roundTripAz, 1));
154 int main(
int argc,
char **argv)
159 ::testing::InitGoogleTest(&argc, argv);
161 return RUN_ALL_TESTS();
bool SkyToTelescopeEquatorial(double actualRA, double actualDec, double &mountRA, double &mountDec)
Converts an actual sky location to coordinates to send to the mount, usually called in Goto.
bool TelescopeEquatorialToSky(double mountRA, double mountDec, double &actualRA, double &actualDec)
Converts a mount location to actual sky coordinates, usually called in ReadScopeStatus.
bool TelescopeAltAzToSky(double mountAlt, double mountAz, double &actualRA, double &actualDec)
Converts a mount location to actual sky coordinates, usually called in ReadScopeStatus.
bool SkyToTelescopeAltAz(double actualRA, double actualDec, double &mountAlt, double &mountAz)
Converts an actual sky location to coordinates to send to the mount, usually called in Goto.
bool GetDatabaseReferencePosition(IGeographicCoordinates &Position)
Get the database reference position.
const TelescopeDirectionVector TelescopeDirectionVectorFromAltitudeAzimuth(INDI::IHorizontalCoordinates HorizontalCoordinates)
Calculates a normalised direction vector from the supplied altitude and azimuth.
void EquatorialCoordinatesFromTelescopeDirectionVector(const TelescopeDirectionVector TelescopeDirectionVector, INDI::IEquatorialCoordinates &EquatorialCoordinates)
Calculates equatorial coordinates from the supplied telescope direction vector and declination.
const TelescopeDirectionVector TelescopeDirectionVectorFromEquatorialCoordinates(INDI::IEquatorialCoordinates EquatorialCoordinates)
Calculates a telescope direction vector from the supplied equatorial coordinates.
void AltitudeAzimuthFromTelescopeDirectionVector(const TelescopeDirectionVector TelescopeDirectionVector, INDI::IHorizontalCoordinates &HorizontalCoordinates)
Calculates an altitude and azimuth from the supplied normalised direction vector and declination.
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
double range24(double r)
range24 Limits a number to be between 0-24 range.
double range360(double r)
range360 Limits an angle to be between 0-360 degrees.
double rangeDec(double decdegrees)
rangeDec Limits declination value to be in -90 to 90 range.
void EquatorialToHorizontal(IEquatorialCoordinates *object, IGeographicCoordinates *observer, double JD, IHorizontalCoordinates *position)
EquatorialToHorizontal Calculate horizontal coordinates from equatorial coordinates.
Holds a nomalised direction vector (direction cosines)
static const loggerConf file_off
void configure(const std::string &outputFile, const loggerConf configuration, const int fileVerbosityLevel, const int screenVerbosityLevel)
Method to configure the logger. Called by the DEBUG_CONF() macro. To make implementation easier,...
static Logger & getInstance()
Method to get a reference to the object (i.e., Singleton) It is a static method.
TEST(ALIGNMENT_TEST, Test_TDVRoundTripEquatorial)
int main(int argc, char **argv)
double round(double value, int decimal_places)