Alpha version of the code. Errors are still present in the code and the objects and dataused are picked as a test. Documentation of the code will be also added later.
This commit is contained in:
@ -6,7 +6,6 @@ target_sources(${TARGET_NAME}
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(fsfwconfig)
|
||||
add_subdirectory(utility)
|
||||
add_subdirectory(test)
|
||||
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PRIVATE
|
||||
|
@ -108,15 +108,27 @@ void InitMission::createTasks(){
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
sif::debug << "debug1: arduino tasks" << std::endl;
|
||||
FixedTimeslotTaskIF* arduinoTask = TaskFactory::instance()->
|
||||
createFixedTimeslotTask("ARDUINO_TASK",40,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.102, nullptr);
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 2, nullptr);
|
||||
result = pollingSequenceArduinoFunction(arduinoTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::createTasks:ArduinoPST initialization failed!"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
sif::debug << "debug2: arduino tasks" << std::endl;
|
||||
FixedTimeslotTaskIF* controllerTask = TaskFactory::instance()->
|
||||
createFixedTimeslotTask("CONTROLLER_TASK",40,
|
||||
PeriodicTaskIF::MINIMUM_STACK_SIZE, 3, nullptr);
|
||||
result = pollingSequenceControllerFunction(controllerTask);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::createTasks:ArduinoController initialization failed!"
|
||||
<< std::endl;
|
||||
}
|
||||
sif::debug << "debug3: arduino tasks" << std::endl;
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
FixedTimeslotTaskIF* testTimeslotTask = TaskFactory::instance()->
|
||||
@ -147,6 +159,9 @@ void InitMission::createTasks(){
|
||||
udpPollingTask->startTask();
|
||||
//serializeTask->startTask();
|
||||
arduinoTask->startTask();
|
||||
sif::debug << "debug4: arduino tasks" << std::endl;
|
||||
controllerTask->startTask();
|
||||
sif::debug << "debug5: arduino tasks" << std::endl;
|
||||
|
||||
//payloadTask->startTask();
|
||||
eventTask->startTask();
|
||||
|
@ -42,8 +42,6 @@ void Factory::setStaticFrameworkObjectIds(){
|
||||
TmPacketStored::timeStamperId = objects::TIME_STAMPER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ObjectFactory::produce(){
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
|
||||
|
@ -39,8 +39,75 @@ void dataPoolInit(std::map<uint32_t, PoolEntryIF*>* pool_map) {
|
||||
uint32_t t_CentroidTime_PoolId[2] = {0,0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::CentroidTime_PoolId,
|
||||
new PoolEntry<uint32_t>(t_CentroidTime_PoolId, 2)));
|
||||
*/
|
||||
new PoolEntry<uint32_t>(t_CentroidTime_PoolId, 2)));*/
|
||||
|
||||
//TODO: define your pool map entries here
|
||||
//Here the pool map entries of the Arduino DH are defined
|
||||
|
||||
float Temperature_value[36] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<float, PoolEntryIF*>(datapool::Temperature_value,
|
||||
new PoolEntry<float>(Temperature_value, 36)));
|
||||
unsigned int Temperature_Timestamp[36] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<unsigned int, PoolEntryIF*>(datapool::Temperature_Timestamp,
|
||||
new PoolEntry<unsigned int>(Temperature_Timestamp, 36)));
|
||||
float Environmental_value[9] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<float, PoolEntryIF*>(datapool::Environmental_value,
|
||||
new PoolEntry<float>(Environmental_value, 9)));
|
||||
unsigned int Environmental_Timestamp[9] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<unsigned int, PoolEntryIF*>(datapool::Environmental_Timestamp,
|
||||
new PoolEntry<unsigned int>(Environmental_Timestamp, 9)));
|
||||
float Accelerometer_value[15] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<float, PoolEntryIF*>(datapool::Accelerometer_value,
|
||||
new PoolEntry<float>(Accelerometer_value, 15)));
|
||||
unsigned int Accelerometer_Timestamp[15] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<unsigned int, PoolEntryIF*>(datapool::Accelerometer_Timestamp,
|
||||
new PoolEntry<unsigned int>(Accelerometer_Timestamp, 15)));
|
||||
|
||||
float TEMP_SENSOR_CH1[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<float, PoolEntryIF*>(datapool::TEMP_SENSOR_CH1,
|
||||
new PoolEntry<float>(TEMP_SENSOR_CH1, 1)));
|
||||
float TEMP_SENSOR_CH2[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<float, PoolEntryIF*>(datapool::TEMP_SENSOR_CH2,
|
||||
new PoolEntry<float>(TEMP_SENSOR_CH2, 1)));
|
||||
|
||||
/*uint32_t Temp_COMPONENT_1[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::Temp_COMPONENT_1,
|
||||
new PoolEntry<uint32_t>(Temp_COMPONENT_1, 1)));*/
|
||||
uint32_t TargetState_COMPONENT_1[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::TargetState_COMPONENT_1,
|
||||
new PoolEntry<uint32_t>(TargetState_COMPONENT_1, 1)));
|
||||
uint32_t CurrentState_COMPONENT_1[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::CurrentState_COMPONENT_1,
|
||||
new PoolEntry<uint32_t>(CurrentState_COMPONENT_1, 1)));
|
||||
uint32_t HeaterRequest_COMPONENT_1[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::HeaterRequest_COMPONENT_1,
|
||||
new PoolEntry<uint32_t>(HeaterRequest_COMPONENT_1, 1)));
|
||||
/*uint32_t Temp_COMPONENT_2[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::Temp_COMPONENT_2,
|
||||
new PoolEntry<uint32_t>(Temp_COMPONENT_2, 1)));*/
|
||||
uint32_t TargetState_COMPONENT_2[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::TargetState_COMPONENT_2,
|
||||
new PoolEntry<uint32_t>(TargetState_COMPONENT_2, 1)));
|
||||
uint32_t CurrentState_COMPONENT_2[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::CurrentState_COMPONENT_2,
|
||||
new PoolEntry<uint32_t>(CurrentState_COMPONENT_2, 1)));
|
||||
uint32_t HeaterRequest_COMPONENT_2[1] = {0};
|
||||
pool_map->insert(
|
||||
std::pair<uint32_t, PoolEntryIF*>(datapool::HeaterRequest_COMPONENT_2,
|
||||
new PoolEntry<uint32_t>(HeaterRequest_COMPONENT_2, 1)));
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
namespace datapool {
|
||||
enum opus_variable_id {
|
||||
NO_PARAMETER = 0x0, //This PID is used to denote a non-existing param in the OBSW (NOPARAME), Size: 1
|
||||
DUMMY1 = 0x100000,
|
||||
DUMMY2 = 0x100001,
|
||||
DUMMY3 = 0x100002,
|
||||
@ -21,10 +20,54 @@ namespace datapool {
|
||||
DUMMY6 = 0x100005,//TEST VAR
|
||||
LIMIT_VAR = 0x100006,
|
||||
TIME_STAMPER = 0x100007,
|
||||
//Centroid_PoolId = 0x100008,
|
||||
//CentroidTime_PoolId = 0x100009
|
||||
|
||||
/* The IDs of the variables of the Arduino serial output are here defined.*/
|
||||
|
||||
//TODO: add your unique datapool Ids here
|
||||
/*
|
||||
Temperature.start_string = 0x100008,
|
||||
Temperature.Typ = 0x100009,
|
||||
Temperature.SPCChNumber = 0x100010,
|
||||
Temperature.Value_Cnt = 0x100011,
|
||||
Temperature.temperature = 0x100012,
|
||||
Temperature.Timestamp = 0x100013,
|
||||
Temperature.end_string = 0x100014,
|
||||
|
||||
Environmental.start_string = 0x100015,
|
||||
Environmental.Typ = 0x100016,
|
||||
Environmental.SPCChNumber = 0x100017,
|
||||
Environmental.Value_Cnt = 0x100018,
|
||||
Environmental.Value = 0x100019,
|
||||
Environmental.Timestamp = 0x100020,
|
||||
Environmental.end_string = 0x100021,
|
||||
|
||||
Accelerometer.start_string = 0x100022,
|
||||
Accelerometer.Typ = 0x100023,
|
||||
Accelerometer.SPCChNumber = 0x100024,
|
||||
Accelerometer.Value_Cnt = 0x100025,
|
||||
Accelerometer.Value = 0x100026,
|
||||
Accelerometer.Timestamp = 0x100027,
|
||||
Accelerometer.end_string = 0x100028,
|
||||
*/
|
||||
|
||||
Temperature_value = 0x100008,
|
||||
Temperature_Timestamp = 0x100009,
|
||||
Environmental_value = 0x100010,
|
||||
Environmental_Timestamp = 0x100011,
|
||||
Accelerometer_value = 0x100012,
|
||||
Accelerometer_Timestamp = 0x100013,
|
||||
|
||||
TEMP_SENSOR_CH1 = 0x100014,
|
||||
TEMP_SENSOR_CH2 = 0x100015,
|
||||
|
||||
//Temp_COMPONENT_1 = 0x100098,
|
||||
TargetState_COMPONENT_1 = 0x100017,
|
||||
CurrentState_COMPONENT_1 = 0x100018,
|
||||
HeaterRequest_COMPONENT_1 = 0x100019,
|
||||
//Temp_COMPONENT_2 = 0x100099,
|
||||
TargetState_COMPONENT_2 = 0x100021,
|
||||
CurrentState_COMPONENT_2 = 0x100022,
|
||||
HeaterRequest_COMPONENT_2 = 0x100023
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,9 @@
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum {
|
||||
DUMMY = 10,
|
||||
//VISIBLE=11
|
||||
//TODO: add your subsystem id for your device here
|
||||
|
||||
// Here I add the ID of Arduino for TCS and eventual useful events.
|
||||
ARDUINO_TCS = 11,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -38,20 +38,28 @@ enum mission_objects {
|
||||
CCSDS_DISTRIBUTOR = 0x10,
|
||||
PUS_DISTRIBUTOR = 0x11,
|
||||
|
||||
|
||||
/****** 0x49 ('I') for Communication Interfaces *****/
|
||||
//TEST_ECHO_COM_IF = 0x4900AFFE,
|
||||
/**************** Test *********************/
|
||||
//TEST_DEVICE_HANDLER = 0x4400AFFE,
|
||||
//TEST_TASK = 0x4400CAFE,
|
||||
//TEST_DEVICE_SERIALIZE=0x4401CAFE,
|
||||
/**************** PCO *********************/
|
||||
//PCO_HANDLER= 0x12,
|
||||
//PCO_COMMIF=0x13,
|
||||
//CENTROID_INJECTOR=0x14,
|
||||
//CENTROID_WRITER = 0x15
|
||||
|
||||
//TODO: add the object ids for your device and your communication interface
|
||||
//Here the IDs of the DH and CONTROLLER
|
||||
|
||||
ARDUINO_DEVICE_HANDLER = 0x12,
|
||||
ARDUINO_COM_IF = 0x13,
|
||||
THERMAL_CONTROLLER = 0x14,
|
||||
POWER_SWITCHER_CONTROLLER = 0x15,
|
||||
|
||||
TCS_SENSOR_CH1 = 0x16,
|
||||
TCS_SENSOR_CH2 = 0x17,
|
||||
|
||||
TCS_COMPONENT_1 = 0X18,
|
||||
TCS_COMPONENT_2 = 0X19,
|
||||
|
||||
TCS_HEATER_1 = 0x20,
|
||||
TCS_REDUNDANT_HEATER_1 = 0x21,
|
||||
TCS_HEATER_2 = 0x22,
|
||||
TCS_REDUNDANT_HEATER_2 = 0x23,
|
||||
|
||||
TCS_SWITCH_1 = 0x24,
|
||||
TCS_SWITCH_1R = 0x25,
|
||||
TCS_SWITCH_2 = 0x26,
|
||||
TCS_SWITCH_2R = 0x27
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ class FixedTimeslotTaskIF;
|
||||
|
||||
|
||||
ReturnValue_t pollingSequenceArduinoFunction(FixedTimeslotTaskIF *thisSequence);
|
||||
ReturnValue_t pollingSequenceControllerFunction(FixedTimeslotTaskIF *thisSequence);
|
||||
|
||||
|
||||
|
||||
|
@ -16,19 +16,16 @@ ReturnValue_t pollingSequenceArduinoFunction(
|
||||
FixedTimeslotTaskIF* thisSequence){
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
//thisSequence->addSlot(objects::CENTROID_INJECTOR, length * 0, 2);
|
||||
//thisSequence->addSlot(objects::CENTROID_WRITER, length * 0.1, 2);
|
||||
thisSequence->addSlot(objects::ARDUINO_HANDLER, length * 0, 0);
|
||||
thisSequence->addSlot(objects::ARDUINO_HANDLER, length * 0.2, 1);
|
||||
thisSequence->addSlot(objects::ARDUINO_HANDLER, length * 0.4, 2);
|
||||
thisSequence->addSlot(objects::ARDUINO_HANDLER, length * 0.6, 3);
|
||||
//thisSequence->addSlot(objects::CENTROID_WRITER, length * 0.1, 2);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0, 0);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.2, 1);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.4, 2);
|
||||
thisSequence->addSlot(objects::ARDUINO_DEVICE_HANDLER, length * 0.6, 3);
|
||||
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
else {
|
||||
sif::error << "pollingSequenceCentroidFunction::initialize has errors!"
|
||||
sif::error << "pollingSequenceArduinoFunction::initialize has errors!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* PollingSequenceCentroidFunction.cpp
|
||||
*
|
||||
* Created on: May 1, 2021
|
||||
* Author: mala
|
||||
*/
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <fsfw/controller/ControllerBase.h>
|
||||
#include "../../../bsp_linux/fsfwconfig/objects/systemObjectList.h"
|
||||
#include "../../../bsp_linux/fsfwconfig/OBSWConfig.h"
|
||||
#include "PollingSequenceArduino.h"
|
||||
ReturnValue_t pollingSequenceControllerFunction(
|
||||
FixedTimeslotTaskIF* thisSequence){
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
thisSequence->addSlot(objects::THERMAL_CONTROLLER, length * 1, 0);
|
||||
//thisSequence->addSlot(objects::THERMAL_CONTROLLER, length * 0.2, 1);
|
||||
//thisSequence->addSlot(objects::THERMAL_CONTROLLER, length * 0.4, 2);
|
||||
//thisSequence->addSlot(objects::THERMAL_CONTROLLER, length * 0.6, 3);
|
||||
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
else {
|
||||
sif::error << "pollingSequenceControllerFunction::initialize has errors!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,8 @@ namespace CLASS_ID {
|
||||
enum {
|
||||
DUMMY_HANDLER = FW_CLASS_ID_COUNT, //DDH
|
||||
//VISIBLE_HANDLER_CLASS=FW_CLASS_ID_COUNT+1
|
||||
//TODO: add your arduino handler class id
|
||||
ARDUINO_DH = FW_CLASS_ID_COUNT+1,
|
||||
THERMAL_CONTROLLER = FW_CLASS_ID_COUNT+2
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <bsp_linux/core/InitMission.h>
|
||||
#include <bsp_linux/core/ObjectFactory.h>
|
||||
|
||||
#include <mission/test/MutexExample.h>
|
||||
//#include <mission/test/MutexExample.h>
|
||||
#include <mission/utility/PusPacketCreator.h>
|
||||
|
||||
#include <iostream>
|
||||
@ -39,9 +39,12 @@ int main() {
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
|
||||
objectManager = new ObjectManager(ObjectFactory::produce);
|
||||
sif::debug << "debug_MAIN: object produced" << std::endl;
|
||||
objectManager->initialize();
|
||||
sif::debug << "debug_MAIN: object initialized" << std::endl;
|
||||
InitMission::createTasks();
|
||||
MutexExample::example();
|
||||
sif::debug << "debug_MAIN: tasks created" << std::endl;
|
||||
//MutexExample::example();
|
||||
PusPacketCreator::createPusPacketAndPrint();
|
||||
|
||||
// Permanent loop.
|
||||
|
Reference in New Issue
Block a user