gps improvements
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-05-02 23:52:53 +02:00
parent 9dc382706a
commit c1d754d8ff
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 37 additions and 33 deletions

2
fsfw

@ -1 +1 @@
Subproject commit d61fe7db93b37dd6652dbfee5b7c93f400ac5a11
Subproject commit 7f6c8b8b123a63546de0d73f0de35900d6c806bf

View File

@ -107,6 +107,7 @@ ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *m
}
#ifdef FSFW_OSAL_LINUX
void GPSHyperionLinuxController::readGpsDataFromGpsd() {
gpsmm gpsmm("localhost", DEFAULT_GPSD_PORT);
// The data from the device will generally be read all at once. Therefore, we
@ -125,45 +126,45 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
}
// Stopwatch watch;
gps_data_t *gps = nullptr;
gps = gpsmm.stream(WATCH_ENABLE | WATCH_JSON);
gpsmm.stream(WATCH_ENABLE | WATCH_JSON);
if(not gpsmm.waiting(50000000)) {
return;
}
gps = gpsmm.read();
if (gps == nullptr) {
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd:: Setting GPSD watch "
"policy failed"
<< std::endl;
}
while (gpsmm.waiting(2000)) {
gps = gpsmm.read();
if (gps == nullptr) {
if (gpsReadFailedSwitch) {
gpsReadFailedSwitch = false;
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed"
<< std::endl;
}
return;
}
if (MODE_SET != (MODE_SET & gps->set)) {
if (noModeSetCntr >= 0) {
noModeSetCntr++;
}
if (noModeSetCntr == 10) {
// TODO: Trigger event here
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: No mode could be "
"read for 10 consecutive reads"
<< std::endl;
noModeSetCntr = -1;
}
return;
} else {
noModeSetCntr = 0;
if (gpsReadFailedSwitch) {
gpsReadFailedSwitch = false;
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed"
<< std::endl;
}
return;
}
gps = gpsmm.stream(WATCH_DISABLE);
if (MODE_SET != (MODE_SET & gps->set)) {
if (noModeSetCntr >= 0) {
noModeSetCntr++;
}
if (noModeSetCntr == 10) {
// TODO: Trigger event here
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: No mode could be "
"read for 10 consecutive reads"
<< std::endl;
noModeSetCntr = -1;
}
return;
} else {
noModeSetCntr = 0;
}
handleGpsRead(gps);
}
ReturnValue_t GPSHyperionLinuxController::handleGpsRead(gps_data_t* gps) {
PoolReadGuard pg(&gpsSet);
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading dataset failed" << std::endl;
#endif
return;
return RETURN_FAILED;
}
bool validFix = false;
@ -292,5 +293,7 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
std::tm tm = *std::gmtime(&t);
std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl;
}
return RETURN_OK;
}
#endif

View File

@ -47,6 +47,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
ReturnValue_t handleGpsRead(gps_data_t* gps);
private:
GpsPrimaryDataset gpsSet;
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);

2
tmtc

@ -1 +1 @@
Subproject commit 168b662288175f9db77a5796a02f38cb66911092
Subproject commit 0a47c17fa699dc571d2d3e63ec08c9f4cf513f65