eive-obsw/mission/core/GenericFactory.cpp

372 lines
17 KiB
C++
Raw Normal View History

2020-11-20 18:10:39 +01:00
#include "GenericFactory.h"
2020-12-29 13:59:31 +01:00
2022-09-16 18:10:23 +02:00
#include <fsfw/cfdp/CfdpDistributor.h>
2022-09-16 12:14:27 +02:00
#include <fsfw/cfdp/handler/CfdpHandler.h>
2022-09-16 17:28:43 +02:00
#include <fsfw/cfdp/handler/RemoteConfigTableIF.h>
#include <fsfw/controller/ControllerBase.h>
2023-02-13 13:53:13 +01:00
#include <fsfw/controller/ExtendedControllerBase.h>
2020-11-20 18:10:39 +01:00
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
2021-07-15 01:25:32 +02:00
#include <fsfw/internalerror/InternalErrorReporter.h>
2022-09-16 17:28:43 +02:00
#include <fsfw/ipc/QueueFactory.h>
2020-11-20 18:10:39 +01:00
#include <fsfw/pus/CService200ModeCommanding.h>
2023-02-01 17:44:45 +01:00
#include <fsfw/pus/CServiceHealthCommanding.h>
2020-11-20 18:10:39 +01:00
#include <fsfw/pus/Service17Test.h>
#include <fsfw/pus/Service1TelecommandVerification.h>
2021-03-04 18:29:28 +01:00
#include <fsfw/pus/Service20ParameterManagement.h>
2020-11-20 18:10:39 +01:00
#include <fsfw/pus/Service2DeviceAccess.h>
2022-01-17 15:58:27 +01:00
#include <fsfw/pus/Service3Housekeeping.h>
2020-11-20 18:10:39 +01:00
#include <fsfw/pus/Service5EventReporting.h>
#include <fsfw/pus/Service8FunctionManagement.h>
#include <fsfw/pus/Service9TimeManagement.h>
#include <fsfw/storagemanager/PoolManager.h>
2023-02-17 13:04:40 +01:00
#include <fsfw/subsystem/SubsystemBase.h>
2022-09-16 11:43:11 +02:00
#include <fsfw/tcdistribution/CcsdsDistributor.h>
2022-08-15 11:57:57 +02:00
#include <fsfw/tcdistribution/PusDistributor.h>
#include <fsfw/timemanager/CdsShortTimeStamper.h>
2022-09-16 12:14:27 +02:00
#include <fsfw_hal/host/HostFilesystem.h>
2022-11-25 11:01:06 +01:00
#include <mission/controller/ThermalController.h>
#include <mission/devices/HeaterHandler.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
2023-03-10 19:01:31 +01:00
#include <mission/persistentTmStoreDefs.h>
2023-02-13 13:53:13 +01:00
#include <mission/system/objects/AcsBoardAssembly.h>
2023-02-13 11:49:26 +01:00
#include <mission/system/objects/RwAssembly.h>
#include <mission/system/objects/SusAssembly.h>
2023-02-13 17:04:04 +01:00
#include <mission/system/objects/TcsBoardAssembly.h>
2022-10-21 11:51:44 +02:00
#include <mission/tmtc/CfdpTmFunnel.h>
#include <mission/tmtc/PersistentTmStore.h>
2023-03-09 19:42:20 +01:00
#include <mission/tmtc/PersistentTmStoreWithTmQueue.h>
#include <mission/tmtc/PusPacketFilter.h>
2022-10-21 11:51:44 +02:00
#include <mission/tmtc/PusTmFunnel.h>
2023-03-09 11:46:13 +01:00
#include <mission/tmtc/PusTmRouteByFilterHelper.h>
#include <mission/tmtc/TmFunnelHandler.h>
2022-01-17 15:58:27 +01:00
2022-03-25 18:39:21 +01:00
#include "OBSWConfig.h"
2022-11-25 11:01:06 +01:00
#include "devices/gpioIds.h"
2022-03-26 13:54:05 +01:00
#include "eive/definitions.h"
2022-05-26 11:46:28 +02:00
#include "fsfw/pus/Service11TelecommandScheduling.h"
2022-09-16 18:10:23 +02:00
#include "mission/cfdp/Config.h"
2023-02-13 11:49:26 +01:00
#include "mission/system/objects/RwAssembly.h"
#include "mission/system/tree/acsModeTree.h"
#include "mission/system/tree/tcsModeTree.h"
2023-03-09 19:42:20 +01:00
#include "mission/tmtc/tmFilters.h"
2022-01-17 15:58:27 +01:00
#include "objects/systemObjectList.h"
2022-03-25 18:39:21 +01:00
#include "tmtc/pusIds.h"
2020-11-20 18:10:39 +01:00
2023-03-10 19:01:31 +01:00
using persTmStore::PersistentTmStores;
2022-12-02 13:55:19 +01:00
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
2021-09-28 14:58:12 +02:00
// UDP server includes
2022-11-24 19:41:57 +01:00
#include "devices/gpioIds.h"
2021-09-28 14:58:12 +02:00
#include "fsfw/osal/common/UdpTcPollingTask.h"
2022-01-17 15:58:27 +01:00
#include "fsfw/osal/common/UdpTmTcBridge.h"
2022-12-02 13:55:19 +01:00
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
2021-09-28 14:58:12 +02:00
// TCP server includes
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
2023-02-20 16:10:35 +01:00
#include "mission/tmtc/Service15TmStorage.h"
2021-09-28 14:58:12 +02:00
#endif
#endif
2020-12-29 13:59:31 +01:00
#if OBSW_ADD_TEST_CODE == 1
2021-09-28 14:58:12 +02:00
#include <test/testtasks/TestTask.h>
2020-11-25 16:17:16 +01:00
#endif
2020-11-20 18:10:39 +01:00
2022-03-26 14:08:34 +01:00
#ifndef OBSW_TM_TO_PTME
#define OBSW_TM_TO_PTME 0
#endif
2022-09-16 17:28:43 +02:00
namespace cfdp {
PacketInfoList<64> PACKET_LIST;
LostSegmentsList<128> LOST_SEGMENTS;
EntityId REMOTE_CFDP_ID(UnsignedByteField<uint16_t>(config::EIVE_GROUND_CFDP_ENTITY_ID));
RemoteEntityCfg GROUND_REMOTE_CFG(REMOTE_CFDP_ID);
OneRemoteConfigProvider REMOTE_CFG_PROVIDER(GROUND_REMOTE_CFG);
HostFilesystem HOST_FS;
EiveUserHandler USER_HANDLER(HOST_FS);
EiveFaultHandler EIVE_FAULT_HANDLER;
2022-09-16 18:10:23 +02:00
} // namespace cfdp
2022-09-16 17:28:43 +02:00
void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFunnel** pusFunnel,
2023-03-09 19:42:20 +01:00
CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan,
StorageManagerIF** ipcStore, StorageManagerIF** tmStore,
PersistentTmStores& stores) {
2022-01-17 15:58:27 +01:00
// Framework objects
2023-03-10 14:59:52 +01:00
new EventManager(objects::EVENT_MANAGER, 120);
2022-05-02 17:37:00 +02:00
auto healthTable = new HealthTable(objects::HEALTH_TABLE);
2022-05-17 13:35:21 +02:00
if (healthTable_ != nullptr) {
2022-05-02 17:37:00 +02:00
*healthTable_ = healthTable;
}
2022-01-17 15:58:27 +01:00
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
2022-08-16 17:09:46 +02:00
new VerificationReporter();
2022-08-15 11:57:57 +02:00
auto* timeStamper = new CdsShortTimeStamper(objects::TIME_STAMPER);
2022-09-16 12:14:27 +02:00
StorageManagerIF* tcStore;
2022-01-17 15:58:27 +01:00
{
2022-11-02 18:58:29 +01:00
PoolManager::LocalPoolConfig poolCfg = {{250, 16}, {250, 32}, {250, 64},
{150, 128}, {120, 1024}, {120, 2048}};
2023-03-14 20:02:27 +01:00
tcStore = new PoolManager(objects::TC_STORE, poolCfg);
2022-01-17 15:58:27 +01:00
}
{
2023-03-15 11:49:01 +01:00
PoolManager::LocalPoolConfig poolCfg = {{600, 32}, {400, 64}, {400, 128},
{300, 512}, {250, 1024}, {150, 2048}};
2023-03-14 20:02:27 +01:00
*tmStore = new PoolManager(objects::TM_STORE, poolCfg);
2022-01-17 15:58:27 +01:00
}
{
2023-03-14 20:02:27 +01:00
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {250, 32}, {150, 64}, {150, 128},
2022-01-17 15:58:27 +01:00
{100, 256}, {50, 512}, {50, 1024}, {10, 2048}};
2023-03-14 20:02:27 +01:00
*ipcStore = new PoolManager(objects::IPC_STORE, poolCfg);
2022-01-17 15:58:27 +01:00
}
PoolManager::LocalPoolConfig poolCfg = {{300, 32}, {400, 64}, {250, 128},
{150, 512}, {150, 1024}, {150, 2048}};
2023-03-14 20:02:27 +01:00
auto* ramToFileStore = new PoolManager(objects::DOWNLINK_RAM_STORE, poolCfg);
2022-01-17 15:58:27 +01:00
2022-12-02 13:55:19 +01:00
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
2023-03-03 16:06:38 +01:00
auto udpBridge =
new UdpTmTcBridge(objects::UDP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR, 50);
2022-12-02 13:55:19 +01:00
new UdpTcPollingTask(objects::UDP_TMTC_POLLING_TASK, objects::UDP_TMTC_SERVER);
2022-10-21 11:51:44 +02:00
sif::info << "Created UDP server for TMTC commanding with listener port "
2022-12-02 13:55:19 +01:00
<< udpBridge->getUdpPort() << std::endl;
2023-01-27 11:02:04 +01:00
udpBridge->setMaxNumberOfPacketsStored(config::MAX_STORED_CMDS_UDP);
2022-12-02 13:55:19 +01:00
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
2023-03-03 16:06:38 +01:00
auto tcpBridge =
new TcpTmTcBridge(objects::TCP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR, 50);
2023-01-30 14:25:50 +01:00
TcpTmTcServer::TcpConfig cfg(true, true);
auto tcpServer = new TcpTmTcServer(objects::TCP_TMTC_POLLING_TASK, objects::TCP_TMTC_SERVER, cfg);
2022-10-21 11:51:44 +02:00
// TCP is stream based. Use packet ID as start marker when parsing for space packets
tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID, common::CFDP_PACKET_ID});
sif::info << "Created TCP server for TMTC commanding with listener port "
<< tcpServer->getTcpPort() << std::endl;
2023-01-27 11:02:04 +01:00
tcpBridge->setMaxNumberOfPacketsStored(config::MAX_STORED_CMDS_TCP);
2022-10-21 11:51:44 +02:00
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
#endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */
2022-09-16 12:28:39 +02:00
auto* ccsdsDistrib =
new CcsdsDistributor(config::EIVE_PUS_APID, objects::CCSDS_PACKET_DISTRIBUTOR);
2022-09-16 12:22:46 +02:00
new PusDistributor(config::EIVE_PUS_APID, objects::PUS_PACKET_DISTRIBUTOR, ccsdsDistrib);
2022-01-17 15:58:27 +01:00
2023-03-09 19:42:20 +01:00
PusTmFunnel::FunnelCfg pusFunnelCfg(objects::PUS_TM_FUNNEL, "PusTmFunnel", **tmStore, **ipcStore,
2023-02-21 20:43:16 +01:00
config::MAX_PUS_FUNNEL_QUEUE_DEPTH);
2023-03-09 19:42:20 +01:00
// The PUS funnel routes all live TM to the live destinations and to the TM stores.
*pusFunnel = new PusTmFunnel(pusFunnelCfg, *ramToFileStore, *timeStamper, sdcMan);
2023-03-09 19:42:20 +01:00
// MISC store and PUS funnel to MISC store routing
{
PersistentTmStoreArgs storeArgs(objects::MISC_TM_STORE, "tm", "misc",
RolloverInterval::HOURLY, 2, *ramToFileStore, sdcMan);
2023-03-10 02:05:51 +01:00
stores.miscStore =
new PersistentTmStoreWithTmQueue(storeArgs, "MISC STORE", config::MISC_STORE_QUEUE_SIZE);
2023-03-09 19:42:20 +01:00
(*pusFunnel)
->addPersistentTmStoreRouting(filters::miscFilter(),
stores.miscStore->getReportReceptionQueue(0));
}
// OK store and PUS Funnel to OK store routing
{
PersistentTmStoreArgs storeArgs(objects::OK_TM_STORE, "tm", "ok", RolloverInterval::MINUTELY,
30, *ramToFileStore, sdcMan);
2023-03-10 02:05:51 +01:00
stores.okStore =
new PersistentTmStoreWithTmQueue(storeArgs, "OK STORE", config::OK_STORE_QUEUE_SIZE);
2023-03-09 19:42:20 +01:00
(*pusFunnel)
->addPersistentTmStoreRouting(filters::okFilter(),
stores.okStore->getReportReceptionQueue(0));
}
// NOT OK store and PUS funnel to NOT OK store routing
{
PersistentTmStoreArgs storeArgs(objects::NOT_OK_TM_STORE, "tm", "nok",
RolloverInterval::MINUTELY, 30, *ramToFileStore, sdcMan);
2023-03-10 02:05:51 +01:00
stores.notOkStore =
new PersistentTmStoreWithTmQueue(storeArgs, "NOT OK STORE", config::NOK_STORE_QUEUE_SIZE);
2023-03-09 19:42:20 +01:00
(*pusFunnel)
->addPersistentTmStoreRouting(filters::notOkFilter(),
stores.notOkStore->getReportReceptionQueue(0));
}
// HK store and PUS funnel to HK store routing
{
PersistentTmStoreArgs storeArgs(objects::HK_TM_STORE, "tm", "hk", RolloverInterval::MINUTELY,
15, *ramToFileStore, sdcMan);
2023-03-10 02:05:51 +01:00
stores.hkStore =
new PersistentTmStoreWithTmQueue(storeArgs, "HK STORE", config::HK_STORE_QUEUE_SIZE);
2023-03-09 19:42:20 +01:00
(*pusFunnel)
->addPersistentTmStoreRouting(filters::hkFilter(),
stores.hkStore->getReportReceptionQueue(0));
}
// CFDP store and PUS funnel to CFDP store routing
{
PersistentTmStoreArgs storeArgs(objects::CFDP_TM_STORE, "tm", "cfdp",
RolloverInterval::MINUTELY, 30, *ramToFileStore, sdcMan);
2023-03-10 02:05:51 +01:00
stores.cfdpStore =
new PersistentTmStoreWithTmQueue(storeArgs, "CFDP STORE", config::CFDP_STORE_QUEUE_SIZE);
2023-03-09 19:42:20 +01:00
(*pusFunnel)
->addPersistentTmStoreRouting(filters::cfdpFilter(),
stores.cfdpStore->getReportReceptionQueue(0));
}
2023-03-10 17:32:22 +01:00
PusTmFunnel::FunnelCfg cfdpFunnelCfg(objects::CFDP_TM_FUNNEL, "CfdpTmFunnel", **tmStore,
**ipcStore, config::MAX_CFDP_FUNNEL_QUEUE_DEPTH);
*cfdpFunnel = new CfdpTmFunnel(cfdpFunnelCfg, stores.cfdpStore->getReportReceptionQueue(0),
*ramToFileStore, config::EIVE_CFDP_APID);
2023-03-09 19:42:20 +01:00
2022-12-02 13:55:19 +01:00
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
2023-03-09 11:46:13 +01:00
(*cfdpFunnel)->addLiveDestination("UDP Server", *udpBridge, 0);
(*pusFunnel)->addLiveDestination("UDP Server", *udpBridge, 0);
2022-12-02 13:55:19 +01:00
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
2023-03-09 11:46:13 +01:00
(*cfdpFunnel)->addLiveDestination("TCP Server", *tcpBridge, 0);
(*pusFunnel)->addLiveDestination("TCP Server", *tcpBridge, 0);
2022-12-02 13:55:19 +01:00
#endif
2022-03-26 14:08:34 +01:00
#endif
2022-01-17 15:58:27 +01:00
// PUS service stack
2022-09-16 12:22:46 +02:00
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, config::EIVE_PUS_APID,
2023-03-10 14:59:52 +01:00
pus::PUS_SERVICE_1, objects::PUS_TM_FUNNEL, 40);
2022-09-16 12:22:46 +02:00
new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, config::EIVE_PUS_APID,
2022-01-17 15:58:27 +01:00
pus::PUS_SERVICE_2, 3, 10);
2022-09-16 12:22:46 +02:00
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, config::EIVE_PUS_APID,
2022-01-17 15:58:27 +01:00
pus::PUS_SERVICE_3);
new Service5EventReporting(
2022-09-16 12:28:39 +02:00
PsbParams(objects::PUS_SERVICE_5_EVENT_REPORTING, config::EIVE_PUS_APID, pus::PUS_SERVICE_5),
2023-03-10 18:17:04 +01:00
40, 120);
2022-09-16 12:22:46 +02:00
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, config::EIVE_PUS_APID,
pus::PUS_SERVICE_8, 16, 60);
new Service9TimeManagement(
2022-09-16 12:22:46 +02:00
PsbParams(objects::PUS_SERVICE_9_TIME_MGMT, config::EIVE_PUS_APID, pus::PUS_SERVICE_9));
2022-05-24 15:21:37 +02:00
2022-05-26 11:46:28 +02:00
new Service11TelecommandScheduling<common::OBSW_MAX_SCHEDULED_TCS>(
2022-09-16 12:22:46 +02:00
PsbParams(objects::PUS_SERVICE_11_TC_SCHEDULER, config::EIVE_PUS_APID, pus::PUS_SERVICE_11),
ccsdsDistrib);
2023-02-20 16:10:35 +01:00
new Service15TmStorage(objects::PUS_SERVICE_15_TM_STORAGE, config::EIVE_PUS_APID, 10);
2022-09-16 12:28:39 +02:00
new Service17Test(
PsbParams(objects::PUS_SERVICE_17_TEST, config::EIVE_PUS_APID, pus::PUS_SERVICE_17));
2022-09-16 12:22:46 +02:00
new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, config::EIVE_PUS_APID,
2022-01-17 15:58:27 +01:00
pus::PUS_SERVICE_20);
2022-09-16 12:22:46 +02:00
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, config::EIVE_PUS_APID,
2022-05-12 19:22:20 +02:00
pus::PUS_SERVICE_200, 8);
2023-03-15 11:49:01 +01:00
HealthServiceCfg healthCfg(objects::PUS_SERVICE_201_HEALTH, config::EIVE_PUS_APID,
objects::HEALTH_TABLE, 20);
2023-02-01 17:44:45 +01:00
new CServiceHealthCommanding(healthCfg);
2022-09-16 12:14:27 +02:00
#if OBSW_ADD_CFDP_COMPONENTS == 1
2022-09-16 17:28:43 +02:00
using namespace cfdp;
2023-02-10 14:02:27 +01:00
2022-09-16 18:10:23 +02:00
MessageQueueIF* cfdpMsgQueue = QueueFactory::instance()->createMessageQueue(32);
CfdpDistribCfg distribCfg(objects::CFDP_DISTRIBUTOR, *tcStore, cfdpMsgQueue);
new CfdpDistributor(distribCfg);
2022-09-16 17:28:43 +02:00
auto* msgQueue = QueueFactory::instance()->createMessageQueue(32);
2023-03-09 19:42:20 +01:00
FsfwHandlerParams params(objects::CFDP_HANDLER, HOST_FS, **cfdpFunnel, *tcStore, **tmStore,
2022-10-21 11:51:44 +02:00
*msgQueue);
2022-09-16 12:22:46 +02:00
cfdp::IndicationCfg indicationCfg;
2022-09-16 17:28:43 +02:00
UnsignedByteField<uint16_t> apid(config::EIVE_LOCAL_CFDP_ENTITY_ID);
cfdp::EntityId localId(apid);
GROUND_REMOTE_CFG.defaultChecksum = cfdp::ChecksumType::CRC_32;
2022-09-16 18:10:23 +02:00
CfdpHandlerCfg cfdpCfg(localId, indicationCfg, USER_HANDLER, EIVE_FAULT_HANDLER, PACKET_LIST,
LOST_SEGMENTS, REMOTE_CFG_PROVIDER);
auto* cfdpHandler = new CfdpHandler(params, cfdpCfg);
2022-09-16 17:28:43 +02:00
// All CFDP packets arrive wrapped inside CCSDS space packets
CcsdsDistributorIF::DestInfo info("CFDP Destination", config::EIVE_CFDP_APID,
cfdpHandler->getRequestQueue(), true);
ccsdsDistrib->registerApplication(info);
2022-09-16 12:14:27 +02:00
#endif
2020-11-20 18:10:39 +01:00
}
2022-11-24 19:41:57 +01:00
2022-11-25 10:13:24 +01:00
void ObjectFactory::createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher,
HeaterHandler*& heaterHandler) {
2022-11-24 19:41:57 +01:00
HeaterHelper helper({{
{new HealthDevice(objects::HEATER_0_PLOC_PROC_BRD, MessageQueueIF::NO_QUEUE),
gpioIds::HEATER_0},
{new HealthDevice(objects::HEATER_1_PCDU_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_1},
{new HealthDevice(objects::HEATER_2_ACS_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_2},
{new HealthDevice(objects::HEATER_3_OBC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_3},
{new HealthDevice(objects::HEATER_4_CAMERA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_4},
{new HealthDevice(objects::HEATER_5_STR, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_5},
{new HealthDevice(objects::HEATER_6_DRO, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_6},
2023-03-09 16:43:35 +01:00
{new HealthDevice(objects::HEATER_7_SYRLINKS, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_7},
2022-11-24 19:41:57 +01:00
}});
heaterHandler = new HeaterHandler(objects::HEATER_HANDLER, &gpioIF, helper, &pwrSwitcher,
2023-03-16 18:47:51 +01:00
power::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V);
2023-02-17 13:04:40 +01:00
heaterHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
2022-11-24 19:41:57 +01:00
}
void ObjectFactory::createThermalController(HeaterHandler& heaterHandler) {
auto* tcsCtrl = new ThermalController(objects::THERMAL_CONTROLLER, heaterHandler);
tcsCtrl->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
2022-11-25 11:01:06 +01:00
}
2023-02-13 11:49:26 +01:00
void ObjectFactory::createRwAssy(PowerSwitchIF& pwrSwitcher, power::Switch_t theSwitch,
std::array<DeviceHandlerBase*, 4> rws,
std::array<object_id_t, 4> rwIds) {
RwHelper rwHelper(rwIds);
2023-03-02 17:08:44 +01:00
auto* rwAss = new RwAssembly(objects::RW_ASSY, &pwrSwitcher, theSwitch, rwHelper);
2023-02-22 14:27:50 +01:00
for (size_t idx = 0; idx < rwIds.size(); idx++) {
2023-02-13 11:49:26 +01:00
ReturnValue_t result = rws[idx]->connectModeTreeParent(*rwAss);
if (result != returnvalue::OK) {
sif::error << "Connecting RW " << static_cast<int>(idx) << " to RW assembly failed"
<< std::endl;
}
}
rwAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
void ObjectFactory::createSusAssy(PowerSwitchIF& pwrSwitcher,
std::array<DeviceHandlerBase*, 12> suses) {
std::array<object_id_t, 12> susIds = {
objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::SUS_1_N_LOC_XBYFZM_PT_XB,
objects::SUS_2_N_LOC_XFYBZB_PT_YB, objects::SUS_3_N_LOC_XFYBZF_PT_YF,
objects::SUS_4_N_LOC_XMYFZF_PT_ZF, objects::SUS_5_N_LOC_XFYMZB_PT_ZB,
objects::SUS_6_R_LOC_XFYBZM_PT_XF, objects::SUS_7_R_LOC_XBYBZM_PT_XB,
objects::SUS_8_R_LOC_XBYBZB_PT_YB, objects::SUS_9_R_LOC_XBYBZB_PT_YF,
objects::SUS_10_N_LOC_XMYBZF_PT_ZF, objects::SUS_11_R_LOC_XBYMZB_PT_ZB};
2023-02-22 14:27:50 +01:00
auto susAssHelper = SusAssHelper(susIds);
2023-02-13 11:49:26 +01:00
auto susAss = new SusAssembly(objects::SUS_BOARD_ASS, &pwrSwitcher, susAssHelper);
for (auto& sus : suses) {
if (sus != nullptr) {
ReturnValue_t result = sus->connectModeTreeParent(*susAss);
if (result != returnvalue::OK) {
sif::error << "Connecting SUS " << sus->getObjectId() << " to SUS assembly failed"
<< std::endl;
}
}
}
susAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
2023-02-13 13:53:13 +01:00
void ObjectFactory::createAcsBoardAssy(PowerSwitchIF& pwrSwitcher,
std::array<DeviceHandlerBase*, 8> assemblyDhbs,
ExtendedControllerBase* gpsCtrl, GpioIF* gpioComIF) {
AcsBoardHelper acsBoardHelper = AcsBoardHelper(
objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER,
objects::MGM_3_RM3100_HANDLER, objects::GYRO_0_ADIS_HANDLER, objects::GYRO_1_L3G_HANDLER,
objects::GYRO_2_ADIS_HANDLER, objects::GYRO_3_L3G_HANDLER, objects::GPS_CONTROLLER);
auto acsAss =
new AcsBoardAssembly(objects::ACS_BOARD_ASS, &pwrSwitcher, acsBoardHelper, gpioComIF);
for (auto& assChild : assemblyDhbs) {
ReturnValue_t result = assChild->connectModeTreeParent(*acsAss);
if (result != returnvalue::OK) {
sif::error << "Connecting assembly for ACS board component " << assChild->getObjectId()
<< " failed" << std::endl;
}
}
gpsCtrl->connectModeTreeParent(*acsAss);
acsAss->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
}
2023-02-13 16:39:26 +01:00
2023-02-13 17:04:04 +01:00
TcsBoardAssembly* ObjectFactory::createTcsBoardAssy(PowerSwitchIF& pwrSwitcher) {
TcsBoardHelper helper(RTD_INFOS);
2023-02-22 14:27:50 +01:00
auto* tcsBoardAss = new TcsBoardAssembly(objects::TCS_BOARD_ASS, &pwrSwitcher,
2023-03-16 18:47:51 +01:00
power::Switches::PDU1_CH0_TCS_BOARD_3V3, helper);
2023-02-13 17:04:04 +01:00
tcsBoardAss->connectModeTreeParent(satsystem::tcs::SUBSYSTEM);
return tcsBoardAss;
}