Compare commits
1 Commits
develop_up
...
9903371ae9
Author | SHA1 | Date | |
---|---|---|---|
9903371ae9 |
8
.idea/cmake.xml
generated
8
.idea/cmake.xml
generated
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CMakeSharedSettings">
|
|
||||||
<configurations>
|
|
||||||
<configuration PROFILE_NAME="Debug Test" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DFSFW_BUILD_TESTS=ON -DFSFW_OSAL=host" />
|
|
||||||
</configurations>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -10,8 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
- The `PusTmCreator` API only accepted 255 bytes of source data. It can now accept source
|
|
||||||
data with a size limited only by the size of `size_t`.
|
|
||||||
- Important bugfix in CFDP PDU header format: The entity length field and the transaction sequence
|
- Important bugfix in CFDP PDU header format: The entity length field and the transaction sequence
|
||||||
number fields stored the actual length of the field instead of the length minus 1 like specified
|
number fields stored the actual length of the field instead of the length minus 1 like specified
|
||||||
in the CFDP standard.
|
in the CFDP standard.
|
||||||
@ -27,11 +26,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
- add CFDP subsystem ID
|
- add CFDP subsystem ID
|
||||||
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
|
||||||
- `PusTmZcWriter` now exposes API to set message counter field.
|
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
- HK generation is now countdown based.
|
|
||||||
- Bump ETL version to 20.35.14
|
- Bump ETL version to 20.35.14
|
||||||
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/748
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/748
|
||||||
- Renamed `PCDU_2` subsystem ID to `POWER_SWITCH_IF`.
|
- Renamed `PCDU_2` subsystem ID to `POWER_SWITCH_IF`.
|
||||||
|
@ -166,9 +166,9 @@ ReturnValue_t Sgp4Propagator::propagate(double* position, double* velocity, time
|
|||||||
timeval timeSinceEpoch = time - epoch;
|
timeval timeSinceEpoch = time - epoch;
|
||||||
double minutesSinceEpoch = timeSinceEpoch.tv_sec / 60. + timeSinceEpoch.tv_usec / 60000000.;
|
double minutesSinceEpoch = timeSinceEpoch.tv_sec / 60. + timeSinceEpoch.tv_usec / 60000000.;
|
||||||
|
|
||||||
double monthsSinceEpoch = minutesSinceEpoch / 60 / 24 / 30;
|
double yearsSinceEpoch = minutesSinceEpoch / 60 / 24 / 365;
|
||||||
|
|
||||||
if ((monthsSinceEpoch > 1) || (monthsSinceEpoch < -1)) {
|
if ((yearsSinceEpoch > 1) || (yearsSinceEpoch < -1)) {
|
||||||
return TLE_TOO_OLD;
|
return TLE_TOO_OLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,9 +53,8 @@ class VectorOperations {
|
|||||||
mulScalar(vector, 1 / norm(vector, size), normalizedVector, size);
|
mulScalar(vector, 1 / norm(vector, size), normalizedVector, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static T maxAbsValue(const T *vector, uint8_t size, uint8_t *index = nullptr) {
|
static T maxAbsValue(const T *vector, uint8_t size, uint8_t *index = 0) {
|
||||||
T max = vector[size - 1];
|
T max = -1;
|
||||||
uint8_t foundIndex = size - 1;
|
|
||||||
|
|
||||||
for (; size > 0; size--) {
|
for (; size > 0; size--) {
|
||||||
T abs = vector[size - 1];
|
T abs = vector[size - 1];
|
||||||
@ -65,35 +64,24 @@ class VectorOperations {
|
|||||||
if (abs > max) {
|
if (abs > max) {
|
||||||
max = abs;
|
max = abs;
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
foundIndex = size - 1;
|
*index = size - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index != nullptr) {
|
|
||||||
*index = foundIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
static T maxValue(const T *vector, uint8_t size, uint8_t *index = nullptr) {
|
static T maxValue(const T *vector, uint8_t size, uint8_t *index = 0) {
|
||||||
T max = vector[size - 1];
|
T max = -1;
|
||||||
uint8_t foundIndex = size - 1;
|
|
||||||
|
|
||||||
for (; size > 0; size--) {
|
for (; size > 0; size--) {
|
||||||
if (vector[size - 1] > max) {
|
if (vector[size - 1] > max) {
|
||||||
max = vector[size - 1];
|
max = vector[size - 1];
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
foundIndex = size - 1;
|
*index = size - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index != nullptr) {
|
|
||||||
*index = foundIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "fsfw/datapoollocal/LocalPoolDataSetBase.h"
|
#include "fsfw/datapoollocal/LocalPoolDataSetBase.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
PeriodicHousekeepingHelper::PeriodicHousekeepingHelper(LocalPoolDataSetBase* owner)
|
PeriodicHousekeepingHelper::PeriodicHousekeepingHelper(LocalPoolDataSetBase* owner)
|
||||||
: owner(owner) {}
|
: owner(owner) {}
|
||||||
@ -11,29 +10,51 @@ PeriodicHousekeepingHelper::PeriodicHousekeepingHelper(LocalPoolDataSetBase* own
|
|||||||
void PeriodicHousekeepingHelper::initialize(float collectionInterval,
|
void PeriodicHousekeepingHelper::initialize(float collectionInterval,
|
||||||
dur_millis_t minimumPeriodicInterval) {
|
dur_millis_t minimumPeriodicInterval) {
|
||||||
this->minimumPeriodicInterval = minimumPeriodicInterval;
|
this->minimumPeriodicInterval = minimumPeriodicInterval;
|
||||||
changeCollectionInterval(collectionInterval);
|
collectionIntervalTicks = intervalSecondsToIntervalTicks(collectionInterval);
|
||||||
|
/* This will cause a checkOpNecessary call to be true immediately. I think it's okay
|
||||||
|
if a HK packet is generated immediately instead of waiting one generation cycle. */
|
||||||
|
internalTickCounter = collectionIntervalTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
float PeriodicHousekeepingHelper::getCollectionIntervalInSeconds() const {
|
float PeriodicHousekeepingHelper::getCollectionIntervalInSeconds() const {
|
||||||
return collectionInterval;
|
return intervalTicksToSeconds(collectionIntervalTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PeriodicHousekeepingHelper::checkOpNecessary() {
|
bool PeriodicHousekeepingHelper::checkOpNecessary() {
|
||||||
if (hkGenerationCd.hasTimedOut()) {
|
if (internalTickCounter >= collectionIntervalTicks) {
|
||||||
hkGenerationCd.resetTimer();
|
internalTickCounter = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
internalTickCounter++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeriodicHousekeepingHelper::changeCollectionInterval(float newIntervalSeconds) {
|
uint32_t PeriodicHousekeepingHelper::intervalSecondsToIntervalTicks(
|
||||||
uint32_t intervalMs = newIntervalSeconds * 1000;
|
float collectionIntervalSeconds) {
|
||||||
if (newIntervalSeconds <= 0) {
|
if (owner == nullptr) {
|
||||||
intervalMs = minimumPeriodicInterval;
|
return 0;
|
||||||
newIntervalSeconds = static_cast<float>(minimumPeriodicInterval) / 1000.0;
|
}
|
||||||
|
|
||||||
|
/* Avoid division by zero */
|
||||||
|
if (minimumPeriodicInterval == 0) {
|
||||||
|
/* Perform operation each cycle */
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dur_millis_t intervalInMs = collectionIntervalSeconds * 1000;
|
||||||
|
uint32_t divisor = minimumPeriodicInterval;
|
||||||
|
uint32_t ticks = std::ceil(static_cast<float>(intervalInMs) / divisor);
|
||||||
|
|
||||||
|
return ticks;
|
||||||
}
|
}
|
||||||
collectionInterval = newIntervalSeconds;
|
}
|
||||||
hkGenerationCd.setTimeout(intervalMs);
|
|
||||||
// We want an immediate HK packet at the start, so time out the generation CD immediately.
|
float PeriodicHousekeepingHelper::intervalTicksToSeconds(uint32_t collectionInterval) const {
|
||||||
hkGenerationCd.timeOut();
|
/* Number of ticks times the minimum interval is in milliseconds, so we divide by 1000 to get
|
||||||
|
the value in seconds */
|
||||||
|
return static_cast<float>(collectionInterval * minimumPeriodicInterval / 1000.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PeriodicHousekeepingHelper::changeCollectionInterval(float newIntervalSeconds) {
|
||||||
|
collectionIntervalTicks = intervalSecondsToIntervalTicks(newIntervalSeconds);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
#include "fsfw/timemanager/Countdown.h"
|
|
||||||
|
|
||||||
class LocalPoolDataSetBase;
|
class LocalPoolDataSetBase;
|
||||||
|
|
||||||
@ -20,10 +19,13 @@ class PeriodicHousekeepingHelper {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
LocalPoolDataSetBase* owner = nullptr;
|
LocalPoolDataSetBase* owner = nullptr;
|
||||||
Countdown hkGenerationCd;
|
|
||||||
float collectionInterval = 0.0;
|
uint32_t intervalSecondsToIntervalTicks(float collectionIntervalSeconds);
|
||||||
|
float intervalTicksToSeconds(uint32_t collectionInterval) const;
|
||||||
|
|
||||||
dur_millis_t minimumPeriodicInterval = 0;
|
dur_millis_t minimumPeriodicInterval = 0;
|
||||||
|
uint32_t internalTickCounter = 1;
|
||||||
|
uint32_t collectionIntervalTicks = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_ */
|
#endif /* FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_ */
|
||||||
|
@ -5,12 +5,9 @@
|
|||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId, uint32_t messageQueueDepth,
|
InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId, uint32_t messageQueueDepth)
|
||||||
bool enableSetByDefault, float generationFrequency)
|
|
||||||
: SystemObject(setObjectId),
|
: SystemObject(setObjectId),
|
||||||
poolManager(this, commandQueue),
|
poolManager(this, commandQueue),
|
||||||
enableSetByDefault(enableSetByDefault),
|
|
||||||
generationFrequency(generationFrequency),
|
|
||||||
internalErrorSid(setObjectId, InternalErrorDataset::ERROR_SET_ID),
|
internalErrorSid(setObjectId, InternalErrorDataset::ERROR_SET_ID),
|
||||||
internalErrorDataset(this) {
|
internalErrorDataset(this) {
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
commandQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
|
||||||
@ -137,8 +134,9 @@ ReturnValue_t InternalErrorReporter::initializeLocalDataPool(localpool::DataPool
|
|||||||
localDataPoolMap.emplace(errorPoolIds::TM_HITS, &tmHitsEntry);
|
localDataPoolMap.emplace(errorPoolIds::TM_HITS, &tmHitsEntry);
|
||||||
localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, &queueHitsEntry);
|
localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, &queueHitsEntry);
|
||||||
localDataPoolMap.emplace(errorPoolIds::STORE_HITS, &storeHitsEntry);
|
localDataPoolMap.emplace(errorPoolIds::STORE_HITS, &storeHitsEntry);
|
||||||
poolManager.subscribeForRegularPeriodicPacket(
|
poolManager.subscribeForDiagPeriodicPacket(subdp::DiagnosticsHkPeriodicParams(
|
||||||
subdp::RegularHkPeriodicParams(internalErrorSid, enableSetByDefault, generationFrequency));
|
internalErrorSid, false,
|
||||||
|
static_cast<float>(getPeriodicOperationFrequency()) / static_cast<float>(1000.0)));
|
||||||
internalErrorDataset.setValidity(true, true);
|
internalErrorDataset.setValidity(true, true);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@ class InternalErrorReporter : public SystemObject,
|
|||||||
public InternalErrorReporterIF,
|
public InternalErrorReporterIF,
|
||||||
public HasLocalDataPoolIF {
|
public HasLocalDataPoolIF {
|
||||||
public:
|
public:
|
||||||
InternalErrorReporter(object_id_t setObjectId, uint32_t messageQueueDepth,
|
InternalErrorReporter(object_id_t setObjectId, uint32_t messageQueueDepth = 5);
|
||||||
bool enableSetByDefault, float generationFrequency);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable diagnostic printout. Please note that this feature will
|
* Enable diagnostic printout. Please note that this feature will
|
||||||
@ -64,8 +63,6 @@ class InternalErrorReporter : public SystemObject,
|
|||||||
MutexIF* mutex = nullptr;
|
MutexIF* mutex = nullptr;
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||||
uint32_t timeoutMs = 20;
|
uint32_t timeoutMs = 20;
|
||||||
bool enableSetByDefault;
|
|
||||||
float generationFrequency;
|
|
||||||
|
|
||||||
sid_t internalErrorSid;
|
sid_t internalErrorSid;
|
||||||
InternalErrorDataset internalErrorDataset;
|
InternalErrorDataset internalErrorDataset;
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#include "fsfw/pus/servicepackets/Service3Packets.h"
|
#include "fsfw/pus/servicepackets/Service3Packets.h"
|
||||||
|
|
||||||
Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId,
|
||||||
uint32_t queueDepth, uint8_t numParallelCommands)
|
uint32_t queueDepth)
|
||||||
: CommandingServiceBase(objectId, apid, "PUS 3 HK", serviceId, numParallelCommands,
|
: CommandingServiceBase(objectId, apid, "PUS 3 HK", serviceId, NUM_OF_PARALLEL_COMMANDS,
|
||||||
COMMAND_TIMEOUT_SECONDS, queueDepth) {}
|
COMMAND_TIMEOUT_SECONDS, queueDepth) {}
|
||||||
|
|
||||||
Service3Housekeeping::~Service3Housekeeping() {}
|
Service3Housekeeping::~Service3Housekeeping() {}
|
||||||
|
@ -28,8 +28,7 @@ class Service3Housekeeping : public CommandingServiceBase, public AcceptsHkPacke
|
|||||||
static constexpr uint8_t NUM_OF_PARALLEL_COMMANDS = 4;
|
static constexpr uint8_t NUM_OF_PARALLEL_COMMANDS = 4;
|
||||||
static constexpr uint16_t COMMAND_TIMEOUT_SECONDS = 60;
|
static constexpr uint16_t COMMAND_TIMEOUT_SECONDS = 60;
|
||||||
|
|
||||||
Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint32_t queueDepth,
|
Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint32_t queueDepth);
|
||||||
uint8_t numParallelCommands);
|
|
||||||
virtual ~Service3Housekeeping();
|
virtual ~Service3Housekeeping();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -40,7 +40,7 @@ struct PusTmParams {
|
|||||||
size_t dataLen)
|
size_t dataLen)
|
||||||
: secHeader(service, subservice, timeStamper), adapter(data, dataLen), sourceData(&adapter) {}
|
: secHeader(service, subservice, timeStamper), adapter(data, dataLen), sourceData(&adapter) {}
|
||||||
PusTmSecHeader secHeader;
|
PusTmSecHeader secHeader;
|
||||||
SerialBufferAdapter<size_t> adapter;
|
SerialBufferAdapter<uint8_t> adapter;
|
||||||
const SerializeIF* sourceData = nullptr;
|
const SerializeIF* sourceData = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,9 +24,3 @@ void PusTmZeroCopyWriter::updateErrorControl() {
|
|||||||
crcStart[0] = (crc16 >> 8) & 0xff;
|
crcStart[0] = (crc16 >> 8) & 0xff;
|
||||||
crcStart[1] = crc16 & 0xff;
|
crcStart[1] = crc16 & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PusTmZeroCopyWriter::setMessageCount(uint16_t msgCount) {
|
|
||||||
size_t serSize = 0;
|
|
||||||
SerializeAdapter::serialize(&msgCount, const_cast<uint8_t*>(pointers.secHeaderStart + 3),
|
|
||||||
&serSize, 2, SerializeIF::Endianness::NETWORK);
|
|
||||||
}
|
|
||||||
|
@ -14,7 +14,6 @@ class PusTmZeroCopyWriter : public PusTmReader {
|
|||||||
PusTmZeroCopyWriter(TimeReaderIF& timeReader, uint8_t* data, size_t size);
|
PusTmZeroCopyWriter(TimeReaderIF& timeReader, uint8_t* data, size_t size);
|
||||||
|
|
||||||
void setSequenceCount(uint16_t seqCount);
|
void setSequenceCount(uint16_t seqCount);
|
||||||
void setMessageCount(uint16_t msgCount);
|
|
||||||
void updateErrorControl();
|
void updateErrorControl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -73,10 +73,8 @@ static constexpr uint8_t CTRL_REG_4_VAL = SET_BLE;
|
|||||||
/* Register 5 */
|
/* Register 5 */
|
||||||
static constexpr uint8_t SET_REBOOT_MEM = 1 << 7;
|
static constexpr uint8_t SET_REBOOT_MEM = 1 << 7;
|
||||||
static constexpr uint8_t SET_FIFO_ENB = 1 << 6;
|
static constexpr uint8_t SET_FIFO_ENB = 1 << 6;
|
||||||
static constexpr uint8_t SET_OUT_SEL_1 = 1 << 1;
|
|
||||||
static constexpr uint8_t SET_OUT_SEL_0 = 1 << 0;
|
|
||||||
|
|
||||||
static constexpr uint8_t CTRL_REG_5_VAL = SET_OUT_SEL_1 | SET_OUT_SEL_0;
|
static constexpr uint8_t CTRL_REG_5_VAL = 0b00000000;
|
||||||
|
|
||||||
/* Possible range values in degrees per second (DPS). */
|
/* Possible range values in degrees per second (DPS). */
|
||||||
static constexpr uint16_t RANGE_DPS_00 = 245;
|
static constexpr uint16_t RANGE_DPS_00 = 245;
|
||||||
|
@ -165,8 +165,7 @@ ReturnValue_t HostFilesystem::truncateFile(FilesystemParams params) {
|
|||||||
if (not filesystem::exists(path, e)) {
|
if (not filesystem::exists(path, e)) {
|
||||||
return FILE_DOES_NOT_EXIST;
|
return FILE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
// Specify truncation flug explicitely.
|
ofstream of(path);
|
||||||
ofstream of(path, std::ios::out | std::ios::trunc);
|
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ void Factory::produceFrameworkObjects(void* args) {
|
|||||||
setStaticFrameworkObjectIds();
|
setStaticFrameworkObjectIds();
|
||||||
new EventManager(objects::EVENT_MANAGER, 120);
|
new EventManager(objects::EVENT_MANAGER, 120);
|
||||||
new HealthTable(objects::HEALTH_TABLE);
|
new HealthTable(objects::HEALTH_TABLE);
|
||||||
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER, 20, false, 1.0);
|
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
||||||
|
|
||||||
{
|
{
|
||||||
PoolManager::LocalPoolConfig poolCfg = {{100, 16}, {50, 32}, {25, 64}, {15, 128}, {5, 1024}};
|
PoolManager::LocalPoolConfig poolCfg = {{100, 16}, {50, 32}, {25, 64}, {15, 128}, {5, 1024}};
|
||||||
|
Reference in New Issue
Block a user