RTD update and TCP server in hosted build #65

Merged
meierj merged 12 commits from mueller/staging-rtd-update-hosted-tcp into develop 2021-07-29 09:07:50 +02:00
11 changed files with 61 additions and 45 deletions

View File

@ -187,6 +187,12 @@ tmux new -s q7s-serial
q7s_serial q7s_serial
``` ```
Other useful tmux commands:
- Enable scroll mode: You can press `ctrl + b` and then `[` (`AltGr + 8`) to enable scroll mode.
You can quit scroll mode with `q`.
- Kill a tmux session: run `ctrl + b` and then `k`.
- Detach from a tmux session: run `ctrl + b` and then `d`
### SSH console ### SSH console
You can use the following command to connect to the Q7S with `ssh`: You can use the following command to connect to the Q7S with `ssh`:

View File

@ -70,15 +70,15 @@ void initmission::initTasks() {
} }
/* UDP bridge */ /* UDP bridge */
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = udpBridgeTask->addComponent(objects::TMTC_BRIDGE); result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl; sif::error << "Add component UDP Unix Bridge failed" << std::endl;
} }
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); "UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::TMTC_POLLING_TASK); result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Polling failed" << std::endl; sif::error << "Add component UDP Polling failed" << std::endl;
} }
@ -142,8 +142,8 @@ void initmission::initTasks() {
sif::info << "Starting tasks.." << std::endl; sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask(); tmTcDistributor->startTask();
udpBridgeTask->startTask(); tmtcBridgeTask->startTask();
udpPollingTask->startTask(); tmtcPollingTask->startTask();
pusVerification->startTask(); pusVerification->startTask();
pusEvents->startTask(); pusEvents->startTask();

View File

@ -1,6 +1,5 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include "OBSWConfig.h"
#include <OBSWConfig.h>
#include <objects/systemObjectList.h> #include <objects/systemObjectList.h>
#include <tmtc/apid.h> #include <tmtc/apid.h>
#include <tmtc/pusIds.h> #include <tmtc/pusIds.h>
@ -11,8 +10,13 @@
#include <mission/core/GenericFactory.h> #include <mission/core/GenericFactory.h>
#include <mission/utility/TmFunnel.h> #include <mission/utility/TmFunnel.h>
#include <fsfw/osal/common/UdpTcPollingTask.h> #if OBSW_USE_TMTC_TCP_BRIDGE == 0
#include <fsfw/osal/common/UdpTmTcBridge.h> #include "fsfw/osal/common/UdpTcPollingTask.h"
#include "fsfw/osal/common/UdpTmTcBridge.h"
#else
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#include <fsfw/tmtcpacket/pus/tm.h> #include <fsfw/tmtcpacket/pus/tm.h>
@ -40,7 +44,18 @@ void ObjectFactory::produce(void* args){
Factory::setStaticFrameworkObjectIds(); Factory::setStaticFrameworkObjectIds();
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
sif::info << "Setting up UDP TMTC bridge with listener port " <<
UdpTmTcBridge::DEFAULT_SERVER_PORT << std::endl;
new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#else
sif::info << "Setting up TCP TMTC bridge with listener port " <<
TcpTmTcBridge::DEFAULT_SERVER_PORT << std::endl;
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#endif
new TestTask(objects::TEST_TASK);
} }

View File

