Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/guide/internalguide/gmath.cpp
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | |||||
153 | void cgmath::getGuiderParameters(double *ccd_pix_wd, double *ccd_pix_ht, double *guider_aperture, double *guider_focal) | 153 | void cgmath::getGuiderParameters(double *ccd_pix_wd, double *ccd_pix_ht, double *guider_aperture, double *guider_focal) | ||
154 | { | 154 | { | ||
155 | *ccd_pix_wd = ccd_pixel_width * 1000.0; | 155 | *ccd_pix_wd = ccd_pixel_width * 1000.0; | ||
156 | *ccd_pix_ht = ccd_pixel_height * 1000.0; | 156 | *ccd_pix_ht = ccd_pixel_height * 1000.0; | ||
157 | *guider_aperture = aperture; | 157 | *guider_aperture = aperture; | ||
158 | *guider_focal = focal; | 158 | *guider_focal = focal; | ||
159 | } | 159 | } | ||
160 | 160 | | |||
161 | // This logging will be removed in favor of guidelog.h. | ||||
161 | void cgmath::createGuideLog() | 162 | void cgmath::createGuideLog() | ||
162 | { | 163 | { | ||
163 | logFile.close(); | 164 | logFile.close(); | ||
164 | logFile.open(QIODevice::WriteOnly | QIODevice::Text); | 165 | logFile.open(QIODevice::WriteOnly | QIODevice::Text); | ||
165 | QTextStream out(&logFile); | 166 | QTextStream out(&logFile); | ||
166 | 167 | | |||
167 | out << "Guiding rate,x15 arcsec/sec: " << Options::guidingRate() << endl; | 168 | out << "Guiding rate,x15 arcsec/sec: " << Options::guidingRate() << endl; | ||
168 | out << "Focal,mm: " << focal << endl; | 169 | out << "Focal,mm: " << focal << endl; | ||
▲ Show 20 Lines • Show All 1118 Lines • ▼ Show 20 Line(s) | 1176 | { | |||
1287 | { | 1288 | { | ||
1288 | QTextStream out(&logFile); | 1289 | QTextStream out(&logFile); | ||
1289 | out << ticks << "," << logTime.elapsed() << "," << out_params.delta[0] << "," << out_params.pulse_length[0] << "," | 1290 | out << ticks << "," << logTime.elapsed() << "," << out_params.delta[0] << "," << out_params.pulse_length[0] << "," | ||
1290 | << get_direction_string(out_params.pulse_dir[0]) << "," << out_params.delta[1] << "," | 1291 | << get_direction_string(out_params.pulse_dir[0]) << "," << out_params.delta[1] << "," | ||
1291 | << out_params.pulse_length[1] << "," << get_direction_string(out_params.pulse_dir[1]) << endl; | 1292 | << out_params.pulse_length[1] << "," << get_direction_string(out_params.pulse_dir[1]) << endl; | ||
1292 | } | 1293 | } | ||
1293 | } | 1294 | } | ||
1294 | 1295 | | |||
1295 | void cgmath::performProcessing(void) | 1296 | void cgmath::performProcessing(GuideLog *logger) | ||
1296 | { | 1297 | { | ||
1297 | Vector arc_star_pos, arc_reticle_pos; | 1298 | Vector arc_star_pos, arc_reticle_pos; | ||
1298 | 1299 | | |||
1299 | // do nothing if suspended | 1300 | // do nothing if suspended | ||
1300 | if (suspended) | 1301 | if (suspended) | ||
1301 | return; | 1302 | return; | ||
1302 | 1303 | | |||
1303 | // find guiding star location in | 1304 | // find guiding star location in | ||
1304 | scr_star_pos = star_pos = findLocalStarPosition(); | 1305 | scr_star_pos = star_pos = findLocalStarPosition(); | ||
1305 | 1306 | | |||
1306 | if (star_pos.x == -1 || std::isnan(star_pos.x)) | 1307 | if (star_pos.x == -1 || std::isnan(star_pos.x)) | ||
1307 | { | 1308 | { | ||
1308 | lost_star = true; | 1309 | lost_star = true; | ||
1310 | if (logger != nullptr && !preview_mode) | ||||
1311 | { | ||||
1312 | GuideLog::GuideData data; | ||||
1313 | data.code = GuideLog::GuideData::NO_STAR_FOUND; | ||||
1314 | data.type = GuideLog::GuideData::DROP; | ||||
1315 | logger->addGuideData(data); | ||||
1316 | } | ||||
1309 | return; | 1317 | return; | ||
1310 | } | 1318 | } | ||
1311 | else | 1319 | else | ||
1312 | lost_star = false; | 1320 | lost_star = false; | ||
1313 | 1321 | | |||
1314 | // move square overlay | 1322 | // move square overlay | ||
1315 | 1323 | | |||
1316 | //TODO FIXME | 1324 | //TODO FIXME | ||
Show All 38 Lines | |||||
1355 | process_axes(); | 1363 | process_axes(); | ||
1356 | 1364 | | |||
1357 | // process statistics | 1365 | // process statistics | ||
1358 | calc_square_err(); | 1366 | calc_square_err(); | ||
1359 | 1367 | | |||
1360 | // finally process tickers | 1368 | // finally process tickers | ||
1361 | do_ticks(); | 1369 | do_ticks(); | ||
1362 | 1370 | | |||
1371 | if (logger != nullptr) | ||||
1372 | { | ||||
1373 | GuideLog::GuideData data; | ||||
1374 | data.type = GuideLog::GuideData::MOUNT; | ||||
1375 | data.dx = scr_star_pos.x - reticle_pos.x; | ||||
1376 | data.dy = scr_star_pos.y - reticle_pos.y; | ||||
1377 | data.raDistance = star_pos.x; | ||||
1378 | data.decDistance = star_pos.y; | ||||
1379 | // The guide distances are related to the raw distances above, but | ||||
1380 | // e.g. small differences can be ignored. We just copy. | ||||
1381 | data.raGuideDistance = star_pos.x; | ||||
1382 | data.decGuideDistance = star_pos.y; | ||||
1383 | data.raDuration = out_params.pulse_length[GUIDE_RA]; | ||||
1384 | data.raDirection = out_params.pulse_dir[GUIDE_RA]; | ||||
1385 | data.decDuration = out_params.pulse_length[GUIDE_DEC]; | ||||
1386 | data.decDirection = out_params.pulse_dir[GUIDE_DEC]; | ||||
1387 | data.code = GuideLog::GuideData::NO_ERROR; | ||||
1388 | // Add SNR and MASS from SEP stars. | ||||
1389 | logger->addGuideData(data); | ||||
1390 | } | ||||
1363 | qCDebug(KSTARS_EKOS_GUIDE) << "################## FINISH PROCESSING ##################"; | 1391 | qCDebug(KSTARS_EKOS_GUIDE) << "################## FINISH PROCESSING ##################"; | ||
1364 | } | 1392 | } | ||
1365 | 1393 | | |||
1366 | void cgmath::calc_square_err(void) | 1394 | void cgmath::calc_square_err(void) | ||
1367 | { | 1395 | { | ||
1368 | if (!do_statistics) | 1396 | if (!do_statistics) | ||
1369 | return; | 1397 | return; | ||
1370 | // through MAX_ACCUM_CNT values | 1398 | // through MAX_ACCUM_CNT values | ||
▲ Show 20 Lines • Show All 438 Lines • Show Last 20 Lines |