diff --git a/CHANGELOG.md b/CHANGELOG.md index 463d85bf..9688a565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,11 @@ will consitute of a breaking change warranting a new major release: ## Added +- STR: Added new TM sets: Blob, Blobs, MatchedCentroids, Contrast, AutoBlob, Centroid, Centroids +- STR: Added new mechanism where the secondary TM which is polled can now be a set instead of + being temperature only. An API is exposed which allows to add a data set to that set of secondary + telemetry, reset it back to temperature only, and read the whole set. This allows more debugging + capability. - CFDP source handler, which allows file downlink using the standardized CFDP interface. - Proper back pressure handling for the CFDP handler, where the `LiveTmTask` is able to throttle diff --git a/mission/acs/str/StarTrackerHandler.cpp b/mission/acs/str/StarTrackerHandler.cpp index a6091d7c..541301f1 100644 --- a/mission/acs/str/StarTrackerHandler.cpp +++ b/mission/acs/str/StarTrackerHandler.cpp @@ -49,6 +49,13 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF, subscriptionSet(this), logSubscriptionSet(this), debugCameraSet(this), + autoBlobSet(this), + matchedCentroidsSet(this), + blobSet(this), + blobsSet(this), + centroidSet(this), + centroidsSet(this), + contrastSet(this), strHelper(strHelper), paramJsonFile(jsonFileStr), powerSwitch(powerSwitch) { @@ -59,6 +66,8 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF, sif::error << "StarTrackerHandler: Invalid str image loader" << std::endl; } eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5); + additionalRequestedTm.emplace(startracker::REQ_TEMPERATURE); + currentSecondaryTmIter = additionalRequestedTm.begin(); } StarTrackerHandler::~StarTrackerHandler() {} @@ -165,6 +174,35 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu ReturnValue_t result = returnvalue::OK; switch (actionId) { + case (startracker::ADD_SECONDARY_TM_TO_NORMAL_MODE): { + if (size < 4) { + return HasActionsIF::INVALID_PARAMETERS; + } + DeviceCommandId_t idToAdd; + result = + SerializeAdapter::deSerialize(&idToAdd, data, &size, SerializeIF::Endianness::NETWORK); + if (result != returnvalue::OK) { + return result; + } + addSecondaryTmForNormalMode(idToAdd); + return EXECUTION_FINISHED; + } + case (startracker::RESET_SECONDARY_TM_SET): { + resetSecondaryTmSet(); + return EXECUTION_FINISHED; + } + case (startracker::READ_SECONDARY_TM_SET): { + std::vector dataVec(additionalRequestedTm.size() * 4); + unsigned idx = 0; + size_t serLen = 0; + for (const auto& cmd : additionalRequestedTm) { + SerializeAdapter::serialize(&cmd, dataVec.data() + idx * 4, &serLen, dataVec.size(), + SerializeIF::Endianness::NETWORK); + idx++; + } + actionHelper.reportData(commandedBy, actionId, dataVec.data(), dataVec.size()); + return EXECUTION_FINISHED; + } case (startracker::STOP_IMAGE_LOADER): { strHelper->stopProcess(); return EXECUTION_FINISHED; @@ -306,13 +344,20 @@ ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id return NOTHING_TO_SEND; } switch (normalState) { - case NormalState::TEMPERATURE_REQUEST: - *id = startracker::REQ_TEMPERATURE; + case NormalState::SECONDARY_REQUEST: + if (additionalRequestedTm.size() == 0) { + break; + } + *id = *currentSecondaryTmIter; + currentSecondaryTmIter++; + if (currentSecondaryTmIter == additionalRequestedTm.end()) { + currentSecondaryTmIter = additionalRequestedTm.begin(); + } normalState = NormalState::SOLUTION_REQUEST; break; case NormalState::SOLUTION_REQUEST: *id = startracker::REQ_SOLUTION; - normalState = NormalState::TEMPERATURE_REQUEST; + normalState = NormalState::SECONDARY_REQUEST; break; default: sif::debug << "StarTrackerHandler::buildNormalDeviceCommand: Invalid normal step" @@ -472,6 +517,18 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi prepareTimeRequest(); return returnvalue::OK; } + case (startracker::REQ_CENTROID): { + prepareRequestCentroidTm(); + return returnvalue::OK; + } + case (startracker::REQ_CENTROIDS): { + prepareRequestCentroidsTm(); + return returnvalue::OK; + } + case (startracker::REQ_CONTRAST): { + prepareRequestContrastTm(); + return returnvalue::OK; + } case (startracker::BOOT): { prepareBootCommand(); return returnvalue::OK; @@ -607,6 +664,22 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi result = prepareRequestLisaParams(); return result; } + case (startracker::REQ_MATCHED_CENTROIDS): { + result = prepareRequestMatchedCentroidsTm(); + return result; + } + case (startracker::REQ_BLOB): { + result = prepareRequestBlobTm(); + return result; + } + case (startracker::REQ_BLOBS): { + result = prepareRequestBlobsTm(); + return result; + } + case (startracker::REQ_AUTO_BLOB): { + result = prepareRequestAutoBlobTm(); + return returnvalue::OK; + } case (startracker::REQ_MATCHING): { result = prepareRequestMatchingParams(); return result; @@ -729,6 +802,20 @@ void StarTrackerHandler::fillCommandAndReplyMap() { startracker::MAX_FRAME_SIZE * 2 + 2); this->insertInCommandAndReplyMap(startracker::REQ_DEBUG_CAMERA, 3, &debugCameraSet, startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_AUTO_BLOB, 3, &autoBlobSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_MATCHED_CENTROIDS, 3, &matchedCentroidsSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_BLOB, 3, &blobSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_BLOBS, 3, &blobsSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_CENTROID, 3, ¢roidSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_CENTROIDS, 3, ¢roidsSet, + startracker::MAX_FRAME_SIZE * 2 + 2); + this->insertInCommandAndReplyMap(startracker::REQ_CONTRAST, 3, &contrastSet, + startracker::MAX_FRAME_SIZE * 2 + 2); } ReturnValue_t StarTrackerHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) { @@ -860,6 +947,74 @@ void StarTrackerHandler::setUpJsonCfgs(JsonConfigs& cfgs, const char* paramJsonF JCFG_DONE = true; } +ReturnValue_t StarTrackerHandler::statusFieldCheck(const uint8_t* rawFrame) { + uint8_t status = startracker::getStatusField(rawFrame); + if (status != startracker::STATUS_OK) { + sif::warning << "StarTrackerHandler::handleTm: Reply error: " + << static_cast(status) << std::endl; + return REPLY_ERROR; + } + return returnvalue::OK; +} + +void StarTrackerHandler::addSecondaryTmForNormalMode(DeviceCommandId_t cmd) { + additionalRequestedTm.emplace(cmd); +} + +void StarTrackerHandler::resetSecondaryTmSet() { + additionalRequestedTm.clear(); + additionalRequestedTm.emplace(startracker::REQ_TEMPERATURE); + currentSecondaryTmIter = additionalRequestedTm.begin(); + { + PoolReadGuard pg(&autoBlobSet); + if (pg.getReadResult() == returnvalue::OK) { + autoBlobSet.setValidity(false, true); + } + } + { + PoolReadGuard pg(&matchedCentroidsSet); + if (pg.getReadResult() == returnvalue::OK) { + matchedCentroidsSet.setValidity(false, true); + } + } + { + PoolReadGuard pg(&blobSet); + if (pg.getReadResult() == returnvalue::OK) { + blobSet.setValidity(false, true); + } + } + { + PoolReadGuard pg(&blobsSet); + if (pg.getReadResult() == returnvalue::OK) { + blobsSet.setValidity(false, true); + } + } + { + PoolReadGuard pg(¢roidSet); + if (pg.getReadResult() == returnvalue::OK) { + centroidSet.setValidity(false, true); + } + } + { + PoolReadGuard pg(&contrastSet); + if (pg.getReadResult() == returnvalue::OK) { + contrastSet.setValidity(false, true); + } + } + { + PoolReadGuard pg(¢roidsSet); + if (pg.getReadResult() == returnvalue::OK) { + centroidsSet.setValidity(false, true); + } + } + { + PoolReadGuard pg(&histogramSet); + if (pg.getReadResult() == returnvalue::OK) { + histogramSet.setValidity(false, true); + } + } +} + void StarTrackerHandler::bootBootloader() { if (internalState == InternalState::IDLE) { internalState = InternalState::BOOT_BOOTLOADER; @@ -896,24 +1051,24 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema } case TMTC_ACTIONREPLY: { *foundLen = remainingSize; + fullPacketLen = remainingSize; return scanForActionReply(startracker::getId(start), foundId); - break; } case TMTC_SETPARAMREPLY: { *foundLen = remainingSize; + fullPacketLen = remainingSize; return scanForSetParameterReply(startracker::getId(start), foundId); - break; } case TMTC_PARAMREPLY: { *foundLen = remainingSize; + fullPacketLen = remainingSize; return scanForGetParameterReply(startracker::getId(start), foundId); - break; } case TMTC_TELEMETRYREPLYA: case TMTC_TELEMETRYREPLY: { *foundLen = remainingSize; + fullPacketLen = remainingSize; return scanForTmReply(startracker::getId(start), foundId); - break; } default: { sif::debug << "StarTrackerHandler::scanForReply: Reply has invalid type id" << std::endl; @@ -933,7 +1088,7 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id, break; } case (startracker::REQ_TIME): { - result = handleTm(packet, timeSet, startracker::TimeSet::SIZE, "REQ_TIME"); + result = handleTm(packet, timeSet, "REQ_TIME"); break; } case (startracker::PING_REQUEST): { @@ -948,7 +1103,7 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id, break; } case (startracker::REQ_VERSION): { - result = handleTm(packet, versionSet, startracker::VersionSet::SIZE, "REQ_VERSION"); + result = handleTm(packet, versionSet, "REQ_VERSION"); if (result != returnvalue::OK) { return result; } @@ -959,23 +1114,51 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id, break; } case (startracker::REQ_INTERFACE): { - result = handleTm(packet, interfaceSet, startracker::InterfaceSet::SIZE, "REQ_INTERFACE"); + result = handleTm(packet, interfaceSet, "REQ_INTERFACE"); break; } case (startracker::REQ_POWER): { - result = handleTm(packet, powerSet, startracker::PowerSet::SIZE, "REQ_POWER"); + result = handleTm(packet, powerSet, "REQ_POWER"); break; } case (startracker::REQ_SOLUTION): { - result = handleTm(packet, solutionSet, startracker::SolutionSet::SIZE, "REQ_SOLUTION"); + result = handleTm(packet, solutionSet, "REQ_SOLUTION"); + break; + } + case (startracker::REQ_CONTRAST): { + result = handleTm(packet, contrastSet, "REQ_CONTRAST"); + break; + } + case (startracker::REQ_AUTO_BLOB): { + result = handleAutoBlobTm(packet); + break; + } + case (startracker::REQ_MATCHED_CENTROIDS): { + result = handleMatchedCentroidTm(packet); + break; + } + case (startracker::REQ_BLOB): { + result = handleBlobTm(packet); + break; + } + case (startracker::REQ_BLOBS): { + result = handleBlobsTm(packet); + break; + } + case (startracker::REQ_CENTROID): { + result = handleCentroidTm(packet); + break; + } + case (startracker::REQ_CENTROIDS): { + result = handleCentroidsTm(packet); break; } case (startracker::REQ_TEMPERATURE): { - result = handleTm(packet, temperatureSet, startracker::TemperatureSet::SIZE, "REQ_TEMP"); + result = handleTm(packet, temperatureSet, "REQ_TEMP"); break; } case (startracker::REQ_HISTOGRAM): { - result = handleTm(packet, histogramSet, startracker::HistogramSet::SIZE, "REQ_HISTO"); + result = handleTm(packet, histogramSet, "REQ_HISTO"); break; } case (startracker::SUBSCRIPTION): @@ -1329,6 +1512,56 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l localDataPoolMap.emplace(startracker::CHKSUM, new PoolEntry({0})); + localDataPoolMap.emplace(startracker::TICKS_AUTO_BLOB, new PoolEntry()); + localDataPoolMap.emplace(startracker::TIME_AUTO_BLOB, new PoolEntry()); + localDataPoolMap.emplace(startracker::AUTO_BLOB_THRESHOLD, new PoolEntry()); + + localDataPoolMap.emplace(startracker::PoolIds::NUM_MATCHED_CENTROIDS, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::MATCHED_CENTROIDS_STAR_IDS, + new PoolEntry(16)); + localDataPoolMap.emplace(startracker::PoolIds::MATCHED_CENTROIDS_X_COORDS, + new PoolEntry(16)); + localDataPoolMap.emplace(startracker::PoolIds::MATCHED_CENTROIDS_Y_COORDS, + new PoolEntry(16)); + localDataPoolMap.emplace(startracker::PoolIds::MATCHED_CENTROIDS_X_ERRORS, + new PoolEntry(16)); + localDataPoolMap.emplace(startracker::PoolIds::MATCHED_CENTROIDS_Y_ERRORS, + new PoolEntry(16)); + localDataPoolMap.emplace(startracker::PoolIds::TICKS_MATCHED_CENTROIDS, + new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::TIME_MATCHED_CENTROIDS, new PoolEntry()); + + localDataPoolMap.emplace(startracker::PoolIds::BLOB_TICKS, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::BLOB_TIME, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::BLOB_COUNT, new PoolEntry()); + + localDataPoolMap.emplace(startracker::PoolIds::BLOBS_TICKS, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::BLOBS_TIME, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::BLOBS_COUNT, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::BLOBS_COUNT_USED, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::BLOBS_NR_4LINES_SKIPPED, + new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::BLOBS_X_COORDS, new PoolEntry(8)); + localDataPoolMap.emplace(startracker::PoolIds::BLOBS_Y_COORDS, new PoolEntry(8)); + + localDataPoolMap.emplace(startracker::PoolIds::CENTROID_TICKS, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::CENTROID_TIME, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::CENTROID_COUNT, new PoolEntry()); + + localDataPoolMap.emplace(startracker::PoolIds::CENTROIDS_TICKS, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::CENTROIDS_TIME, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::CENTROIDS_COUNT, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::CENTROIDS_X_COORDS, new PoolEntry(16)); + localDataPoolMap.emplace(startracker::PoolIds::CENTROIDS_Y_COORDS, new PoolEntry(16)); + localDataPoolMap.emplace(startracker::PoolIds::CENTROIDS_MAGNITUDES, new PoolEntry(16)); + + localDataPoolMap.emplace(startracker::PoolIds::CONTRAST_TICKS, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::CONTRAST_TIME, new PoolEntry()); + localDataPoolMap.emplace(startracker::PoolIds::CONTRAST_A, new PoolEntry(9)); + localDataPoolMap.emplace(startracker::PoolIds::CONTRAST_B, new PoolEntry(9)); + localDataPoolMap.emplace(startracker::PoolIds::CONTRAST_C, new PoolEntry(9)); + localDataPoolMap.emplace(startracker::PoolIds::CONTRAST_D, new PoolEntry(9)); + poolManager.subscribeForDiagPeriodicPacket( subdp::DiagnosticsHkPeriodicParams(temperatureSet.getSid(), false, 10.0)); poolManager.subscribeForRegularPeriodicPacket( @@ -1343,6 +1576,20 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l subdp::RegularHkPeriodicParams(histogramSet.getSid(), false, 10.0)); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(lisaSet.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(autoBlobSet.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(matchedCentroidsSet.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(blobSet.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(blobsSet.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(centroidSet.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(centroidsSet.getSid(), false, 10.0)); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(contrastSet.getSid(), false, 10.0)); return returnvalue::OK; } @@ -1584,8 +1831,36 @@ ReturnValue_t StarTrackerHandler::scanForTmReply(uint8_t replyId, DeviceCommandI *foundId = startracker::REQ_SOLUTION; break; } + case (startracker::ID::BLOB): { + *foundId = startracker::REQ_BLOB; + break; + } + case (startracker::ID::BLOBS): { + *foundId = startracker::REQ_BLOBS; + break; + } + case (startracker::ID::CENTROID): { + *foundId = startracker::REQ_CENTROID; + break; + } + case (startracker::ID::CENTROIDS): { + *foundId = startracker::REQ_CENTROIDS; + break; + } + case (startracker::ID::AUTO_BLOB): { + *foundId = startracker::REQ_AUTO_BLOB; + break; + } + case (startracker::ID::MATCHED_CENTROIDS): { + *foundId = startracker::REQ_MATCHED_CENTROIDS; + break; + } + case (startracker::ID::CONTRAST): { + *foundId = startracker::REQ_CONTRAST; + break; + } default: { - sif::debug << "StarTrackerHandler::scanForTmReply: Reply contains invalid reply id: " + sif::debug << "StarTrackerHandler::scanForTmReply: Reply contains invalid reply ID: " << static_cast(replyId) << std::endl; return returnvalue::FAILED; break; @@ -1760,6 +2035,62 @@ void StarTrackerHandler::prepareHistogramRequest() { rawPacketLen = length; } +ReturnValue_t StarTrackerHandler::prepareRequestAutoBlobTm() { + uint32_t length = 0; + arc_tm_pack_autoblob_req(commandBuffer, &length); + rawPacket = commandBuffer; + rawPacketLen = length; + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::prepareRequestMatchedCentroidsTm() { + uint32_t length = 0; + arc_tm_pack_matchedcentroids_req(commandBuffer, &length); + rawPacket = commandBuffer; + rawPacketLen = length; + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::prepareRequestBlobTm() { + uint32_t length = 0; + arc_tm_pack_blob_req(commandBuffer, &length); + rawPacket = commandBuffer; + rawPacketLen = length; + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::prepareRequestBlobsTm() { + uint32_t length = 0; + arc_tm_pack_blobs_req(commandBuffer, &length); + rawPacket = commandBuffer; + rawPacketLen = length; + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::prepareRequestCentroidTm() { + uint32_t length = 0; + arc_tm_pack_centroid_req(commandBuffer, &length); + rawPacket = commandBuffer; + rawPacketLen = length; + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::prepareRequestCentroidsTm() { + uint32_t length = 0; + arc_tm_pack_centroids_req(commandBuffer, &length); + rawPacket = commandBuffer; + rawPacketLen = length; + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::prepareRequestContrastTm() { + uint32_t length = 0; + arc_tm_pack_contrast_req(commandBuffer, &length); + rawPacket = commandBuffer; + rawPacketLen = length; + return returnvalue::OK; +} + ReturnValue_t StarTrackerHandler::prepareParamCommand(const uint8_t* commandData, size_t commandDataLen, ArcsecJsonParamBase& paramSet, @@ -2038,13 +2369,10 @@ ReturnValue_t StarTrackerHandler::checkProgram() { } ReturnValue_t StarTrackerHandler::handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, - size_t size, const char* context) { - ReturnValue_t result = returnvalue::OK; - uint8_t status = startracker::getStatusField(rawFrame); - if (status != startracker::STATUS_OK) { - sif::warning << "StarTrackerHandler::handleTm: Reply error: " - << static_cast(status) << std::endl; - return REPLY_ERROR; + const char* context) { + ReturnValue_t result = statusFieldCheck(rawFrame); + if (result != returnvalue::OK) { + return result; } result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT); if (result != returnvalue::OK) { @@ -2052,10 +2380,11 @@ ReturnValue_t StarTrackerHandler::handleTm(const uint8_t* rawFrame, LocalPoolDat } const uint8_t* reply = rawFrame + TICKS_OFFSET; dataset.setValidityBufferGeneration(false); - result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE); + size_t sizeLeft = fullPacketLen; + result = dataset.deSerialize(&reply, &sizeLeft, SerializeIF::Endianness::LITTLE); if (result != returnvalue::OK) { - sif::warning << "StarTrackerHandler::handleTm: Deserialization failed for " << context - << std::endl; + sif::warning << "StarTrackerHandler::handleTm: Deserialization failed for " << context << ": 0x" + << std::hex << std::setw(4) << result << std::dec << std::endl; } dataset.setValidityBufferGeneration(true); dataset.setValidity(true, true); @@ -2069,6 +2398,262 @@ ReturnValue_t StarTrackerHandler::handleTm(const uint8_t* rawFrame, LocalPoolDat return result; } +ReturnValue_t StarTrackerHandler::handleAutoBlobTm(const uint8_t* rawFrame) { + ReturnValue_t result = statusFieldCheck(rawFrame); + if (result != returnvalue::OK) { + return result; + } + rawFrame += TICKS_OFFSET; + size_t remainingLen = fullPacketLen; + PoolReadGuard pg(&autoBlobSet); + result = pg.getReadResult(); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&autoBlobSet.ticks, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&autoBlobSet.timeUs, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&autoBlobSet.threshold, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + autoBlobSet.setValidity(true, true); + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::handleMatchedCentroidTm(const uint8_t* rawFrame) { + ReturnValue_t result = statusFieldCheck(rawFrame); + if (result != returnvalue::OK) { + return result; + } + rawFrame += TICKS_OFFSET; + size_t remainingLen = fullPacketLen; + PoolReadGuard pg(&matchedCentroidsSet); + result = pg.getReadResult(); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&matchedCentroidsSet.ticks, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&matchedCentroidsSet.timeUs, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&matchedCentroidsSet.numberOfMatchedCentroids, &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + + if (result != returnvalue::OK) { + return result; + } + // Yeah, we serialize it like that because I can't model anything with that local datapool crap. + for (unsigned idx = 0; idx < 16; idx++) { + result = SerializeAdapter::deSerialize(&matchedCentroidsSet.starIds[idx], &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&matchedCentroidsSet.xCoords[idx], &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&matchedCentroidsSet.yCoords[idx], &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&matchedCentroidsSet.xErrors[idx], &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&matchedCentroidsSet.yErrors[idx], &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + } + matchedCentroidsSet.setValidity(true, true); + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::handleBlobTm(const uint8_t* rawFrame) { + ReturnValue_t result = statusFieldCheck(rawFrame); + if (result != returnvalue::OK) { + return result; + } + rawFrame += TICKS_OFFSET; + size_t remainingLen = fullPacketLen; + PoolReadGuard pg(&blobsSet); + result = pg.getReadResult(); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobSet.ticks, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobSet.timeUs, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobSet.blobCount, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + blobSet.setValidity(true, true); + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::handleBlobsTm(const uint8_t* rawFrame) { + ReturnValue_t result = statusFieldCheck(rawFrame); + if (result != returnvalue::OK) { + return result; + } + rawFrame += TICKS_OFFSET; + size_t remainingLen = fullPacketLen; + PoolReadGuard pg(&blobsSet); + result = pg.getReadResult(); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobsSet.ticks, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobsSet.timeUs, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobsSet.blobsCount, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobsSet.blobsCountUsed, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobsSet.nr4LinesSkipped, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + for (unsigned idx = 0; idx < 8; idx++) { + result = SerializeAdapter::deSerialize(&blobsSet.xCoords[idx], &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&blobsSet.yCoords[idx], &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + } + blobsSet.setValidity(true, true); + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::handleCentroidTm(const uint8_t* rawFrame) { + ReturnValue_t result = statusFieldCheck(rawFrame); + if (result != returnvalue::OK) { + return result; + } + rawFrame += TICKS_OFFSET; + size_t remainingLen = fullPacketLen; + PoolReadGuard pg(¢roidsSet); + result = pg.getReadResult(); + if (result != returnvalue::OK) { + return result; + } + + result = SerializeAdapter::deSerialize(¢roidSet.ticks, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(¢roidSet.timeUs, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(¢roidSet.centroidCount, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + centroidSet.setValidity(true, true); + return returnvalue::OK; +} + +ReturnValue_t StarTrackerHandler::handleCentroidsTm(const uint8_t* rawFrame) { + ReturnValue_t result = statusFieldCheck(rawFrame); + if (result != returnvalue::OK) { + return result; + } + rawFrame += TICKS_OFFSET; + size_t remainingLen = fullPacketLen; + PoolReadGuard pg(¢roidsSet); + result = pg.getReadResult(); + if (result != returnvalue::OK) { + return result; + } + + result = SerializeAdapter::deSerialize(¢roidsSet.ticksCentroidsTm, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(¢roidsSet.timeUsCentroidsTm, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(¢roidsSet.centroidsCount, &rawFrame, &remainingLen, + SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + for (unsigned idx = 0; idx < 16; idx++) { + result = SerializeAdapter::deSerialize(¢roidsSet.centroidsXCoords[idx], &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(¢roidsSet.centroidsYCoords[idx], &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(¢roidsSet.centroidsMagnitudes[idx], &rawFrame, + &remainingLen, SerializeIF::Endianness::LITTLE); + if (result != returnvalue::OK) { + return result; + } + } + centroidsSet.setValidity(true, true); + return returnvalue::OK; +} + ReturnValue_t StarTrackerHandler::handleActionReplySet(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, size_t size) { ReturnValue_t result = returnvalue::OK; @@ -2204,10 +2789,17 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) { case startracker::REQ_SUBSCRIPTION: case startracker::REQ_LOG_SUBSCRIPTION: case startracker::REQ_DEBUG_CAMERA: + case startracker::REQ_MATCHED_CENTROIDS: + case startracker::REQ_BLOB: + case startracker::REQ_BLOBS: + case startracker::REQ_CENTROID: + case startracker::REQ_CENTROIDS: + case startracker::REQ_CONTRAST: { if (getMode() == MODE_ON and getSubmode() != startracker::Program::FIRMWARE) { return STARTRACKER_NOT_RUNNING_FIRMWARE; } break; + } case startracker::FIRMWARE_UPDATE: case startracker::FLASH_READ: if (getMode() != MODE_ON or getSubmode() != startracker::Program::BOOTLOADER) { diff --git a/mission/acs/str/StarTrackerHandler.h b/mission/acs/str/StarTrackerHandler.h index 1e790695..3bfdc8fd 100644 --- a/mission/acs/str/StarTrackerHandler.h +++ b/mission/acs/str/StarTrackerHandler.h @@ -8,6 +8,7 @@ #include #include +#include #include #include "OBSWConfig.h" @@ -151,6 +152,7 @@ class StarTrackerHandler : public DeviceHandlerBase { static const uint8_t PARAMS_OFFSET = 2; static const uint8_t TICKS_OFFSET = 3; static const uint8_t TIME_OFFSET = 7; + static const uint8_t TM_PARAM_OFFSET = 15; static const uint8_t PARAMETER_ID_OFFSET = 1; static const uint8_t ACTION_ID_OFFSET = 1; static const uint8_t ACTION_DATA_OFFSET = 3; @@ -204,6 +206,13 @@ class StarTrackerHandler : public DeviceHandlerBase { startracker::SubscriptionSet subscriptionSet; startracker::LogSubscriptionSet logSubscriptionSet; startracker::DebugCameraSet debugCameraSet; + startracker::AutoBlobSet autoBlobSet; + startracker::MatchedCentroidsSet matchedCentroidsSet; + startracker::BlobSet blobSet; + startracker::BlobsSet blobsSet; + startracker::CentroidSet centroidSet; + startracker::CentroidsSet centroidsSet; + startracker::ContrastSet contrastSet; // Pointer to object responsible for uploading and downloading images to/from the star tracker StrComHandler* strHelper = nullptr; @@ -239,9 +248,9 @@ class StarTrackerHandler : public DeviceHandlerBase { std::string paramJsonFile; - enum class NormalState { TEMPERATURE_REQUEST, SOLUTION_REQUEST }; + enum class NormalState { SECONDARY_REQUEST, SOLUTION_REQUEST }; - NormalState normalState = NormalState::TEMPERATURE_REQUEST; + NormalState normalState = NormalState::SECONDARY_REQUEST; enum class StartupState { IDLE, @@ -297,6 +306,11 @@ class StarTrackerHandler : public DeviceHandlerBase { const power::Switch_t powerSwitch = power::NO_SWITCH; + size_t fullPacketLen = 0; + + std::set additionalRequestedTm{}; + std::set::iterator currentSecondaryTmIter; + /** * @brief Handles internal state */ @@ -345,6 +359,18 @@ class StarTrackerHandler : public DeviceHandlerBase { */ ReturnValue_t executeFlashReadCommand(const uint8_t* commandData, size_t commandDataLen); + /** + * Add a TM request to the list of telemetry which will be polled in the secondary step of + * the device communication. + * @param cmd + */ + void addSecondaryTmForNormalMode(DeviceCommandId_t cmd); + + /** + * Reset the secondary set, which will only contain a TEMPERATURE set request after the reset. + */ + void resetSecondaryTmSet(); + /** * @brief Fills command buffer with data to boot image (works only when star tracker is * in bootloader mode). @@ -429,6 +455,13 @@ class StarTrackerHandler : public DeviceHandlerBase { ReturnValue_t prepareRequestCentroidingParams(); ReturnValue_t prepareRequestLisaParams(); ReturnValue_t prepareRequestMatchingParams(); + ReturnValue_t prepareRequestAutoBlobTm(); + ReturnValue_t prepareRequestMatchedCentroidsTm(); + ReturnValue_t prepareRequestBlobTm(); + ReturnValue_t prepareRequestBlobsTm(); + ReturnValue_t prepareRequestCentroidTm(); + ReturnValue_t prepareRequestCentroidsTm(); + ReturnValue_t prepareRequestContrastTm(); ReturnValue_t prepareRequestTrackingParams(); ReturnValue_t prepareRequestValidationParams(); ReturnValue_t prepareRequestAlgoParams(); @@ -477,6 +510,7 @@ class StarTrackerHandler : public DeviceHandlerBase { */ void handleStartup(uint8_t tmType, uint8_t parameterId); + ReturnValue_t statusFieldCheck(const uint8_t* rawFrame); /** * @brief Handles telemtry replies and fills the appropriate dataset * @@ -485,9 +519,16 @@ class StarTrackerHandler : public DeviceHandlerBase { * * @return returnvalue::OK if successful, otherwise error return value */ - ReturnValue_t handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, size_t size, + ReturnValue_t handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, const char* context); + ReturnValue_t handleAutoBlobTm(const uint8_t* rawFrame); + ReturnValue_t handleMatchedCentroidTm(const uint8_t* rawFrame); + ReturnValue_t handleBlobTm(const uint8_t* rawFrame); + ReturnValue_t handleBlobsTm(const uint8_t* rawFrame); + ReturnValue_t handleCentroidTm(const uint8_t* rawFrame); + ReturnValue_t handleCentroidsTm(const uint8_t* rawFrame); + /** * @brief Checks if star tracker is in valid mode for executing the received command. * diff --git a/mission/acs/str/strHelpers.h b/mission/acs/str/strHelpers.h index c6336186..808d6060 100644 --- a/mission/acs/str/strHelpers.h +++ b/mission/acs/str/strHelpers.h @@ -272,7 +272,50 @@ enum PoolIds : lp_id_t { LOG_SUBSCRIPTION_LEVEL2, LOG_SUBSCRIPTION_MODULE2, DEBUG_CAMERA_TIMING, - DEBUG_CAMERA_TEST + DEBUG_CAMERA_TEST, + + TICKS_AUTO_BLOB, + TIME_AUTO_BLOB, + AUTO_BLOB_THRESHOLD, + + TICKS_MATCHED_CENTROIDS, + TIME_MATCHED_CENTROIDS, + NUM_MATCHED_CENTROIDS, + MATCHED_CENTROIDS_STAR_IDS, + MATCHED_CENTROIDS_X_COORDS, + MATCHED_CENTROIDS_Y_COORDS, + MATCHED_CENTROIDS_X_ERRORS, + MATCHED_CENTROIDS_Y_ERRORS, + + BLOB_TICKS, + BLOB_TIME, + BLOB_COUNT, + + BLOBS_TICKS, + BLOBS_TIME, + BLOBS_COUNT, + BLOBS_COUNT_USED, + BLOBS_NR_4LINES_SKIPPED, + BLOBS_X_COORDS, + BLOBS_Y_COORDS, + + CENTROID_TICKS, + CENTROID_TIME, + CENTROID_COUNT, + + CENTROIDS_TICKS, + CENTROIDS_TIME, + CENTROIDS_COUNT, + CENTROIDS_X_COORDS, + CENTROIDS_Y_COORDS, + CENTROIDS_MAGNITUDES, + + CONTRAST_TICKS, + CONTRAST_TIME, + CONTRAST_A, + CONTRAST_B, + CONTRAST_C, + CONTRAST_D, }; static const DeviceCommandId_t PING_REQUEST = 0; @@ -291,6 +334,7 @@ static const DeviceCommandId_t IMAGE_PROCESSOR = 19; static const DeviceCommandId_t REQ_SOLUTION = 24; static const DeviceCommandId_t REQ_TEMPERATURE = 25; static const DeviceCommandId_t REQ_HISTOGRAM = 28; +static constexpr DeviceCommandId_t REQ_CONTRAST = 29; static const DeviceCommandId_t LIMITS = 40; static const DeviceCommandId_t MOUNTING = 41; static const DeviceCommandId_t CAMERA = 42; @@ -328,6 +372,15 @@ static const DeviceCommandId_t DISABLE_TIMESTAMP_GENERATION = 85; static const DeviceCommandId_t ENABLE_TIMESTAMP_GENERATION = 86; static constexpr DeviceCommandId_t SET_TIME_FROM_SYS_TIME = 87; static constexpr DeviceCommandId_t AUTO_THRESHOLD = 88; +static constexpr DeviceCommandId_t REQ_AUTO_BLOB = 89; +static constexpr DeviceCommandId_t REQ_MATCHED_CENTROIDS = 90; +static constexpr DeviceCommandId_t REQ_BLOB = 91; +static constexpr DeviceCommandId_t REQ_BLOBS = 92; +static constexpr DeviceCommandId_t REQ_CENTROID = 93; +static constexpr DeviceCommandId_t REQ_CENTROIDS = 94; +static constexpr DeviceCommandId_t ADD_SECONDARY_TM_TO_NORMAL_MODE = 95; +static constexpr DeviceCommandId_t RESET_SECONDARY_TM_SET = 96; +static constexpr DeviceCommandId_t READ_SECONDARY_TM_SET = 97; static const DeviceCommandId_t NONE = 0xFFFFFFFF; static const uint32_t VERSION_SET_ID = REQ_VERSION; @@ -352,6 +405,13 @@ 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; +static const uint32_t AUTO_BLOB_SET_ID = REQ_AUTO_BLOB; +static const uint32_t MATCHED_CENTROIDS_SET_ID = REQ_MATCHED_CENTROIDS; +static const uint32_t BLOB_SET_ID = REQ_BLOB; +static const uint32_t BLOBS_SET_ID = REQ_BLOBS; +static const uint32_t CENTROID_SET_ID = REQ_CENTROID; +static const uint32_t CENTROIDS_SET_ID = REQ_CENTROIDS; +static const uint32_t CONTRAST_SET_ID = REQ_CONTRAST; /** Max size of unencoded frame */ static const size_t MAX_FRAME_SIZE = 1200; @@ -412,6 +472,12 @@ static const uint8_t LOG_LEVEL = 3; static const uint8_t LOG_SUBSCRIPTION = 19; static const uint8_t DEBUG_CAMERA = 20; static const uint8_t AUTO_THRESHOLD = 23; +static constexpr uint8_t BLOB = 25; +static constexpr uint8_t BLOBS = 36; +static constexpr uint8_t CENTROID = 26; +static constexpr uint8_t CENTROIDS = 37; +static constexpr uint8_t AUTO_BLOB = 39; +static constexpr uint8_t MATCHED_CENTROIDS = 40; } // namespace ID namespace Program { @@ -474,8 +540,6 @@ static const uint32_t FLASH_REGION_SIZE = 0x20000; */ class TemperatureSet : public StaticLocalDataSet { public: - static const size_t SIZE = 24; - TemperatureSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TEMPERATURE_SET_ID) {} TemperatureSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TEMPERATURE_SET_ID)) {} @@ -505,8 +569,6 @@ class TemperatureSet : public StaticLocalDataSet { */ class VersionSet : public StaticLocalDataSet { public: - static const size_t SIZE = 15; - VersionSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, VERSION_SET_ID) {} VersionSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, VERSION_SET_ID)) {} @@ -536,8 +598,6 @@ class VersionSet : public StaticLocalDataSet { */ class InterfaceSet : public StaticLocalDataSet { public: - static const size_t SIZE = 20; - InterfaceSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, REQ_INTERFACE) {} InterfaceSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, REQ_INTERFACE)) {} @@ -565,8 +625,6 @@ class InterfaceSet : public StaticLocalDataSet { */ class PowerSet : public StaticLocalDataSet { public: - static const size_t SIZE = 76; - PowerSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, REQ_INTERFACE) {} PowerSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, REQ_INTERFACE)) {} @@ -630,8 +688,6 @@ class PowerSet : public StaticLocalDataSet { */ class TimeSet : public StaticLocalDataSet { public: - static const size_t SIZE = 24; - TimeSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TIME_SET_ID) {} TimeSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TIME_SET_ID)) {} @@ -658,15 +714,13 @@ class TimeSet : public StaticLocalDataSet { */ class SolutionSet : public StaticLocalDataSet { public: - static const size_t SIZE = 79; - SolutionSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SOLUTION_SET_ID) {} SolutionSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, SOLUTION_SET_ID)) {} // Ticks timestamp lp_var_t ticks = lp_var_t(sid.objectId, PoolIds::TICKS_SOLUTION_SET, this); - /// Unix time stamp + // Unix time stamp lp_var_t timeUs = lp_var_t(sid.objectId, PoolIds::TIME_SOLUTION_SET, this); // Calibrated quaternion (takes into account the mounting quaternion), typically same as // track q values @@ -1381,6 +1435,123 @@ class ValidationSet : public StaticLocalDataSet { } }; +class AutoBlobSet : public StaticLocalDataSet<3> { + public: + AutoBlobSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, AUTO_BLOB_SET_ID) {} + // Ticks timestamp + lp_var_t ticks = lp_var_t(sid.objectId, PoolIds::TICKS_AUTO_BLOB, this); + // Unix time stamp + lp_var_t timeUs = lp_var_t(sid.objectId, PoolIds::TIME_AUTO_BLOB, this); + lp_var_t threshold = lp_var_t(sid.objectId, PoolIds::AUTO_BLOB_THRESHOLD, this); + + private: +}; + +class MatchedCentroidsSet : public StaticLocalDataSet<20> { + public: + MatchedCentroidsSet(HasLocalDataPoolIF* owner) + : StaticLocalDataSet(owner, MATCHED_CENTROIDS_SET_ID) {} + MatchedCentroidsSet(object_id_t objectId) + : StaticLocalDataSet(sid_t(objectId, MATCHED_CENTROIDS_SET_ID)) {} + // Ticks timestamp + lp_var_t ticks = + lp_var_t(sid.objectId, PoolIds::TICKS_MATCHED_CENTROIDS, this); + // Unix time stamp + lp_var_t timeUs = + lp_var_t(sid.objectId, PoolIds::TIME_MATCHED_CENTROIDS, this); + lp_var_t numberOfMatchedCentroids = + lp_var_t(sid.objectId, PoolIds::NUM_MATCHED_CENTROIDS, this); + lp_vec_t starIds = + lp_vec_t(sid.objectId, PoolIds::MATCHED_CENTROIDS_STAR_IDS, this); + lp_vec_t xCoords = + lp_vec_t(sid.objectId, PoolIds::MATCHED_CENTROIDS_X_COORDS, this); + lp_vec_t yCoords = + lp_vec_t(sid.objectId, PoolIds::MATCHED_CENTROIDS_Y_COORDS, this); + lp_vec_t xErrors = + lp_vec_t(sid.objectId, PoolIds::MATCHED_CENTROIDS_X_ERRORS, this); + lp_vec_t yErrors = + lp_vec_t(sid.objectId, PoolIds::MATCHED_CENTROIDS_Y_ERRORS, this); + + private: +}; + +class BlobSet : public StaticLocalDataSet<5> { + public: + BlobSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, BLOB_SET_ID) {} + // The blob count received from the Blob Telemetry Set (ID 25) + // Ticks timestamp + lp_var_t ticks = lp_var_t(sid.objectId, PoolIds::BLOB_TICKS, this); + // Unix time stamp + lp_var_t timeUs = lp_var_t(sid.objectId, PoolIds::BLOB_TIME, this); + lp_var_t blobCount = lp_var_t(sid.objectId, PoolIds::BLOB_COUNT, this); +}; + +class BlobsSet : public StaticLocalDataSet<10> { + public: + BlobsSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, BLOBS_SET_ID) {} + // Ticks timestamp + lp_var_t ticks = lp_var_t(sid.objectId, PoolIds::BLOBS_TICKS, this); + // Unix time stamp + lp_var_t timeUs = lp_var_t(sid.objectId, PoolIds::BLOBS_TIME, this); + lp_var_t blobsCount = lp_var_t(sid.objectId, PoolIds::BLOBS_COUNT, this); + lp_var_t blobsCountUsed = + lp_var_t(sid.objectId, PoolIds::BLOBS_COUNT_USED, this); + lp_var_t nr4LinesSkipped = + lp_var_t(sid.objectId, PoolIds::BLOBS_NR_4LINES_SKIPPED, this); + lp_vec_t xCoords = + lp_vec_t(sid.objectId, PoolIds::BLOBS_X_COORDS, this); + lp_vec_t yCoords = + lp_vec_t(sid.objectId, PoolIds::BLOBS_Y_COORDS, this); +}; + +class CentroidSet : public StaticLocalDataSet<5> { + public: + CentroidSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, CENTROID_SET_ID) {} + + // Data received from the Centroid Telemetry Set (ID 26) + // Ticks timestamp + lp_var_t ticks = lp_var_t(sid.objectId, PoolIds::CENTROID_TICKS, this); + // Unix time stamp + lp_var_t timeUs = lp_var_t(sid.objectId, PoolIds::CENTROID_TIME, this); + // The centroid count received from the Centroid Telemetry Set (ID 26) + lp_var_t centroidCount = + lp_var_t(sid.objectId, PoolIds::CENTROID_COUNT, this); +}; + +class CentroidsSet : public StaticLocalDataSet<10> { + public: + CentroidsSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, CENTROIDS_SET_ID) {} + + // Data received from the Centroids Telemetry Set (ID 37) + lp_var_t ticksCentroidsTm = + lp_var_t(sid.objectId, PoolIds::CENTROIDS_TICKS, this); + // Unix time stamp + lp_var_t timeUsCentroidsTm = + lp_var_t(sid.objectId, PoolIds::CENTROIDS_TIME, this); + lp_var_t centroidsCount = + lp_var_t(sid.objectId, PoolIds::CENTROIDS_COUNT, this); + lp_vec_t centroidsXCoords = + lp_vec_t(sid.objectId, PoolIds::CENTROIDS_X_COORDS, this); + lp_vec_t centroidsYCoords = + lp_vec_t(sid.objectId, PoolIds::CENTROIDS_Y_COORDS, this); + lp_vec_t centroidsMagnitudes = + lp_vec_t(sid.objectId, PoolIds::CENTROIDS_MAGNITUDES, this); +}; + +class ContrastSet : public StaticLocalDataSet<8> { + public: + ContrastSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, CONTRAST_SET_ID) {} + + // Data received from the Centroids Telemetry Set (ID 29) + lp_var_t ticks = lp_var_t(sid.objectId, PoolIds::CONTRAST_TICKS, this); + // Unix time stamp + lp_var_t timeUs = lp_var_t(sid.objectId, PoolIds::CONTRAST_TIME, this); + lp_vec_t contrastA = lp_vec_t(sid.objectId, PoolIds::CONTRAST_A, this); + lp_vec_t contrastB = lp_vec_t(sid.objectId, PoolIds::CONTRAST_B, this); + lp_vec_t contrastC = lp_vec_t(sid.objectId, PoolIds::CONTRAST_C, this); + lp_vec_t contrastD = lp_vec_t(sid.objectId, PoolIds::CONTRAST_D, this); +}; + /** * @brief Will store the requested algo parameters */ diff --git a/tmtc b/tmtc index 43d6b986..0aaf6321 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 43d6b986953a815c7c020cf73a957f1678c76549 +Subproject commit 0aaf63215b5fe010a5447e5d64e1b4150d543847