Update
EIVE/eive-obsw/pipeline/pr-develop This commit looks good Details

- COM Subsystem now handles datarate config
- torquer config and comCfg moved to mission/config folder
- CCSDS Handler: Added default rate submode
This commit is contained in:
Robin Müller 2023-01-27 18:38:36 +01:00
parent 54e6c4826f
commit 13f3963f69
19 changed files with 145 additions and 53 deletions

View File

@ -17,6 +17,12 @@ change warranting a new major release:
# [unreleased]
## Added
- First COM subsystem implementation. It mirrors the Syrlinks mode/submodes but also takes
care of commanding the CCSDS handler. It expects the Syrlinks submodes as mode commands.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/358
# [v1.21.0] 2023-01-26
TMTC version: v2.5.0

View File

@ -44,8 +44,7 @@ ReturnValue_t dummy_pst::pst(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);

View File

@ -4,7 +4,6 @@
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include "OBSWConfig.h"
#include "mission/system/tree/comModeTree.h"
#include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "busConf.h"
@ -15,6 +14,7 @@
#include "linux/ObjectFactory.h"
#include "linux/callbacks/gpioCallbacks.h"
#include "mission/core/GenericFactory.h"
#include "mission/system/tree/comModeTree.h"
void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics();

View File

@ -7,3 +7,4 @@ add_subdirectory(tmtc)
add_subdirectory(system)
add_subdirectory(csp)
add_subdirectory(cfdp)
add_subdirectory(config)

View File

@ -18,7 +18,13 @@ enum Submode : uint8_t {
NUM_SUBMODES
};
enum class CcsdsSubmode : uint8_t { UNSET = 0, DATARATE_LOW = 1, DATARATE_HIGH = 2 };
enum class CcsdsSubmode : uint8_t {
UNSET = 0,
DATARATE_LOW = 1,
DATARATE_HIGH = 2,
DATARATE_DEFAULT = 3
};
enum class ParameterId : uint8_t { DATARATE = 0 };
} // namespace com

View File

@ -0,0 +1 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE comCfg.cpp torquer.cpp)

26
mission/config/comCfg.cpp Normal file
View File

@ -0,0 +1,26 @@
#include "comCfg.h"
#include <fsfw/ipc/MutexFactory.h>
#include <fsfw/ipc/MutexGuard.h>
com::Datarate DATARATE_CFG_RAW = com::Datarate::LOW_RATE_MODULATION_BPSK;
MutexIF* DATARATE_LOCK = nullptr;
MutexIF* lazyLock();
com::Datarate com::getCurrentDatarate() {
MutexGuard mg(lazyLock());
return DATARATE_CFG_RAW;
}
void com::setCurrentDatarate(com::Datarate newRate) {
MutexGuard mg(lazyLock());
DATARATE_CFG_RAW = newRate;
}
MutexIF* lazyLock() {
if (DATARATE_LOCK == nullptr) {
return MutexFactory::instance()->createMutex();
}
return DATARATE_LOCK;
}

15
mission/config/comCfg.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef MISSION_COMCFG_H_
#define MISSION_COMCFG_H_
#include <fsfw/ipc/MutexIF.h>
#include "mission/comDefs.h"
namespace com {
com::Datarate getCurrentDatarate();
void setCurrentDatarate(com::Datarate newRate);
} // namespace com
#endif /* MISSION_COMCFG_H_ */

View File

@ -2,7 +2,7 @@
#include <fsfw/datapool/PoolReadGuard.h>
#include "mission/devices/torquer.h"
#include "mission/config/torquer.h"
AcsController::AcsController(object_id_t objectId)
: ExtendedControllerBase(objectId),

View File

@ -20,7 +20,6 @@ target_sources(
SusHandler.cpp
PayloadPcduHandler.cpp
SolarArrayDeploymentHandler.cpp
ScexDeviceHandler.cpp
torquer.cpp)
ScexDeviceHandler.cpp)
add_subdirectory(devicedefinitions)

View File

@ -25,7 +25,7 @@
#include <cmath>
#include <fsfw/datapoollocal/LocalPoolVariable.tpp>
#include "mission/devices/torquer.h"
#include "mission/config/torquer.h"
static constexpr bool ACTUATION_WIRETAPPING = false;

