mission and config folders added , make file is added

This commit is contained in:
2021-06-21 13:42:47 +02:00
parent caea75b0a8
commit 6a65c7af33
34 changed files with 1463 additions and 0 deletions

View File

@ -0,0 +1,5 @@
target_sources(${TARGET_NAME}
PRIVATE
InitMission.cpp
ObjectFactory.cpp
)

View File

@ -0,0 +1,167 @@
#include "../../bsp_linux/core/InitMission.h"
#include <OBSWConfig.h>
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h>
#include <iostream>
#include "../../bsp_linux/fsfwconfig/objects/systemObjectList.h"
#include "../../bsp_linux/fsfwconfig/OBSWConfig.h"
#include "../fsfwconfig/pollingsequence/PollingSequenceArduino.h"
void InitMission::createTasks(){
/* TMTC Distribution */
PeriodicTaskIF* distributerTask = TaskFactory::instance()->
createPeriodicTask("DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.100, nullptr);
ReturnValue_t result = distributerTask->addComponent(
objects::CCSDS_DISTRIBUTOR);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = distributerTask->addComponent(objects::TM_FUNNEL);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl;
}
/* UDP bridge */
PeriodicTaskIF* udpBridgeTask = TaskFactory::instance()->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.2, nullptr);
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
PeriodicTaskIF* udpPollingTask = TaskFactory::instance()->
createPeriodicTask("UDP_POLLING", 80,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr);
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
PeriodicTaskIF* eventTask = TaskFactory::instance()->
createPeriodicTask("EVENT", 20,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.100, nullptr);
result = eventTask->addComponent(objects::EVENT_MANAGER);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
/* PUS Services */
PeriodicTaskIF* pusVerification = TaskFactory::instance()->
createPeriodicTask("PUS_VERIF_1", 40,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusEvents = TaskFactory::instance()->
createPeriodicTask("PUS_VERIF_1", 60,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, nullptr);
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if(result != HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusHighPrio = TaskFactory::instance()->
createPeriodicTask("PUS_HIGH_PRIO", 50,
PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.200, nullptr);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusMedPrio = TaskFactory::instance()->
createPeriodicTask("PUS_HIGH_PRIO", 40,
PeriodicTaskIF::MINIMUM_STACK_SIZE,
0.8, nullptr);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
PeriodicTaskIF* pusLowPrio = TaskFactory::instance()->
createPeriodicTask("PUSB", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE,
1.6, nullptr);
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "Object add component failed" << std::endl;
}
FixedTimeslotTaskIF* arduinoTask = TaskFactory::instance()->
createFixedTimeslotTask("ARDUINO_TASK",40,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.102, nullptr);
result = pollingSequenceArduinoFunction(arduinoTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::createTasks:ArduinoPST initialization failed!"
<< std::endl;
}
#if OBSW_ADD_TEST_CODE == 1
FixedTimeslotTaskIF* testTimeslotTask = TaskFactory::instance()->
createFixedTimeslotTask("PST_TEST_TASK", 10,
PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = pst::pollingSequenceTestFunction(testTimeslotTask);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::createTasks: Test PST initialization "
<< "failed!" << std::endl;
}
PeriodicTaskIF* testTask = TaskFactory::instance()->
createPeriodicTask("TEST", 15, PeriodicTaskIF::MINIMUM_STACK_SIZE,
1.0, nullptr);
result = testTask->addComponent(objects::TEST_TASK);
if(result!=HasReturnvaluesIF::RETURN_OK){
sif::error << "InitMission::createTasks: Adding test task "
<< "failed" << std::endl;
}
#endif
//Main thread sleep
sif::debug << "Starting Tasks in 2 seconds" << std::endl;
TaskFactory::delayTask(2000);
distributerTask->startTask();
udpBridgeTask->startTask();
udpPollingTask->startTask();
//serializeTask->startTask();
arduinoTask->startTask();
//payloadTask->startTask();
eventTask->startTask();
pusVerification->startTask();
pusEvents->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pusLowPrio->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTimeslotTask->startTask();
testTask->startTask();
#endif
sif::debug << "Tasks started.." << std::endl;
}

View File

@ -0,0 +1,8 @@
#ifndef MISSION_CORE_INITMISSION_H_
#define MISSION_CORE_INITMISSION_H_
namespace InitMission {
void createTasks();
};
#endif /* MISSION_CORE_INITMISSION_H_ */

View File

@ -0,0 +1,86 @@
#include "../../bsp_linux/core/ObjectFactory.h"
#include <OBSWConfig.h>
#include <mission/utility/TmFunnel.h>
#include <mission/core/GenericFactory.h>
#include <fsfw/monitoring/MonitoringMessageContent.h>
#include <fsfw/osal/linux/TcUnixUdpPollingTask.h>
#include <fsfw/osal/linux/TmTcUnixUdpBridge.h>
#include <fsfw/storagemanager/PoolManager.h>
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include "../../bsp_linux/fsfwconfig/datapool/dataPoolInit.h"
#include "../../bsp_linux/fsfwconfig/objects/systemObjectList.h"
#include "../../bsp_linux/fsfwconfig/OBSWConfig.h"
#include "../../bsp_linux/fsfwconfig/tmtc/apid.h"
#include "../../bsp_linux/fsfwconfig/tmtc/pusIds.h"
#if OBSW_ADD_TEST_CODE == 1
#include <mission/test/TestTask.h>
#endif
void Factory::setStaticFrameworkObjectIds(){
MonitoringReportContent<float>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<double>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<uint32_t>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<int32_t>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<int16_t>::timeStamperId = objects::TIME_STAMPER;
MonitoringReportContent<uint16_t>::timeStamperId = objects::TIME_STAMPER;
TmFunnel::downlinkDestination = objects::UDP_BRIDGE;
// No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT;
PusServiceBase::packetSource = objects::PUS_DISTRIBUTOR;
PusServiceBase::packetDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
}
void ObjectFactory::produce(){
Factory::setStaticFrameworkObjectIds();
{
static constexpr uint8_t NUMBER_OF_POOLS = 5;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024};
const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::TC_STORE, element_sizes,
n_elements);
}
{
static constexpr uint8_t NUMBER_OF_POOLS = 5;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {16, 32, 64, 128, 1024};
const uint16_t n_elements[NUMBER_OF_POOLS] = {100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::TM_STORE, element_sizes,
n_elements);
}
{
static constexpr uint8_t NUMBER_OF_POOLS = 6;
const uint16_t element_sizes[NUMBER_OF_POOLS] = {32, 64, 512,
1024, 2048, 4096};
const uint16_t n_elements[NUMBER_OF_POOLS] = {200, 100, 50, 25, 15, 5};
new PoolManager<NUMBER_OF_POOLS>(objects::IPC_STORE, element_sizes,
n_elements);
}
ObjectFactory::produceGenericObjects();
/* TMTC Reception via UDP socket */
new TmTcUnixUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE);
new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
#if OBSW_ADD_TEST_CODE == 1
new TestTask(objects::TEST_TASK, false);
#endif
}

View File

@ -0,0 +1,17 @@
/*
* ObjectFactory.h
*
* Created on: Sep 22, 2020
* Author: steffen
*/
#ifndef MISSION_CORE_OBJECTFACTORY_H_
#define MISSION_CORE_OBJECTFACTORY_H_
namespace ObjectFactory {
void setStatics();
void produce();
};
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */