adaptions for gpsd 3.17
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2022-04-18 00:25:33 +02:00
parent be2834cb1a
commit a4c5d8de45
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 14 additions and 11 deletions

View File

@ -103,6 +103,7 @@ if(TGT_BSP)
OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse"
OR TGT_BSP MATCHES "arm/te0720-1cfa"
)
find_library(${LIB_GPS} gps)
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
if(NOT BUILD_Q7S_SIMPLE_MODE)
set(EIVE_ADD_LINUX_FILES TRUE)
@ -310,8 +311,8 @@ target_link_libraries(${OBSW_NAME} PRIVATE
if(TGT_BSP MATCHES "arm/q7s")
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
${LIB_ARCSEC}
${LIB_GPS}
${LIB_ARCSEC}
)
endif()
@ -407,6 +408,5 @@ add_custom_command(
COMMENT ${POST_BUILD_COMMENT}
)
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
set_build_type()

View File

@ -246,7 +246,7 @@ void Q7STestTask::testGpsDaemon() {
sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl;
}
sif::info << "-- Q7STestTask: GPS shared memory read test --" << std::endl;
time_t timeRaw = gps->fix.time.tv_sec;
time_t timeRaw = gps->fix.time;
std::tm* time = gmtime(&timeRaw);
sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl;
sif::info << "Visible satellites: " << gps->satellites_visible << std::endl;
@ -254,7 +254,7 @@ void Q7STestTask::testGpsDaemon() {
sif::info << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl;
sif::info << "Latitude: " << gps->fix.latitude << std::endl;
sif::info << "Longitude: " << gps->fix.longitude << std::endl;
sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
sif::info << "Altitude(MSL): " << gps->fix.altitude << std::endl;
sif::info << "Speed(m/s): " << gps->fix.speed << std::endl;
}

View File

@ -18,7 +18,6 @@ GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, obj
bool debugHyperionGps)
: ExtendedControllerBase(objectId, objects::NO_OBJECT),
gpsSet(this),
myGpsmm(GPSD_SHARED_MEMORY, nullptr),
debugHyperionGps(debugHyperionGps) {
timeUpdateCd.resetTimer();
}
@ -107,14 +106,17 @@ ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *m
#ifdef FSFW_OSAL_LINUX
void GPSHyperionLinuxController::readGpsDataFromGpsd() {
gpsmm myGpsmm(GPSD_SHARED_MEMORY, nullptr);
// The data from the device will generally be read all at once. Therefore, we
// can set all field here
if (not myGpsmm.is_open()) {
if(gpsNotOpenSwitch) {
// Opening failed
#if FSFW_VERBOSE_LEVEL >= 1
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Opening GPSMM failed" << std::endl;
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Opening GPSMM failed | " <<
"Error " << errno << " | " << gps_errstr(errno) << std::endl;
#endif
gpsNotOpenSwitch = false;
}
return;
@ -189,10 +191,12 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
gpsSet.speed.setValid(false);
}
gpsSet.unixSeconds.value = gps->fix.time.tv_sec;
gpsSet.unixSeconds.value = gps->fix.time;
timeval time = {};
time.tv_sec = gpsSet.unixSeconds.value;
time.tv_usec = gps->fix.time.tv_nsec / 1000;
double fractionalPart = gpsSet.unixSeconds.value - gps->fix.time;
time.tv_usec = fractionalPart * 1000 * 1000;
//time.tv_usec = gps->fix.time.tv_nsec / 1000;
std::time_t t = std::time(nullptr);
if (time.tv_sec == t) {
timeIsConstantCounter++;
@ -231,7 +235,7 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
gpsSet.seconds = timeOfDay.second;
if (debugHyperionGps) {
sif::info << "-- Hyperion GPS Data --" << std::endl;
time_t timeRaw = gps->fix.time.tv_sec;
time_t timeRaw = gps->fix.time;
std::tm *time = gmtime(&timeRaw);
std::cout << "Time: " << std::put_time(time, "%c %Z") << std::endl;
std::cout << "Visible satellites: " << gps->satellites_visible << std::endl;
@ -239,7 +243,7 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
std::cout << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl;
std::cout << "Latitude: " << gps->fix.latitude << std::endl;
std::cout << "Longitude: " << gps->fix.longitude << std::endl;
std::cout << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
std::cout << "Altitude(MSL): " << gps->fix.altitude << std::endl;
std::cout << "Speed(m/s): " << gps->fix.speed << std::endl;
std::time_t t = std::time(nullptr);
std::tm tm = *std::gmtime(&t);

View File

@ -52,7 +52,6 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
bool modeCommanded = true;
bool timeInit = true;
gpsmm myGpsmm;
bool gpsNotOpenSwitch = true;
bool gpsReadFailedSwitch = true;
bool debugHyperionGps = false;