@ -1,9 +1,10 @@
#include "InitMission.h" #include "InitMission.h"
#include "OBSWVersion.h"
#include "fsfw/FSFWVersion.h"
#include "fsfw/tasks/TaskFactory.h"
#include <OBSWVersion.h>
#include <fsfw/tasks/TaskFactory.h>
#include <iostream> #include <iostream>
#ifdef WIN32 #ifdef WIN32
static const char* COMPILE_PRINTOUT = "Windows"; static const char* COMPILE_PRINTOUT = "Windows";
#elif LINUX #elif LINUX
@ -20,8 +21,9 @@ int main(void)
{ {
std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl; std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "." std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
<< SW_SUBVERSION << "." << SW_REVISION << " -- " << std::endl; "." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
FSFW_REVISION << "--" << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
initmission::initMission(); initmission::initMission();

View File

@ -360,10 +360,10 @@ void CoreController::initPrint() {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
#if OBSW_USE_TMTC_TCP_BRIDGE == 0 #if OBSW_USE_TMTC_TCP_BRIDGE == 0
sif::info << "Created UDP server for TMTC commanding with listener port " << sif::info << "Created UDP server for TMTC commanding with listener port " <<
UdpTmTcBridge::DEFAULT_UDP_SERVER_PORT << std::endl; UdpTmTcBridge::DEFAULT_SERVER_PORT << std::endl;
#else #else
sif::info << "Created TCP server for TMTC commanding with listener port " << sif::info << "Created TCP server for TMTC commanding with listener port " <<
TcpTmTcBridge::DEFAULT_TCP_SERVER_PORT << std::endl; TcpTmTcBridge::DEFAULT_SERVER_PORT << std::endl;
#endif #endif
#endif #endif
} }

View File

@ -1,6 +1,10 @@
#ifndef COMMON_CONFIG_COMMONCONFIG_H_ #ifndef COMMON_CONFIG_COMMONCONFIG_H_
#define COMMON_CONFIG_COMMONCONFIG_H_ #define COMMON_CONFIG_COMMONCONFIG_H_
#define OBSW_ADD_LWGPS_TEST 0 #define OBSW_ADD_LWGPS_TEST 0
// Use TCP instead of UDP for the TMTC bridge. This allows using the TMTC client locally
// because UDP packets are not allowed in the VPN
#define OBSW_USE_TMTC_TCP_BRIDGE 0
#endif /* COMMON_CONFIG_COMMONCONFIG_H_ */ #endif /* COMMON_CONFIG_COMMONCONFIG_H_ */

2
fsfw

@ -1 +1 @@
Subproject commit 1f6a5e635fcd6bd812e262cc65a15a8a054f7ecf Subproject commit 54c028f913e81077855aa1ed727bac43e7efea82

View File

@ -18,10 +18,6 @@
debugging. */ debugging. */
#define OBSW_VERBOSE_LEVEL 1 #define OBSW_VERBOSE_LEVEL 1
// Use TCP instead of UDP for the TMTC bridge. This allows using the TMTC client locally
// because UDP packets are not allowed in the VPN
#define OBSW_USE_TMTC_TCP_BRIDGE 0
#define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_ADD_TEST_CODE 1 #define OBSW_ADD_TEST_CODE 1
#define OBSW_ADD_TEST_PST 1 #define OBSW_ADD_TEST_PST 1

View File

@ -1,5 +1,7 @@
#include "Max31865PT1000Handler.h" #include "Max31865PT1000Handler.h"
#include "fsfw/datapool/PoolReadGuard.h"
#include <bitset> #include <bitset>
#include <cmath> #include <cmath>
@ -360,7 +362,6 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
// do something with rtd value, will propably be stored in // do something with rtd value, will propably be stored in
// dataset. // dataset.
float rtdValue = adcCode * RTD_RREF_PT1000 / INT16_MAX; float rtdValue = adcCode * RTD_RREF_PT1000 / INT16_MAX;
// calculate approximation // calculate approximation
float approxTemp = adcCode / 32.0 - 256.0; float approxTemp = adcCode / 32.0 - 256.0;
@ -369,7 +370,7 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Max31865PT1000Handler::interpretDeviceReply: Measured " sif::info << "Max31865PT1000Handler::interpretDeviceReply: Measured "
<< "resistance is " << rtdValue << " Ohms." << std::endl; << "resistance is " << rtdValue << " Ohms." << std::endl;
sif::info << "Approximated temperature is " << approxTemp << " °C" sif::info << "Approximated temperature is " << approxTemp << " C"
<< std::endl; << std::endl;
#else #else
sif::printInfo("Max31865PT1000Handler::interpretDeviceReply: Measured resistance is %f" sif::printInfo("Max31865PT1000Handler::interpretDeviceReply: Measured resistance is %f"
@ -380,8 +381,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
} }
#endif #endif
ReturnValue_t result = sensorDataset.read(); PoolReadGuard pg(&sensorDataset);
if(result != HasReturnvaluesIF::RETURN_OK) { if(pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
// Configuration error // Configuration error
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!" sif::debug << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!"
@ -389,29 +390,17 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
#else #else
sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!\n"); sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!\n");
#endif #endif
return result; return pg.getReadResult();
} }
if(not sensorDataset.isValid()) { if(not sensorDataset.isValid()) {
sensorDataset.setValidity(true, false);
sensorDataset.rtdValue.setValid(true);
sensorDataset.temperatureCelcius.setValid(true); sensorDataset.temperatureCelcius.setValid(true);
} }
sensorDataset.rtdValue = rtdValue;
sensorDataset.temperatureCelcius = approxTemp; sensorDataset.temperatureCelcius = approxTemp;
result = sensorDataset.commit();
if(result != HasReturnvaluesIF::RETURN_OK) {
// Configuration error
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "Max31865PT1000Handler::interpretDeviceReply: "
"Error commiting dataset!" << std::endl;
#else
sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: "
"Error commiting dataset!\n");
#endif
return result;
}
break; break;
} }
case(Max31865Definitions::REQUEST_FAULT_BYTE): { case(Max31865Definitions::REQUEST_FAULT_BYTE): {
@ -485,6 +474,7 @@ void Max31865PT1000Handler::doTransition(Mode_t modeFrom,
ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(Max31865Definitions::PoolIds::RTD_VALUE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(Max31865Definitions::PoolIds::TEMPERATURE_C, localDataPoolMap.emplace(Max31865Definitions::PoolIds::TEMPERATURE_C,
new PoolEntry<float>({0}, 1, true)); new PoolEntry<float>({0}, 1, true));
localDataPoolMap.emplace(Max31865Definitions::PoolIds::FAULT_BYTE, localDataPoolMap.emplace(Max31865Definitions::PoolIds::FAULT_BYTE,

View File

@ -9,6 +9,7 @@
namespace Max31865Definitions { namespace Max31865Definitions {
enum PoolIds: lp_id_t { enum PoolIds: lp_id_t {
RTD_VALUE,
TEMPERATURE_C, TEMPERATURE_C,
FAULT_BYTE FAULT_BYTE
}; };
@ -46,6 +47,8 @@ public:
StaticLocalDataSet(sid_t(objectId, MAX31865_SET_ID)) { StaticLocalDataSet(sid_t(objectId, MAX31865_SET_ID)) {
} }
lp_var_t<float> rtdValue = lp_var_t<float>(sid.objectId,
PoolIds::RTD_VALUE, this);
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId, lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId,
PoolIds::TEMPERATURE_C, this); PoolIds::TEMPERATURE_C, this);
lp_var_t<uint8_t> errorByte = lp_var_t<uint8_t>(sid.objectId, lp_var_t<uint8_t> errorByte = lp_var_t<uint8_t>(sid.objectId,

2
tmtc

@ -1 +1 @@
Subproject commit 6352a6f272b3138257831fcd1f5d9ffcd4902681 Subproject commit 8b7331c210e44bf2a60e5834f5f253514dae29fe