View File

@ -3,6 +3,7 @@
#include <mission/devices/SyrlinksHandler.h>
#include "OBSWConfig.h"
#include "mission/config/comCfg.h"
SyrlinksHandler::SyrlinksHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t powerSwitch, FailureIsolationBase* customFdir)
@ -685,7 +686,7 @@ ReturnValue_t SyrlinksHandler::handleAckReply(const uint8_t* packet) {
}
case (syrlinks::SET_TX_MODE_MODULATION):
case (syrlinks::SET_TX_MODE_CW): {
triggerEvent(syrlinks::TX_ON, getSubmode(), datarateCfgRaw);
triggerEvent(syrlinks::TX_ON, getSubmode(), static_cast<uint8_t>(com::getCurrentDatarate()));
break;
}
}
@ -706,18 +707,6 @@ ReturnValue_t SyrlinksHandler::getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues,
uint16_t startAtIndex) {
if ((domainId == 0) and (uniqueId == static_cast<uint8_t>(syrlinks::ParameterId::DATARATE))) {
uint8_t newVal = 0;
ReturnValue_t result = newValues->getElement(&newVal);
if (result != returnvalue::OK) {
return result;
}
if (newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) {
return HasParametersIF::INVALID_VALUE;
}
parameterWrapper->set(datarateCfgRaw);
return returnvalue::OK;
}
return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues,
startAtIndex);
}
@ -773,12 +762,12 @@ void SyrlinksHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
if (tgtMode == HasModesIF::MODE_ON or tgtMode == DeviceHandlerIF::MODE_NORMAL) {
switch (getSubmode()) {
case (com::Submode::RX_AND_TX_DEFAULT_DATARATE): {
if (datarateCfgRaw == static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK)) {
auto currentDatarate = com::getCurrentDatarate();
if (currentDatarate == com::Datarate::LOW_RATE_MODULATION_BPSK) {
if (txOnHandler(InternalState::SELECT_MODULATION_BPSK)) {
return;
}
} else if (datarateCfgRaw ==
static_cast<uint8_t>(com::Datarate::HIGH_RATE_MODULATION_0QPSK)) {
} else if (currentDatarate == com::Datarate::HIGH_RATE_MODULATION_0QPSK) {
if (txOnHandler(InternalState::SELECT_MODULATION_0QPSK)) {
return;
}

View File

@ -104,9 +104,6 @@ class SyrlinksHandler : public DeviceHandlerBase {
syrlinks::TemperatureSet temperatureSet;
const power::Switch_t powerSwitch = power::NO_SWITCH;
// Use uint8_t for compatibility with parameter interface
uint8_t datarateCfgRaw = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
// com::Datarate datarateCfg = com::Datarate::LOW_RATE_MODULATION_BPSK;
bool debugMode = false;
uint8_t agcValueHighByte = 0;

View File

@ -1,5 +1,32 @@
#include "ComSubsystem.h"
#include <fsfw/ipc/MutexGuard.h>
#include "mission/config/comCfg.h"
ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences,
uint32_t maxNumberOfTables)
: Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) {}
: Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables), paramHelper(this) {
com::setCurrentDatarate(com::Datarate::LOW_RATE_MODULATION_BPSK);
}
MessageQueueId_t ComSubsystem::getCommandQueue() const { return Subsystem::getCommandQueue(); }
ReturnValue_t ComSubsystem::getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex) {
if ((domainId == 0) and (uniqueIdentifier == static_cast<uint8_t>(com::ParameterId::DATARATE))) {
uint8_t newVal = 0;
ReturnValue_t result = newValues->getElement(&newVal);
if (result != returnvalue::OK) {
return result;
}
if (newVal >= static_cast<uint8_t>(com::Datarate::NUM_DATARATES)) {
return HasParametersIF::INVALID_VALUE;
}
parameterWrapper->set(datarateCfg);
com::setCurrentDatarate(static_cast<com::Datarate>(newVal));
return returnvalue::OK;
}
return returnvalue::OK;
}

View File

@ -1,13 +1,24 @@
#ifndef MISSION_SYSTEM_COMSUBSYSTEM_H_
#define MISSION_SYSTEM_COMSUBSYSTEM_H_
#include <fsfw/parameters/HasParametersIF.h>
#include <fsfw/parameters/ParameterHelper.h>
#include <fsfw/subsystem/Subsystem.h>
class ComSubsystem : public Subsystem {
#include "mission/comDefs.h"
class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
public:
ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables);
MessageQueueId_t getCommandQueue() const override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues,
uint16_t startAtIndex) override;
private:
uint8_t datarateCfg = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
ParameterHelper paramHelper;
};
#endif /* MISSION_SYSTEM_COMSUBSYSTEM_H_ */

