get correct sd card
All checks were successful
EIVE/eive-obsw/pipeline/pr-dev-7.5.0 This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-dev-7.5.0 This commit looks good
This commit is contained in:
parent
3c8b0d1a71
commit
370eff5204
@ -175,7 +175,7 @@ void ObjectFactory::produce(void* args) {
|
|||||||
createScexComponents(q7s::UART_SCEX_DEV, pwrSwitcher, *SdCardManager::instance(), false,
|
createScexComponents(q7s::UART_SCEX_DEV, pwrSwitcher, *SdCardManager::instance(), false,
|
||||||
power::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V);
|
power::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V);
|
||||||
#endif
|
#endif
|
||||||
createAcsController(true, enableHkSets);
|
createAcsController(true, enableHkSets, *SdCardManager::instance());
|
||||||
HeaterHandler* heaterHandler;
|
HeaterHandler* heaterHandler;
|
||||||
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);
|
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);
|
||||||
createThermalController(*heaterHandler, true);
|
createThermalController(*heaterHandler, true);
|
||||||
|
@ -130,6 +130,6 @@ void ObjectFactory::produce(void* args) {
|
|||||||
|
|
||||||
createMiscComponents();
|
createMiscComponents();
|
||||||
createThermalController(*heaterHandler, false);
|
createThermalController(*heaterHandler, false);
|
||||||
createAcsController(true, enableHkSets);
|
createAcsController(true, enableHkSets, *SdCardManager::instance());
|
||||||
satsystem::init(false);
|
satsystem::init(false);
|
||||||
}
|
}
|
||||||
|
@ -335,8 +335,9 @@ void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwr
|
|||||||
scexHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
scexHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
AcsController* ObjectFactory::createAcsController(bool connectSubsystem, bool enableHkSets) {
|
AcsController* ObjectFactory::createAcsController(bool connectSubsystem, bool enableHkSets,
|
||||||
auto acsCtrl = new AcsController(objects::ACS_CONTROLLER, enableHkSets);
|
SdCardMountedIF& mountedIF) {
|
||||||
|
auto acsCtrl = new AcsController(objects::ACS_CONTROLLER, enableHkSets, mountedIF);
|
||||||
if (connectSubsystem) {
|
if (connectSubsystem) {
|
||||||
acsCtrl->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
|
acsCtrl->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@ void createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher,
|
|||||||
|
|
||||||
void gpioChecker(ReturnValue_t result, std::string output);
|
void gpioChecker(ReturnValue_t result, std::string output);
|
||||||
|
|
||||||
AcsController* createAcsController(bool connectSubsystem, bool enableHkSets);
|
AcsController* createAcsController(bool connectSubsystem, bool enableHkSets,
|
||||||
|
SdCardMountedIF& mountedIF);
|
||||||
PowerController* createPowerController(bool connectSubsystem, bool enableHkSets);
|
PowerController* createPowerController(bool connectSubsystem, bool enableHkSets);
|
||||||
|
|
||||||
} // namespace ObjectFactory
|
} // namespace ObjectFactory
|
||||||
|
@ -73,6 +73,8 @@ static constexpr Event MEKF_INVALID_MODE_VIOLATION = MAKE_EVENT(6, severity::HIG
|
|||||||
static constexpr Event SAFE_MODE_CONTROLLER_FAILURE = MAKE_EVENT(7, severity::HIGH);
|
static constexpr Event SAFE_MODE_CONTROLLER_FAILURE = MAKE_EVENT(7, severity::HIGH);
|
||||||
//! [EXPORT] : [COMMENT] The TLE for the SGP4 Propagator has become too old.
|
//! [EXPORT] : [COMMENT] The TLE for the SGP4 Propagator has become too old.
|
||||||
static constexpr Event TLE_TOO_OLD = MAKE_EVENT(8, severity::INFO);
|
static constexpr Event TLE_TOO_OLD = MAKE_EVENT(8, severity::INFO);
|
||||||
|
//! [EXPORT] : [COMMENT] The TLE for the SGP4 Propagator has become too old.
|
||||||
|
static constexpr Event TLE_FILE_READ_FAILED = MAKE_EVENT(9, severity::LOW);
|
||||||
|
|
||||||
extern const char* getModeStr(AcsMode mode);
|
extern const char* getModeStr(AcsMode mode);
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
#include "AcsController.h"
|
#include "AcsController.h"
|
||||||
|
|
||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
AcsController::AcsController(object_id_t objectId, bool enableHkSets, SdCardMountedIF &sdcMan)
|
||||||
#include <mission/acs/defs.h>
|
|
||||||
#include <mission/config/torquer.h>
|
|
||||||
|
|
||||||
AcsController::AcsController(object_id_t objectId, bool enableHkSets)
|
|
||||||
: ExtendedControllerBase(objectId),
|
: ExtendedControllerBase(objectId),
|
||||||
enableHkSets(enableHkSets),
|
enableHkSets(enableHkSets),
|
||||||
|
sdcMan(sdcMan),
|
||||||
fusedRotationEstimation(&acsParameters),
|
fusedRotationEstimation(&acsParameters),
|
||||||
guidance(&acsParameters),
|
guidance(&acsParameters),
|
||||||
safeCtrl(&acsParameters),
|
safeCtrl(&acsParameters),
|
||||||
@ -1040,8 +1037,11 @@ ReturnValue_t AcsController::updateTle(const uint8_t *line1, const uint8_t *line
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AcsController::writeTleToFs(const uint8_t *tle) {
|
ReturnValue_t AcsController::writeTleToFs(const uint8_t *tle) {
|
||||||
// ToDo: check which SD card is active via sdcMan
|
auto mntPrefix = sdcMan.getCurrentMountPrefix();
|
||||||
std::string path = SD_0 + TLE_FILE;
|
if (mntPrefix == nullptr or !sdcMan.isSdCardUsable(std::nullopt)) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
std::string path = mntPrefix + TLE_FILE;
|
||||||
// Clear existing TLE from file
|
// Clear existing TLE from file
|
||||||
std::ofstream tleFile(path.c_str(), std::ofstream::out | std::ofstream::trunc);
|
std::ofstream tleFile(path.c_str(), std::ofstream::out | std::ofstream::trunc);
|
||||||
if (tleFile.is_open()) {
|
if (tleFile.is_open()) {
|
||||||
@ -1049,27 +1049,34 @@ ReturnValue_t AcsController::writeTleToFs(const uint8_t *tle) {
|
|||||||
tleFile << "\n";
|
tleFile << "\n";
|
||||||
tleFile.write(reinterpret_cast<const char *>(tle + 69), 69);
|
tleFile.write(reinterpret_cast<const char *>(tle + 69), 69);
|
||||||
} else {
|
} else {
|
||||||
// return error
|
return WRITE_FILE_FAILED;
|
||||||
}
|
}
|
||||||
tleFile.close();
|
tleFile.close();
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AcsController::readTleFromFs(uint8_t *line1, uint8_t *line2) {
|
ReturnValue_t AcsController::readTleFromFs(uint8_t *line1, uint8_t *line2) {
|
||||||
// ToDo: check which SD card is active via sdcMan
|
auto mntPrefix = sdcMan.getCurrentMountPrefix();
|
||||||
std::string path = SD_0 + TLE_FILE;
|
if (mntPrefix == nullptr or !sdcMan.isSdCardUsable(std::nullopt)) {
|
||||||
// Read existing TLE from file
|
return returnvalue::FAILED;
|
||||||
std::fstream tleFile = std::fstream(path.c_str(), std::fstream::in);
|
}
|
||||||
if (tleFile.is_open()) {
|
std::string path = mntPrefix + TLE_FILE;
|
||||||
std::string tleLine1, tleLine2;
|
std::error_code e;
|
||||||
getline(tleFile, tleLine1);
|
if (std::filesystem::exists(path, e)) {
|
||||||
std::memcpy(line1, tleLine1.c_str(), 69);
|
// Read existing TLE from file
|
||||||
getline(tleFile, tleLine2);
|
std::fstream tleFile = std::fstream(path.c_str(), std::fstream::in);
|
||||||
std::memcpy(line2, tleLine2.c_str(), 69);
|
if (tleFile.is_open()) {
|
||||||
} else {
|
std::string tleLine1, tleLine2;
|
||||||
// return error
|
getline(tleFile, tleLine1);
|
||||||
|
std::memcpy(line1, tleLine1.c_str(), 69);
|
||||||
|
getline(tleFile, tleLine2);
|
||||||
|
std::memcpy(line2, tleLine2.c_str(), 69);
|
||||||
|
} else {
|
||||||
|
triggerEvent(acs::TLE_FILE_READ_FAILED);
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
tleFile.close();
|
||||||
}
|
}
|
||||||
tleFile.close();
|
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,15 +4,18 @@
|
|||||||
#include <eive/objects.h>
|
#include <eive/objects.h>
|
||||||
#include <fsfw/controller/ExtendedControllerBase.h>
|
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||||
#include <fsfw/coordinates/Sgp4Propagator.h>
|
#include <fsfw/coordinates/Sgp4Propagator.h>
|
||||||
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
#include <fsfw/globalfunctions/math/VectorOperations.h>
|
||||||
#include <fsfw/health/HealthTable.h>
|
#include <fsfw/health/HealthTable.h>
|
||||||
#include <fsfw/parameters/ParameterHelper.h>
|
#include <fsfw/parameters/ParameterHelper.h>
|
||||||
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
||||||
#include <fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h>
|
#include <fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h>
|
||||||
#include <fsfw_hal/devicehandlers/MgmRM3100Handler.h>
|
#include <fsfw_hal/devicehandlers/MgmRM3100Handler.h>
|
||||||
|
#include <mission/acs/defs.h>
|
||||||
#include <mission/acs/imtqHelpers.h>
|
#include <mission/acs/imtqHelpers.h>
|
||||||
#include <mission/acs/rwHelpers.h>
|
#include <mission/acs/rwHelpers.h>
|
||||||
#include <mission/acs/susMax1227Helpers.h>
|
#include <mission/acs/susMax1227Helpers.h>
|
||||||
|
#include <mission/config/torquer.h>
|
||||||
#include <mission/controller/acs/ActuatorCmd.h>
|
#include <mission/controller/acs/ActuatorCmd.h>
|
||||||
#include <mission/controller/acs/FusedRotationEstimation.h>
|
#include <mission/controller/acs/FusedRotationEstimation.h>
|
||||||
#include <mission/controller/acs/Guidance.h>
|
#include <mission/controller/acs/Guidance.h>
|
||||||
@ -23,15 +26,18 @@
|
|||||||
#include <mission/controller/acs/control/PtgCtrl.h>
|
#include <mission/controller/acs/control/PtgCtrl.h>
|
||||||
#include <mission/controller/acs/control/SafeCtrl.h>
|
#include <mission/controller/acs/control/SafeCtrl.h>
|
||||||
#include <mission/controller/controllerdefinitions/AcsCtrlDefinitions.h>
|
#include <mission/controller/controllerdefinitions/AcsCtrlDefinitions.h>
|
||||||
|
#include <mission/memory/SdCardMountedIF.h>
|
||||||
#include <mission/utility/trace.h>
|
#include <mission/utility/trace.h>
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
class AcsController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
|
class AcsController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
|
||||||
public:
|
public:
|
||||||
static constexpr dur_millis_t INIT_DELAY = 500;
|
static constexpr dur_millis_t INIT_DELAY = 500;
|
||||||
|
|
||||||
AcsController(object_id_t objectId, bool enableHkSets);
|
AcsController(object_id_t objectId, bool enableHkSets, SdCardMountedIF& sdcMan);
|
||||||
|
|
||||||
MessageQueueId_t getCommandQueue() const;
|
MessageQueueId_t getCommandQueue() const;
|
||||||
ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId,
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId,
|
||||||
@ -51,6 +57,8 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
|
|||||||
|
|
||||||
bool enableHkSets = false;
|
bool enableHkSets = false;
|
||||||
|
|
||||||
|
SdCardMountedIF& sdcMan;
|
||||||
|
|
||||||
AcsParameters acsParameters;
|
AcsParameters acsParameters;
|
||||||
SensorProcessing sensorProcessing;
|
SensorProcessing sensorProcessing;
|
||||||
FusedRotationEstimation fusedRotationEstimation;
|
FusedRotationEstimation fusedRotationEstimation;
|
||||||
@ -93,6 +101,8 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
|
|||||||
static const uint8_t INTERFACE_ID = CLASS_ID::ACS_CTRL;
|
static const uint8_t INTERFACE_ID = CLASS_ID::ACS_CTRL;
|
||||||
//! [EXPORT] : [COMMENT] File deletion failed and at least one file is still existent.
|
//! [EXPORT] : [COMMENT] File deletion failed and at least one file is still existent.
|
||||||
static constexpr ReturnValue_t FILE_DELETION_FAILED = MAKE_RETURN_CODE(0);
|
static constexpr ReturnValue_t FILE_DELETION_FAILED = MAKE_RETURN_CODE(0);
|
||||||
|
//! [EXPORT] : [COMMENT] Writing the TLE to the file has failed.
|
||||||
|
static constexpr ReturnValue_t WRITE_FILE_FAILED = MAKE_RETURN_CODE(1);
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||||
@ -131,9 +141,7 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
|
|||||||
ReturnValue_t writeTleToFs(const uint8_t* tle);
|
ReturnValue_t writeTleToFs(const uint8_t* tle);
|
||||||
ReturnValue_t readTleFromFs(uint8_t* line1, uint8_t* line2);
|
ReturnValue_t readTleFromFs(uint8_t* line1, uint8_t* line2);
|
||||||
|
|
||||||
const std::string SD_0 = "/mnt/sd0/";
|
const std::string TLE_FILE = "/conf/tle.txt";
|
||||||
const std::string SD_1 = "/mnt/sd1/";
|
|
||||||
const std::string TLE_FILE = "conf/tle.txt";
|
|
||||||
|
|
||||||
/* ACS Sensor Values */
|
/* ACS Sensor Values */
|
||||||
ACS::SensorValues sensorValues;
|
ACS::SensorValues sensorValues;
|
||||||
|
Loading…
Reference in New Issue
Block a user