2021-12-07 16:30:17 +01:00
|
|
|
#include "StarTrackerJsonCommands.h"
|
2022-01-17 15:58:27 +01:00
|
|
|
|
2021-12-07 16:30:17 +01:00
|
|
|
#include "ArcsecJsonKeys.h"
|
|
|
|
|
|
|
|
Limits::Limits() : ArcsecJsonParamBase(arcseckeys::LIMITS) {}
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Limits::getSize() { return COMMAND_SIZE; }
|
2021-12-07 16:30:17 +01:00
|
|
|
|
|
|
|
ReturnValue_t Limits::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::LIMITS);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::ACTION, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::FPGA18CURRENT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::FPGA25CURRENT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::FPGA10CURRENT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::MCUCURRENT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::CMOS21CURRENT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::CMOSPIXCURRENT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::CMOS33CURRENT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::CMOSVRESCURRENT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::CMOS_TEMPERATURE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::MCU_TEMPERATURE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
return RETURN_OK;
|
2021-12-07 16:30:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Tracking::Tracking() : ArcsecJsonParamBase(arcseckeys::TRACKING) {}
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Tracking::getSize() { return COMMAND_SIZE; }
|
2021-12-07 16:30:17 +01:00
|
|
|
|
|
|
|
ReturnValue_t Tracking::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::TRACKING);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::THIN_LIMIT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::OUTLIER_THRESHOLD, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::OUTLIER_THRESHOLD_QUEST, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::TRACKER_CHOICE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
return RETURN_OK;
|
2021-12-07 16:30:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Mounting::Mounting() : ArcsecJsonParamBase(arcseckeys::MOUNTING) {}
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Mounting::getSize() { return COMMAND_SIZE; }
|
2021-12-07 16:30:17 +01:00
|
|
|
|
|
|
|
ReturnValue_t Mounting::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::MOUNTING);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::qw, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::qx, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::qy, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::qz, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
return RETURN_OK;
|
2021-12-07 16:30:17 +01:00
|
|
|
}
|
|
|
|
|
2022-01-29 12:27:26 +01:00
|
|
|
ImageProcessor::ImageProcessor() : ArcsecJsonParamBase(arcseckeys::IMAGE_PROCESSOR) {}
|
|
|
|
|
|
|
|
size_t ImageProcessor::getSize() { return COMMAND_SIZE; }
|
|
|
|
|
|
|
|
ReturnValue_t ImageProcessor::createCommand(uint8_t* buffer) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::IMAGE_PROCESSOR);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::IMAGE_PROCESSOR_MODE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::STORE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::SIGNAL_THRESHOLD, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint16(param, buffer + offset);
|
|
|
|
offset += sizeof(uint16_t);
|
|
|
|
result = getParam(arcseckeys::IMAGE_PROCESSOR_DARK_THRESHOLD, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint16(param, buffer + offset);
|
|
|
|
offset += sizeof(uint16_t);
|
|
|
|
result = getParam(arcseckeys::BACKGROUND_COMPENSATION, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
return RETURN_OK;
|
|
|
|
}
|
|
|
|
|
2021-12-07 16:30:17 +01:00
|
|
|
Camera::Camera() : ArcsecJsonParamBase(arcseckeys::CAMERA) {}
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Camera::getSize() { return COMMAND_SIZE; }
|
2021-12-07 16:30:17 +01:00
|
|
|
|
|
|
|
ReturnValue_t Camera::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::CAMERA);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::MODE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::FOCALLENGTH, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::EXPOSURE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::INTERVAL, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::OFFSET, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addint16(param, buffer + offset);
|
|
|
|
offset += sizeof(int16_t);
|
|
|
|
result = getParam(arcseckeys::PGAGAIN, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::ADCGAIN, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::REG_1, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::VAL_1, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::REG_2, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::VAL_2, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::REG_3, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::VAL_3, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::REG_4, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::VAL_4, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::REG_5, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::VAL_5, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::REG_6, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::VAL_6, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::REG_7, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::VAL_7, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::REG_8, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::VAL_8, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::FREQ_1, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
2022-01-28 12:43:26 +01:00
|
|
|
adduint32(param, buffer + offset);
|
2022-01-17 15:58:27 +01:00
|
|
|
return RETURN_OK;
|
2021-12-07 16:30:17 +01:00
|
|
|
}
|
|
|
|
|
2021-12-08 12:50:55 +01:00
|
|
|
Centroiding::Centroiding() : ArcsecJsonParamBase(arcseckeys::CENTROIDING) {}
|
2021-12-07 16:30:17 +01:00
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Centroiding::getSize() { return COMMAND_SIZE; }
|
2021-12-07 16:30:17 +01:00
|
|
|
|
|
|
|
ReturnValue_t Centroiding::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::CENTROIDING);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::ENABLE_FILTER, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::MAX_QUALITY, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
2022-01-28 12:43:26 +01:00
|
|
|
result = getParam(arcseckeys::DARK_THRESHOLD, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
2022-01-17 15:58:27 +01:00
|
|
|
result = getParam(arcseckeys::MIN_QUALITY, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::MAX_INTENSITY, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::MIN_INTENSITY, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::MAX_MAGNITUDE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::GAUSSIAN_CMAX, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::GAUSSIAN_CMIN, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::TRANSMATRIX_00, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::TRANSMATRIX_01, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::TRANSMATRIX_10, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::TRANSMATRIX_11, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
return RETURN_OK;
|
2021-12-08 12:50:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Lisa::Lisa() : ArcsecJsonParamBase(arcseckeys::LISA) {}
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Lisa::getSize() { return COMMAND_SIZE; }
|
2021-12-08 12:50:55 +01:00
|
|
|
|
|
|
|
ReturnValue_t Lisa::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::LISA);
|
|
|
|
offset = 2;
|
2022-01-28 12:43:26 +01:00
|
|
|
result = getParam(arcseckeys::LISA_MODE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint32(param, buffer + offset);
|
|
|
|
offset += sizeof(uint32_t);
|
2022-01-17 15:58:27 +01:00
|
|
|
result = getParam(arcseckeys::PREFILTER_DIST_THRESHOLD, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::PREFILTER_ANGLE_THRESHOLD, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::FOV_WIDTH, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::FOV_HEIGHT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::FLOAT_STAR_LIMIT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::CLOSE_STAR_LIMIT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::RATING_WEIGHT_CLOSE_STAR_COUNT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::RATING_WEIGHT_FRACTION_CLOSE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::RATING_WEIGHT_DB_STAR_COUNT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::MAX_COMBINATIONS, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::NR_STARS_STOP, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::FRACTION_CLOSE_STOP, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
return RETURN_OK;
|
2021-12-08 12:50:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Matching::Matching() : ArcsecJsonParamBase(arcseckeys::MATCHING) {}
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Matching::getSize() { return COMMAND_SIZE; }
|
2021-12-08 12:50:55 +01:00
|
|
|
|
|
|
|
ReturnValue_t Matching::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::MATCHING);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::SQUARED_DISTANCE_LIMIT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::SQUARED_SHIFT_LIMIT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
return RETURN_OK;
|
2021-12-08 12:50:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Validation::Validation() : ArcsecJsonParamBase(arcseckeys::VALIDATION) {}
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Validation::getSize() { return COMMAND_SIZE; }
|
2021-12-08 12:50:55 +01:00
|
|
|
|
|
|
|
ReturnValue_t Validation::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::VALIDATION);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::STABLE_COUNT, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::MAX_DIFFERENCE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::MIN_TRACKER_CONFIDENCE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::MIN_MATCHED_STARS, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
return RETURN_OK;
|
2021-12-08 12:50:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Algo::Algo() : ArcsecJsonParamBase(arcseckeys::ALGO) {}
|
|
|
|
|
2022-01-17 15:58:27 +01:00
|
|
|
size_t Algo::getSize() { return COMMAND_SIZE; }
|
2021-12-08 12:50:55 +01:00
|
|
|
|
|
|
|
ReturnValue_t Algo::createCommand(uint8_t* buffer) {
|
2022-01-17 15:58:27 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
uint8_t offset = 0;
|
|
|
|
std::string param;
|
|
|
|
addSetParamHeader(buffer, StarTracker::ID::ALGO);
|
|
|
|
offset = 2;
|
|
|
|
result = getParam(arcseckeys::MODE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::L2T_MIN_CONFIDENCE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::L2T_MIN_MATCHED, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
offset += sizeof(uint8_t);
|
|
|
|
result = getParam(arcseckeys::T2L_MIN_CONFIDENCE, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
addfloat(param, buffer + offset);
|
|
|
|
offset += sizeof(float);
|
|
|
|
result = getParam(arcseckeys::T2L_MIN_MATCHED, param);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
adduint8(param, buffer + offset);
|
|
|
|
return RETURN_OK;
|
2021-12-07 16:30:17 +01:00
|
|
|
}
|