View File

@ -19,7 +19,8 @@ static const auto NML = DeviceHandlerIF::MODE_NORMAL;
auto COM_SEQUENCE_RX_ONLY =
std::make_pair(::com::Submode::RX_ONLY, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_ONLY_TGT = std::make_pair((::com::Submode::RX_ONLY << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_ONLY_TGT =
std::make_pair((::com::Submode::RX_ONLY << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_ONLY_TRANS_0 =
std::make_pair((::com::Submode::RX_ONLY << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_ONLY_TRANS_1 =
@ -27,26 +28,28 @@ auto COM_TABLE_RX_ONLY_TRANS_1 =
auto COM_SEQUENCE_RX_AND_TX_LOW_RATE =
std::make_pair(::com::Submode::RX_AND_TX_LOW_DATARATE, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TGT =
std::make_pair((::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0 =
std::make_pair((::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1 =
std::make_pair((::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TGT = std::make_pair(
(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0 = std::make_pair(
(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1 = std::make_pair(
(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
auto COM_SEQUENCE_RX_AND_TX_HIGH_RATE =
std::make_pair(::com::Submode::RX_AND_TX_HIGH_DATARATE, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TGT =
std::make_pair((::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0 =
std::make_pair((::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 =
std::make_pair((::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TGT = std::make_pair(
(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 1, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0 = std::make_pair(
(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 2, FixedArrayList<ModeListEntry, 3>());
auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 = std::make_pair(
(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, FixedArrayList<ModeListEntry, 3>());
namespace {
void buildRxOnlySequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxLowRateSequence(Subsystem& ss, ModeListEntry& eh);
void buildTxAndRxHighRateSequence(Subsystem& ss, ModeListEntry& eh);
} // namespace
void satsystem::com::init() {

View File

@ -3,6 +3,7 @@
#include <fsfw/subsystem/helper.h>
#include <linux/ipcore/PdecHandler.h>
#include <linux/ipcore/PtmeConfig.h>
#include <mission/config/comCfg.h>
#include "eive/definitions.h"
#include "fsfw/events/EventManagerIF.h"
@ -378,18 +379,31 @@ ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submod
}
void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
auto rateHigh = [&]() {
ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS);
if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON;
}
};
auto rateLow = [&]() {
ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS);
if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON;
}
};
if (mode == HasModesIF::MODE_ON) {
enableTransmit();
if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH)) {
ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS);
if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON;
if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_DEFAULT)) {
com::Datarate currentDatarate = com::getCurrentDatarate();
if (currentDatarate == com::Datarate::LOW_RATE_MODULATION_BPSK) {
rateLow();
} else if (currentDatarate == com::Datarate::HIGH_RATE_MODULATION_0QPSK) {
rateHigh();
}
} else if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_HIGH)) {
rateHigh();
} else if (submode == static_cast<Submode_t>(com::CcsdsSubmode::DATARATE_LOW)) {
ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS);
if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON;
}
rateLow();
}
} else if (mode == HasModesIF::MODE_OFF) {
disableTransmit();
@ -399,9 +413,7 @@ void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
announceMode(false);
}
void CcsdsIpCoreHandler::announceMode(bool recursive) {
triggerEvent(MODE_INFO, mode, submode);
}
void CcsdsIpCoreHandler::announceMode(bool recursive) { triggerEvent(MODE_INFO, mode, submode); }
void CcsdsIpCoreHandler::disableTransmit() {
#ifndef TE0720_1CFA