updated init mission of hosted bsp
and executed lwGPS test
This commit is contained in:
parent
da30b270c4
commit
02ac9b1fa5
@ -15,7 +15,6 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// This is configured for linux without \cr
|
||||
#ifdef LINUX
|
||||
ServiceInterfaceStream sif::debug("DEBUG");
|
||||
ServiceInterfaceStream sif::info("INFO");
|
||||
@ -41,117 +40,120 @@ void initmission::initMission() {
|
||||
initTasks();
|
||||
}
|
||||
|
||||
void initmission::initTasks(){
|
||||
void initmission::initTasks() {
|
||||
TaskFactory* factory = TaskFactory::instance();
|
||||
if(factory == nullptr) {
|
||||
/* Should never happen ! */
|
||||
return;
|
||||
}
|
||||
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
||||
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
|
||||
#else
|
||||
void (*missedDeadlineFunc) (void) = nullptr;
|
||||
#endif
|
||||
|
||||
/* TMTC Distribution */
|
||||
PeriodicTaskIF* TmTcDistributor = TaskFactory::instance()->
|
||||
createPeriodicTask("DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE,
|
||||
0.100, nullptr);
|
||||
ReturnValue_t result = TmTcDistributor->addComponent(
|
||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
ReturnValue_t result = tmTcDistributor->addComponent(
|
||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
result = TmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
}
|
||||
result = TmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||
result = tmTcDistributor->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);
|
||||
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||
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);
|
||||
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Add component UDP Polling 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);
|
||||
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
|
||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
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);
|
||||
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
|
||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||
sif::error << "Object add component failed" << std::endl;
|
||||
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
#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);
|
||||
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
|
||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::createTasks: Test PST initialization "
|
||||
<< "failed!" << std::endl;
|
||||
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||
}
|
||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||
}
|
||||
#endif
|
||||
|
||||
//Main thread sleep
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
TmTcDistributor->startTask();
|
||||
UdpBridgeTask->startTask();
|
||||
UdpPollingTask->startTask();
|
||||
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
|
||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||
}
|
||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||
}
|
||||
|
||||
PusVerification->startTask();
|
||||
PusEvents->startTask();
|
||||
PusHighPrio->startTask();
|
||||
PusMedPrio->startTask();
|
||||
PusLowPrio->startTask();
|
||||
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
|
||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||
}
|
||||
|
||||
PeriodicTaskIF* testTask = factory->createPeriodicTask(
|
||||
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
TestTimeslotTask->startTask();
|
||||
#endif
|
||||
result = testTask->addComponent(objects::TEST_TASK);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||
}
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
|
||||
sif::info << "Starting tasks.." << std::endl;
|
||||
tmTcDistributor->startTask();
|
||||
udpBridgeTask->startTask();
|
||||
udpPollingTask->startTask();
|
||||
|
||||
pusVerification->startTask();
|
||||
pusEvents->startTask();
|
||||
pusHighPrio->startTask();
|
||||
pusMedPrio->startTask();
|
||||
pusLowPrio->startTask();
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
testTask->startTask();
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
|
||||
sif::info << "Tasks started.." << std::endl;
|
||||
}
|
||||
|
@ -6,7 +6,9 @@
|
||||
#ifndef CONFIG_OBSWCONFIG_H_
|
||||
#define CONFIG_OBSWCONFIG_H_
|
||||
|
||||
#define OBSW_ADD_TEST_CODE 0
|
||||
#include "commonConfig.h"
|
||||
|
||||
#define OBSW_ADD_TEST_CODE 1
|
||||
|
||||
/* These defines should be disabled for mission code but are useful for
|
||||
debugging. */
|
||||
|
@ -0,0 +1,3 @@
|
||||
target_include_directories(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
7
common/config/commonConfig.h
Normal file
7
common/config/commonConfig.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef COMMON_CONFIG_COMMONCONFIG_H_
|
||||
#define COMMON_CONFIG_COMMONCONFIG_H_
|
||||
|
||||
#define OBSW_ADD_LWGPS_TEST 0
|
||||
|
||||
|
||||
#endif /* COMMON_CONFIG_COMMONCONFIG_H_ */
|
@ -9,6 +9,7 @@
|
||||
#ifdef RASPBERRY_PI
|
||||
#include <rpi_config.h>
|
||||
#endif
|
||||
#include "commonConfig.h"
|
||||
#include "OBSWVersion.h"
|
||||
|
||||
/* These defines should be disabled for mission code but are useful for
|
||||
|
@ -4,7 +4,7 @@
|
||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
|
||||
@ -18,7 +18,7 @@
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/eive_obsw"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug-Host/eive_obsw.exe"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive_obsw"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443"/>
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include <test/testtasks/TestTask.h>
|
||||
#include "TestTask.h"
|
||||
#include <OBSWConfig.h>
|
||||
|
||||
#include <fsfw/objectmanager/frameworkObjects.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
@ -42,11 +44,32 @@ ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
|
||||
}
|
||||
|
||||
#include <etl/vector.h>
|
||||
#include <lwgps/lwgps.h>
|
||||
|
||||
/**
|
||||
* @brief Dummy data from GPS receiver. Will be replaced witgh hyperion data later.
|
||||
*/
|
||||
const char
|
||||
gps_rx_data[] = ""
|
||||
"$GPRMC,183729,A,3907.356,N,12102.482,W,000.0,360.0,080301,015.5,E*6F\r\n"
|
||||
"$GPRMB,A,,,,,,,,,,,,V*71\r\n"
|
||||
"$GPGGA,183730,3907.356,N,12102.482,W,1,05,1.6,646.4,M,-24.1,M,,*75\r\n"
|
||||
"$GPGSA,A,3,02,,,07,,09,24,26,,,,,1.6,1.6,1.0*3D\r\n"
|
||||
"$GPGSV,2,1,08,02,43,088,38,04,42,145,00,05,11,291,00,07,60,043,35*71\r\n"
|
||||
"$GPGSV,2,2,08,08,02,145,00,09,46,303,47,24,16,178,32,26,18,231,43*77\r\n"
|
||||
"$PGRME,22.0,M,52.9,M,51.0,M*14\r\n"
|
||||
"$GPGLL,3907.360,N,12102.481,W,183730,A*33\r\n"
|
||||
"$PGRMZ,2062,f,3*2D\r\n"
|
||||
"$PGRMM,WGS84*06\r\n"
|
||||
"$GPBOD,,T,,M,,*47\r\n"
|
||||
"$GPRTE,1,1,c,0*07\r\n"
|
||||
"$GPRMC,183731,A,3907.482,N,12102.436,W,000.0,360.0,080301,015.5,E*67\r\n"
|
||||
"$GPRMB,A,,,,,,,,,,,,V*71\r\n";
|
||||
|
||||
ReturnValue_t TestTask::performOneShotAction() {
|
||||
/* Everything here will only be performed once. */
|
||||
etl::vector<uint8_t, 30> testVec;
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
performLwgpsTest();
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -67,3 +90,19 @@ ReturnValue_t TestTask::performActionB() {
|
||||
/* Add periodically executed code here */
|
||||
return result;
|
||||
}
|
||||
|
||||
void TestTask::performLwgpsTest() {
|
||||
/* Everything here will only be performed once. */
|
||||
etl::vector<uint8_t, 30> testVec;
|
||||
|
||||
lwgps_t gpsStruct;
|
||||
|
||||
/* Process all input data */
|
||||
lwgps_process(&gpsStruct, gps_rx_data, strlen(gps_rx_data));
|
||||
|
||||
/* Print messages */
|
||||
printf("Valid status: %d\r\n", gpsStruct.is_valid);
|
||||
printf("Latitude: %f degrees\r\n", gpsStruct.latitude);
|
||||
printf("Longitude: %f degrees\r\n", gpsStruct.longitude);
|
||||
printf("Altitude: %f meters\r\n", gpsStruct.altitude);
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ private:
|
||||
// Let's keep it simple for now.
|
||||
bool oneShotAction = true;
|
||||
StorageManagerIF* IPCStore;
|
||||
|
||||
void performLwgpsTest();
|
||||
};
|
||||
|
||||
|
||||
|
2
thirdparty/lwgps
vendored
2
thirdparty/lwgps
vendored
@ -1 +1 @@
|
||||
Subproject commit adce7a203268ca809fa61e6e286e62ff25edeb34
|
||||
Subproject commit ceba10e5616b6419a3b61ea2d608ad345d49b1e2
|
Loading…
Reference in New Issue
Block a user