all parameter requests implemented

This commit is contained in:
Jakob Meier 2022-02-10 18:39:37 +01:00
parent ac49f3f72b
commit c9e5fbc361
6 changed files with 664 additions and 95 deletions

View File

@ -24,6 +24,10 @@ ServiceInterfaceStream sif::error("ERROR");
ObjectManagerIF* objectManager = nullptr;
void initmission::initMission() {
sif::info << "Make sure the systemd service ser2net on the egse has been stopped "
<< "(alias stop-ser2net)" << std::endl;
sif::info << "Make sure the power lines of the star tracker have been enabled "
<< "(alias enable-startracker)" << std::endl;
sif::info << "Building global objects.." << std::endl;
/* Instantiate global object manager and also create all objects */
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);

View File

@ -355,7 +355,7 @@ static const DeviceCommandId_t REQ_POWER = 11;
static const DeviceCommandId_t TAKE_IMAGE = 15;
static const DeviceCommandId_t DOWNLOAD_CENTROID = 16;
static const DeviceCommandId_t UPLOAD_CENTROID = 17;
static const DeviceCommandId_t SUBSCRIBE_TO_TM = 18;
static const DeviceCommandId_t SUBSCRIPTION = 18;
static const DeviceCommandId_t IMAGE_PROCESSOR = 19;
static const DeviceCommandId_t REQ_SOLUTION = 24;
static const DeviceCommandId_t REQ_TEMPERATURE = 25;
@ -400,6 +400,9 @@ static const DeviceCommandId_t REQ_ALGO = 77;
static const DeviceCommandId_t REQ_SUBSCRIPTION = 78;
static const DeviceCommandId_t REQ_LOG_SUBSCRIPTION = 79;
static const DeviceCommandId_t REQ_DEBUG_CAMERA = 80;
static const DeviceCommandId_t LOGLEVEL = 81;
static const DeviceCommandId_t LOGSUBSCRIPTION = 82;
static const DeviceCommandId_t DEBUG_CAMERA = 83;
static const DeviceCommandId_t NONE = 0xFFFFFFFF;
static const uint32_t VERSION_SET_ID = REQ_VERSION;
@ -428,6 +431,7 @@ static const uint32_t VALIDATION_SET_ID = REQ_VALIDATION;
static const uint32_t ALGO_SET_ID = REQ_ALGO;
static const uint32_t SUBSCRIPTION_SET_ID = REQ_SUBSCRIPTION;
static const uint32_t LOG_SUBSCRIPTION_SET_ID = REQ_LOG_SUBSCRIPTION;
static const uint32_t DEBUG_CAMERA_SET_ID = REQ_DEBUG_CAMERA;
/** Max size of unencoded frame */
static const size_t MAX_FRAME_SIZE = 1200;
@ -1369,14 +1373,14 @@ class LimitsSet : public StaticLocalDataSet<LIMITS_SET_ENTRIES> {
/**
* @brief Will store the requested log level parameters
*/
class LogLevelSet : public StaticLocalDataSet<LIMITS_SET_ENTRIES> {
class LogLevelSet : public StaticLocalDataSet<LOG_LEVEL_SET_ENTRIES> {
public:
// Size of dataset
static const size_t SIZE = 16;
LogLevelSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LOG_LEVEL_SET_ENTRIES) {}
LogLevelSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LOG_LEVEL_SET_ID) {}
LogLevelSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LOG_LEVEL_SET_ENTRIES)) {}
LogLevelSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LOG_LEVEL_SET_ID)) {}
lp_var_t<uint8_t> loglevel1 = lp_var_t<uint8_t>(sid.objectId, PoolIds::LOGLEVEL1, this);
lp_var_t<uint8_t> loglevel2 = lp_var_t<uint8_t>(sid.objectId, PoolIds::LOGLEVEL2, this);
@ -1481,14 +1485,16 @@ class ImageProcessorSet : public StaticLocalDataSet<IMAGE_PROCESSOR_SET_ENTRIES>
lp_var_t<uint8_t>(sid.objectId, PoolIds::IMAGE_PROCESSOR_BACKGROUNDCOMPENSATION, this);
void printSet() {
sif::info << "ImageProcessorSet::printSet: mode: " << this->mode << std::endl;
sif::info << "ImageProcessorSet::printSet: store: " << this->store << std::endl;
sif::info << "ImageProcessorSet::printSet: mode: "
<< static_cast<unsigned int>(this->mode.value) << std::endl;
sif::info << "ImageProcessorSet::printSet: store: "
<< static_cast<unsigned int>(this->store.value) << std::endl;
sif::info << "ImageProcessorSet::printSet: signal threshold: " << this->signalThreshold
<< std::endl;
sif::info << "ImageProcessorSet::printSet: dark threshold: " << this->darkThreshold
<< std::endl;
sif::info << "ImageProcessorSet::printSet: background compensation: "
<< this->backgroundCompensation << std::endl;
<< static_cast<unsigned int>(this->backgroundCompensation.value) << std::endl;
}
};
@ -1532,7 +1538,8 @@ class CentroidingSet : public StaticLocalDataSet<CENTROIDING_PARAMS_SET_ENTRIES>
lp_var_t<float>(sid.objectId, PoolIds::CENTROIDING_TRANSMATRIX11, this);
void printSet() {
sif::info << "CentroidingSet::printSet: enable filter: " << this->enableFilter << std::endl;
sif::info << "CentroidingSet::printSet: enable filter: "
<< static_cast<unsigned int>(this->enableFilter.value) << std::endl;
sif::info << "CentroidingSet::printSet: max quality: " << this->maxQuality << std::endl;
sif::info << "CentroidingSet::printSet: dark threshold: " << this->darkThreshold << std::endl;
sif::info << "CentroidingSet::printSet: min quality: " << this->minQuality << std::endl;
@ -1604,8 +1611,10 @@ class LisaSet : public StaticLocalDataSet<LISA_SET_ENTRIES> {
<< std::endl;
sif::info << "LisaSet::printSet: rating weight db star count: " << this->ratingWeightDbStarCount
<< std::endl;
sif::info << "LisaSet::printSet: max combinations: " << this->maxCombinations << std::endl;
sif::info << "LisaSet::printSet: nr stars stop: " << this->nrStarsStop << std::endl;
sif::info << "LisaSet::printSet: max combinations: "
<< static_cast<unsigned int>(this->maxCombinations.value) << std::endl;
sif::info << "LisaSet::printSet: nr stars stop: "
<< static_cast<unsigned int>(this->nrStarsStop.value) << std::endl;
sif::info << "LisaSet::printSet: fraction close stop: " << this->fractionCloseStop << std::endl;
}
};
@ -1639,7 +1648,7 @@ class MatchingSet : public StaticLocalDataSet<MATCHING_SET_ENTRIES> {
class TrackingSet : public StaticLocalDataSet<TRACKING_SET_ENTRIES> {
public:
// Size of dataset
static const size_t SIZE = 16;
static const size_t SIZE = 13;
TrackingSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TRACKING_SET_ID) {}
@ -1648,13 +1657,16 @@ class TrackingSet : public StaticLocalDataSet<TRACKING_SET_ENTRIES> {
lp_var_t<float> thinLimit = lp_var_t<float>(sid.objectId, PoolIds::TRACKING_THIN_LIMIT, this);
lp_var_t<float> outlierThreshold = lp_var_t<float>(sid.objectId, PoolIds::TRACKING_OUTLIER_THRESHOLD, this);
lp_var_t<float> outlierThresholdQuest = lp_var_t<float>(sid.objectId, PoolIds::TRACKING_OUTLIER_THRESHOLD_QUEST, this);
lp_var_t<float> trackerChoice = lp_var_t<float>(sid.objectId, PoolIds::TRACKING_TRACKER_CHOICE, this);
lp_var_t<uint8_t> trackerChoice = lp_var_t<uint8_t>(sid.objectId, PoolIds::TRACKING_TRACKER_CHOICE, this);
void printSet() {
sif::info << "MatchingSet::printSet: squared distance limit: " << this->squaredDistanceLimit
sif::info << "TrackingSet::printSet: thin limit: " << this->thinLimit << std::endl;
sif::info << "TrackingSet::printSet: outlier threshold: " << this->outlierThreshold
<< std::endl;
sif::info << "MatchingSet::printSet: squared distance limit: " << this->squaredShiftLimit
sif::info << "TrackingSet::printSet: outlier threshold quest: " << this->outlierThresholdQuest
<< std::endl;
sif::info << "TrackingSet::printSet: tracker choice: "
<< static_cast<unsigned int>(this->trackerChoice.value) << std::endl;
}
};
@ -1681,12 +1693,12 @@ class ValidationSet : public StaticLocalDataSet<VALIDATION_SET_ENTRIES> {
void printSet() {
sif::info << "ValidationSet::printSet: stable count: "
<< static_cast<unsigned int>(this->stableCount) << std::endl;
<< static_cast<unsigned int>(this->stableCount.value) << std::endl;
sif::info << "ValidationSet::printSet: max difference: " << this->maxDifference << std::endl;
sif::info << "ValidationSet::printSet: min tracker confidence: " << this->minTrackerConfidence
<< std::endl;
sif::info << "ValidationSet::printSet: min matched stars: " << this->minMatchedStars
<< std::endl;
sif::info << "ValidationSet::printSet: min matched stars: "
<< static_cast<unsigned int>(this->minMatchedStars.value) << std::endl;
}
};
@ -1714,13 +1726,13 @@ class AlgoSet : public StaticLocalDataSet<ALGO_SET_ENTRIES> {
lp_var_t<uint8_t>(sid.objectId, PoolIds::ALGO_I2L_MIN_MATCHED, this);
void printSet() {
sif::info << "AlgoSet::printSet: mode: " << static_cast<unsigned int>(this->mode) << std::endl;
sif::info << "AlgoSet::printSet: mode: " << static_cast<unsigned int>(this->mode.value) << std::endl;
sif::info << "AlgoSet::printSet: i2t min confidence: " << this->i2tMinConfidence << std::endl;
sif::info << "AlgoSet::printSet: i2t min matched: "
<< static_cast<unsigned int>(this->i2tMinMatched) << std::endl;
<< static_cast<unsigned int>(this->i2tMinMatched.value) << std::endl;
sif::info << "AlgoSet::printSet: i2l min confidence: " << this->i2lMinConfidence << std::endl;
sif::info << "AlgoSet::printSet: i2l min matched: "
<< static_cast<unsigned int>(this->i2lMinMatched) << std::endl;
<< static_cast<unsigned int>(this->i2lMinMatched.value) << std::endl;
}
};
@ -1755,38 +1767,38 @@ class SubscriptionSet : public StaticLocalDataSet<SUBSCRIPTION_SET_ENTRIES> {
lp_var_t<uint8_t> tm16 = lp_var_t<uint8_t>(sid.objectId, PoolIds::SUBSCRIPTION_TM16, this);
void printSet() {
sif::info << "SubscriptionSet::printSet: telemetry 1: " << static_cast<unsigned int>(this->tm1)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 2: " << static_cast<unsigned int>(this->tm2)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 3: " << static_cast<unsigned int>(this->tm3)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 4: " << static_cast<unsigned int>(this->tm4)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 5: " << static_cast<unsigned int>(this->tm5)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 6: " << static_cast<unsigned int>(this->tm6)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 7: " << static_cast<unsigned int>(this->tm7)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 8: " << static_cast<unsigned int>(this->tm8)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 9: " << static_cast<unsigned int>(this->tm9)
<< std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 1: "
<< static_cast<unsigned int>(this->tm1.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 2: "
<< static_cast<unsigned int>(this->tm2.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 3: "
<< static_cast<unsigned int>(this->tm3.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 4: "
<< static_cast<unsigned int>(this->tm4.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 5: "
<< static_cast<unsigned int>(this->tm5.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 6: "
<< static_cast<unsigned int>(this->tm6.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 7: "
<< static_cast<unsigned int>(this->tm7.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 8: "
<< static_cast<unsigned int>(this->tm8.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 9: "
<< static_cast<unsigned int>(this->tm9.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 10: "
<< static_cast<unsigned int>(this->tm10) << std::endl;
<< static_cast<unsigned int>(this->tm10.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 11: "
<< static_cast<unsigned int>(this->tm11) << std::endl;
<< static_cast<unsigned int>(this->tm11.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 12: "
<< static_cast<unsigned int>(this->tm12) << std::endl;
<< static_cast<unsigned int>(this->tm12.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 13: "
<< static_cast<unsigned int>(this->tm13) << std::endl;
<< static_cast<unsigned int>(this->tm13.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 14: "
<< static_cast<unsigned int>(this->tm14) << std::endl;
<< static_cast<unsigned int>(this->tm14.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 15: "
<< static_cast<unsigned int>(this->tm15) << std::endl;
<< static_cast<unsigned int>(this->tm15.value) << std::endl;
sif::info << "SubscriptionSet::printSet: telemetry 16: "
<< static_cast<unsigned int>(this->tm16) << std::endl;
<< static_cast<unsigned int>(this->tm16.value) << std::endl;
}
};
@ -1815,13 +1827,13 @@ class LogSubscriptionSet : public StaticLocalDataSet<LOG_SUBSCRIPTION_SET_ENTRIE
void printSet() {
sif::info << "LogSubscriptionSet::printSet: level 1: "
<< static_cast<unsigned int>(this->level1) << std::endl;
<< static_cast<unsigned int>(this->level1.value) << std::endl;
sif::info << "LogSubscriptionSet::printSet: module 1: "
<< static_cast<unsigned int>(this->module1) << std::endl;
<< static_cast<unsigned int>(this->module1.value) << std::endl;
sif::info << "LogSubscriptionSet::printSet: level 2: "
<< static_cast<unsigned int>(this->level2) << std::endl;
<< static_cast<unsigned int>(this->level2.value) << std::endl;
sif::info << "LogSubscriptionSet::printSet: module 2: "
<< static_cast<unsigned int>(this->module2) << std::endl;
<< static_cast<unsigned int>(this->module2.value) << std::endl;
}
};
@ -1845,8 +1857,8 @@ class DebugCameraSet : public StaticLocalDataSet<DEBUG_CAMERA_SET_ENTRIES> {
: StaticLocalDataSet(sid_t(objectId, DEBUG_CAMERA_SET_ID)) {}
void printSet() {
sif::info << "DebugCameraSet::printSet: level 1: " << this->timing << std::endl;
sif::info << "DebugCameraSet::printSet: module 1: " << this->test << std::endl;
sif::info << "DebugCameraSet::printSet: timing: " << this->timing << std::endl;
sif::info << "DebugCameraSet::printSet: test: " << this->test << std::endl;
}
};
} // namespace StarTracker

View File

@ -126,9 +126,56 @@ static const char TRACKER_CHOICE[] = "trackerChoice";
static const char ALGO[] = "algo";
static const char L2T_MIN_CONFIDENCE[] = "l2t_minConfidence";
static const char L2T_MIN_MATCHED[] = "l2t_minConfidence";
static const char L2T_MIN_MATCHED[] = "l2t_minMatched";
static const char T2L_MIN_CONFIDENCE[] = "t2l_minConfidence";
static const char T2L_MIN_MATCHED[] = "t2l_minMatched";
static const char LOGLEVEL[] = "loglevel";
static const char LOGLEVEL1[] = "loglevel1";
static const char LOGLEVEL2[] = "loglevel2";
static const char LOGLEVEL3[] = "loglevel3";
static const char LOGLEVEL4[] = "loglevel4";
static const char LOGLEVEL5[] = "loglevel5";
static const char LOGLEVEL6[] = "loglevel6";
static const char LOGLEVEL7[] = "loglevel7";
static const char LOGLEVEL8[] = "loglevel8";
static const char LOGLEVEL9[] = "loglevel9";
static const char LOGLEVEL10[] = "loglevel10";
static const char LOGLEVEL11[] = "loglevel11";
static const char LOGLEVEL12[] = "loglevel12";
static const char LOGLEVEL13[] = "loglevel13";
static const char LOGLEVEL14[] = "loglevel14";
static const char LOGLEVEL15[] = "loglevel15";
static const char LOGLEVEL16[] = "loglevel16";
static const char SUBSCRIPTION[] = "subscription";
static const char TELEMETRY_1[] = "telemetry1";
static const char TELEMETRY_2[] = "telemetry2";
static const char TELEMETRY_3[] = "telemetry3";
static const char TELEMETRY_4[] = "telemetry4";
static const char TELEMETRY_5[] = "telemetry5";
static const char TELEMETRY_6[] = "telemetry6";
static const char TELEMETRY_7[] = "telemetry7";
static const char TELEMETRY_8[] = "telemetry8";
static const char TELEMETRY_9[] = "telemetry9";
static const char TELEMETRY_10[] = "telemetry10";
static const char TELEMETRY_11[] = "telemetry11";
static const char TELEMETRY_12[] = "telemetry12";
static const char TELEMETRY_13[] = "telemetry13";
static const char TELEMETRY_14[] = "telemetry14";
static const char TELEMETRY_15[] = "telemetry15";
static const char TELEMETRY_16[] = "telemetry16";
static const char LOG_SUBSCRIPTION[] = "logsubscription";
static const char LEVEL1[] = "level1";
static const char MODULE1[] = "module1";
static const char LEVEL2[] = "level2";
static const char MODULE2[] = "module2";
static const char DEBUG_CAMERA[] = "debugcamera";
static const char TIMING[] = "timing";
static const char TEST[] = "test";
} // namespace arcseckeys
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_ */

View File

@ -270,6 +270,7 @@ void StarTrackerHandler::doStartUp() {
}
return;
case StartupState::DONE:
startupState = StartupState::IDLE;
break;
default:
return;
@ -405,8 +406,9 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
prepareTakeImageCommand(commandData);
return RETURN_OK;
}
case (StarTracker::SUBSCRIBE_TO_TM): {
prepareSubscriptionCommand(commandData);
case (StarTracker::SUBSCRIPTION): {
Subscription subscription;
result = prepareParamCommand(commandData, commandDataLen, subscription);
return RETURN_OK;
}
case (StarTracker::REQ_SOLUTION): {
@ -479,6 +481,21 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
result = prepareParamCommand(commandData, commandDataLen, tracking);
return result;
}
case (StarTracker::LOGLEVEL): {
LogLevel logLevel;
result = prepareParamCommand(commandData, commandDataLen, logLevel);
return result;
}
case (StarTracker::LOGSUBSCRIPTION): {
LogSubscription logSubscription;
result = prepareParamCommand(commandData, commandDataLen, logSubscription);
return result;
}
case (StarTracker::DEBUG_CAMERA): {
DebugCamera debugCamera;
result = prepareParamCommand(commandData, commandDataLen, debugCamera);
return result;
}
case (StarTracker::ERASE): {
result = prepareEraseCommand(commandData, commandDataLen);
return result;
@ -536,7 +553,7 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
return result;
}
case (StarTracker::REQ_IMAGE_PROCESSOR): {
result = prepareRequestMountignParams();
result = prepareRequestImageProcessorParams();
return result;
}
case (StarTracker::REQ_CENTROIDING): {
@ -548,7 +565,7 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
return result;
}
case (StarTracker::REQ_MATCHING): {
result = prepareRequetMatchingParams();
result = prepareRequestMatchingParams();
return result;
}
case (StarTracker::REQ_TRACKING): {
@ -571,6 +588,10 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
result = prepareRequestLogSubscriptionParams();
return result;
}
case (StarTracker::REQ_DEBUG_CAMERA): {
result = prepareRequestDebugCameraParams();
return result;
}
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
@ -595,7 +616,7 @@ void StarTrackerHandler::fillCommandAndReplyMap() {
StarTracker::MAX_FRAME_SIZE * 2 + 2);
// Reboot has no reply. Star tracker reboots immediately
this->insertInCommandMap(StarTracker::SWITCH_TO_BOOTLOADER_PROGRAM);
this->insertInCommandAndReplyMap(StarTracker::SUBSCRIBE_TO_TM, 3, nullptr,
this->insertInCommandAndReplyMap(StarTracker::SUBSCRIPTION, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::REQ_SOLUTION, 3, &solutionSet,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
@ -605,6 +626,12 @@ void StarTrackerHandler::fillCommandAndReplyMap() {
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::REQ_CONTRAST, 3, &contrastSet,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::LOGLEVEL, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::LOGSUBSCRIPTION, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::DEBUG_CAMERA, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::LIMITS, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::MOUNTING, 3, nullptr,
@ -739,10 +766,6 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
ReturnValue_t result = RETURN_OK;
switch (id) {
case (StarTracker::SUBSCRIBE_TO_TM): {
result = handleSetParamReply();
break;
}
case (StarTracker::REQ_TIME): {
result = handleTm(timeSet, StarTracker::TimeSet::SIZE);
break;
@ -823,6 +846,10 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
result = handleTm(contrastSet, StarTracker::ContrastSet::SIZE);
break;
}
case (StarTracker::SUBSCRIPTION):
case (StarTracker::LOGLEVEL):
case (StarTracker::LOGSUBSCRIPTION):
case (StarTracker::DEBUG_CAMERA):
case (StarTracker::LIMITS):
case (StarTracker::MOUNTING):
case (StarTracker::CAMERA):
@ -844,13 +871,60 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
handleParamRequest(limitsSet, StarTracker::LimitsSet::SIZE);
break;
}
case (StarTracker::REQ_LOG_LEVEL): {
handleParamRequest(loglevelSet, StarTracker::LogLevelSet::SIZE);
break;
}
case (StarTracker::REQ_MOUNTING): {
handleParamRequest(mountingSet, StarTracker::MountingSet::SIZE);
break;
}
case (StarTracker::REQ_IMAGE_PROCESSOR): {
handleParamRequest(imageProcessorSet, StarTracker::ImageProcessorSet::SIZE);
break;
}
case (StarTracker::REQ_CENTROIDING): {
handleParamRequest(centroidingSet, StarTracker::CentroidingSet::SIZE);
break;
}
case (StarTracker::REQ_LISA): {
handleParamRequest(lisaSet, StarTracker::LisaSet::SIZE);
break;
}
case (StarTracker::REQ_MATCHING): {
handleParamRequest(matchingSet, StarTracker::MatchingSet::SIZE);
break;
}
case (StarTracker::REQ_TRACKING): {
handleParamRequest(trackingSet, StarTracker::TrackingSet::SIZE);
break;
}
case (StarTracker::REQ_VALIDATION): {
handleParamRequest(validationSet, StarTracker::ValidationSet::SIZE);
break;
}
case (StarTracker::REQ_ALGO): {
handleParamRequest(algoSet, StarTracker::AlgoSet::SIZE);
break;
}
case (StarTracker::REQ_SUBSCRIPTION): {
handleParamRequest(subscriptionSet, StarTracker::SubscriptionSet::SIZE);
break;
}
case (StarTracker::REQ_LOG_SUBSCRIPTION): {
handleParamRequest(logSubscriptionSet, StarTracker::LogSubscriptionSet::SIZE);
break;
}
case (StarTracker::REQ_DEBUG_CAMERA): {
handleParamRequest(debugCameraSet, StarTracker::DebugCameraSet::SIZE);
break;
}
default: {
sif::debug << "StarTrackerHandler::interpretDeviceReply: Unknown device reply id:" << id
<< std::endl;
result = DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
}
}
return result;
}
@ -1147,7 +1221,7 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l
localDataPoolMap.emplace(StarTracker::TRACKING_THIN_LIMIT, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::TRACKING_OUTLIER_THRESHOLD, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::TRACKING_OUTLIER_THRESHOLD_QUEST, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::TRACKING_TRACKER_CHOICE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(StarTracker::TRACKING_TRACKER_CHOICE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::VALIDATION_STABLE_COUNT, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::VALIDATION_MAX_DIFFERENCE, new PoolEntry<float>({0}));
@ -1182,8 +1256,8 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l
localDataPoolMap.emplace(StarTracker::LOG_SUBSCRIPTION_LEVEL2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::LOG_SUBSCRIPTION_MODULE2, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::DEBUG_CAMERA_TIMING, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::DEBUG_CAMERA_TEST, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(StarTracker::DEBUG_CAMERA_TIMING, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(StarTracker::DEBUG_CAMERA_TEST, new PoolEntry<uint32_t>({0}));
return RETURN_OK;
}
@ -1280,7 +1354,7 @@ ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId)
break;
}
default:
sif::warning << "StarTrackerHandler::scanForParameterReply: Unknown parameter reply id"
sif::warning << "StarTrackerHandler::scanForActionReply: Unknown parameter reply id"
<< std::endl;
return RETURN_FAILED;
}
@ -1291,7 +1365,7 @@ ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* fo
const uint8_t* reply = dataLinkLayer.getReply();
switch (*reply) {
case (StarTracker::ID::SUBSCRIPTION): {
*foundId = StarTracker::SUBSCRIBE_TO_TM;
*foundId = StarTracker::SUBSCRIPTION;
break;
}
case (StarTracker::ID::LIMITS): {
@ -1334,6 +1408,18 @@ ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* fo
*foundId = StarTracker::ALGO;
break;
}
case (StarTracker::ID::LOG_LEVEL): {
*foundId = StarTracker::LOGLEVEL;
break;
}
case (StarTracker::ID::DEBUG_CAMERA): {
*foundId = StarTracker::DEBUG_CAMERA;
break;
}
case (StarTracker::ID::LOG_SUBSCRIPTION): {
*foundId = StarTracker::LOGSUBSCRIPTION;
break;
}
default:
sif::debug << "StarTrackerHandler::scanForParameterReply: Unknown parameter reply id"
<< std::endl;
@ -1390,7 +1476,7 @@ ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* fo
break;
}
case (StarTracker::ID::SUBSCRIPTION): {
*foundId = StarTracker::SUBSCRIPTION;
*foundId = StarTracker::REQ_SUBSCRIPTION;
break;
}
case (StarTracker::ID::LOG_SUBSCRIPTION): {
@ -1862,32 +1948,6 @@ void StarTrackerHandler::prepareTakeImageCommand(const uint8_t* commandData) {
rawPacketLen = dataLinkLayer.getEncodedLength();
}
void StarTrackerHandler::prepareSubscriptionCommand(const uint8_t* tmId) {
uint32_t length = 18;
commandBuffer[0] = TMTC_SETPARAMREQ;
commandBuffer[1] = StarTracker::ID::SUBSCRIPTION;
// Fill all other fields with invalid tm id
commandBuffer[2] = *tmId;
commandBuffer[3] = 0;
commandBuffer[4] = 0;
commandBuffer[5] = 0;
commandBuffer[6] = 0;
commandBuffer[7] = 0;
commandBuffer[8] = 0;
commandBuffer[9] = 0;
commandBuffer[10] = 0;
commandBuffer[11] = 0;
commandBuffer[12] = 0;
commandBuffer[13] = 0;
commandBuffer[14] = 0;
commandBuffer[15] = 0;
commandBuffer[16] = 0;
commandBuffer[17] = 0;
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
}
void StarTrackerHandler::prepareSolutionRequest() {
uint32_t length = 0;
arc_tm_pack_solution_req(commandBuffer, &length);
@ -2033,7 +2093,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() {
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestPropertyParams() {
ReturnValue_t StarTrackerHandler::prepareRequestLogLevelParams() {
uint32_t length = 0;
arc_pack_loglevel_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
@ -2042,6 +2102,105 @@ ReturnValue_t StarTrackerHandler::prepareRequestPropertyParams() {
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestMountingParams() {
uint32_t length = 0;
arc_pack_mounting_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestImageProcessorParams() {
uint32_t length = 0;
arc_pack_imageprocessor_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestCentroidingParams() {
uint32_t length = 0;
arc_pack_centroiding_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestLisaParams() {
uint32_t length = 0;
arc_pack_lisa_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestMatchingParams() {
uint32_t length = 0;
arc_pack_matching_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestTrackingParams() {
uint32_t length = 0;
arc_pack_tracking_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestValidationParams() {
uint32_t length = 0;
arc_pack_validation_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestAlgoParams() {
uint32_t length = 0;
arc_pack_algo_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestSubscriptionParams() {
uint32_t length = 0;
arc_pack_subscription_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestLogSubscriptionParams() {
uint32_t length = 0;
arc_pack_logsubscription_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestDebugCameraParams() {
uint32_t length = 0;
arc_pack_debugcamera_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::handleSetParamReply() {
const uint8_t* reply = dataLinkLayer.getReply();
uint8_t status = *(reply + STATUS_OFFSET);

View File

@ -504,6 +504,12 @@ ReturnValue_t Lisa::createCommand(uint8_t* buffer) {
}
addfloat(param, buffer + offset);
offset += sizeof(float);
result = getParam(arcseckeys::RATING_WEIGHT_MEAN_SUM, 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;
@ -632,3 +638,280 @@ ReturnValue_t Algo::createCommand(uint8_t* buffer) {
adduint8(param, buffer + offset);
return RETURN_OK;
}
LogLevel::LogLevel() : ArcsecJsonParamBase(arcseckeys::LOGLEVEL) {}
size_t LogLevel::getSize() { return COMMAND_SIZE; }
ReturnValue_t LogLevel::createCommand(uint8_t* buffer) {
ReturnValue_t result = RETURN_OK;
uint8_t offset = 0;
std::string param;
addSetParamHeader(buffer, StarTracker::ID::LOG_LEVEL);
offset = 2;
result = getParam(arcseckeys::LOGLEVEL1, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL2, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL3, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL4, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL5, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL6, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL7, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL8, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL9, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL10, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL11, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL12, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL13, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL14, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL15, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LOGLEVEL16, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
return RETURN_OK;
}
Subscription::Subscription() : ArcsecJsonParamBase(arcseckeys::SUBSCRIPTION) {}
size_t Subscription::getSize() { return COMMAND_SIZE; }
ReturnValue_t Subscription::createCommand(uint8_t* buffer) {
ReturnValue_t result = RETURN_OK;
uint8_t offset = 0;
std::string param;
addSetParamHeader(buffer, StarTracker::ID::SUBSCRIPTION);
offset = 2;
result = getParam(arcseckeys::TELEMETRY_1, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_2, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_3, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_4, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_5, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_6, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_7, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_8, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_9, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_10, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_11, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_12, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_13, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_14, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_15, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::TELEMETRY_16, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
return RETURN_OK;
}
LogSubscription::LogSubscription() : ArcsecJsonParamBase(arcseckeys::LOG_SUBSCRIPTION) {}
size_t LogSubscription::getSize() { return COMMAND_SIZE; }
ReturnValue_t LogSubscription::createCommand(uint8_t* buffer) {
ReturnValue_t result = RETURN_OK;
uint8_t offset = 0;
std::string param;
addSetParamHeader(buffer, StarTracker::ID::LOG_SUBSCRIPTION);
offset = 2;
result = getParam(arcseckeys::LEVEL1, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::MODULE1, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::LEVEL2, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
offset += sizeof(uint8_t);
result = getParam(arcseckeys::MODULE2, param);
if (result != RETURN_OK) {
return result;
}
adduint8(param, buffer + offset);
return RETURN_OK;
}
DebugCamera::DebugCamera() : ArcsecJsonParamBase(arcseckeys::DEBUG_CAMERA) {}
size_t DebugCamera::getSize() { return COMMAND_SIZE; }
ReturnValue_t DebugCamera::createCommand(uint8_t* buffer) {
ReturnValue_t result = RETURN_OK;
uint8_t offset = 0;
std::string param;
addSetParamHeader(buffer, StarTracker::ID::DEBUG_CAMERA);
offset = 2;
result = getParam(arcseckeys::TIMING, param);
if (result != RETURN_OK) {
return result;
}
adduint32(param, buffer + offset);
offset += sizeof(uint32_t);
result = getParam(arcseckeys::TEST, param);
if (result != RETURN_OK) {
return result;
}
adduint32(param, buffer + offset);
return RETURN_OK;
}

View File

@ -173,4 +173,68 @@ class Algo : public ArcsecJsonParamBase {
ReturnValue_t createCommand(uint8_t* buffer) override;
};
/**
* @brief Generates command to configure the log level parameters.
*
*/
class LogLevel : public ArcsecJsonParamBase {
public:
LogLevel();
size_t getSize();
private:
static const size_t COMMAND_SIZE = 18;
ReturnValue_t createCommand(uint8_t* buffer) override;
};
/**
* @brief Generates command to set subscription parameters.
*
*/
class Subscription : public ArcsecJsonParamBase {
public:
Subscription();
size_t getSize();
private:
static const size_t COMMAND_SIZE = 18;
ReturnValue_t createCommand(uint8_t* buffer) override;
};
/**
* @brief Generates command to set log subscription parameters.
*
*/
class LogSubscription : public ArcsecJsonParamBase {
public:
LogSubscription();
size_t getSize();
private:
static const size_t COMMAND_SIZE = 6;
ReturnValue_t createCommand(uint8_t* buffer) override;
};
/**
* @brief Generates command to set debug camera parameters
*
*/
class DebugCamera : public ArcsecJsonParamBase {
public:
DebugCamera();
size_t getSize();
private:
static const size_t COMMAND_SIZE = 10;
ReturnValue_t createCommand(uint8_t* buffer) override;
};
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_STARTRACKERJSONCOMMANDS_H_ */