more ACS cleaning
- STR code is now in mission folder, but still only conpiled for Q7S code because wire library is proprietary
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
target_sources(${OBSW_NAME} PUBLIC AcsBoardPolling.cpp ImtqPollingTask.cpp
|
||||
RwPollingTask.cpp SusPolling.cpp)
|
||||
target_sources(
|
||||
${OBSW_NAME} PUBLIC AcsBoardPolling.cpp ImtqPollingTask.cpp RwPollingTask.cpp
|
||||
SusPolling.cpp StrComHandler.cpp)
|
||||
|
||||
# Dependency on proprietary library
|
||||
if(TGT_BSP MATCHES "arm/q7s")
|
||||
add_subdirectory(startracker)
|
||||
if(EIVE_BUILD_GPSD_GPS_HANDLER)
|
||||
target_sources(${OBSW_NAME} PRIVATE GpsHyperionLinuxController.cpp)
|
||||
endif()
|
||||
|
382
linux/acs/GpsHyperionLinuxController.cpp
Normal file
382
linux/acs/GpsHyperionLinuxController.cpp
Normal file
@ -0,0 +1,382 @@
|
||||
#include "GpsHyperionLinuxController.h"
|
||||
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
#include "linux/utility/utility.h"
|
||||
#include "mission/utility/compileTime.h"
|
||||
|
||||
#if FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV == 1
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#endif
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
|
||||
GpsHyperionLinuxController::GpsHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
||||
bool debugHyperionGps)
|
||||
: ExtendedControllerBase(objectId), gpsSet(this), debugHyperionGps(debugHyperionGps) {}
|
||||
|
||||
GpsHyperionLinuxController::~GpsHyperionLinuxController() {
|
||||
gps_stream(&gps, WATCH_DISABLE, nullptr);
|
||||
gps_close(&gps);
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase *GpsHyperionLinuxController::getDataSetHandle(sid_t sid) { return &gpsSet; }
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode) {
|
||||
if (not modeCommanded) {
|
||||
if (mode == MODE_ON or mode == MODE_OFF) {
|
||||
// 5h time to reach fix
|
||||
*msToReachTheMode = MAX_SECONDS_TO_REACH_FIX;
|
||||
maxTimeToReachFix.resetTimer();
|
||||
modeCommanded = true;
|
||||
} else if (mode == MODE_NORMAL) {
|
||||
return HasModesIF::INVALID_MODE;
|
||||
}
|
||||
}
|
||||
if (mode == MODE_OFF) {
|
||||
PoolReadGuard pg(&gpsSet);
|
||||
gpsSet.setValidity(false, true);
|
||||
// There can't be a fix with a device that is off.
|
||||
triggerEvent(GpsHyperion::GPS_FIX_CHANGE, gpsSet.fixMode.value, 0);
|
||||
gpsSet.fixMode.value = 0;
|
||||
oneShotSwitches.reset();
|
||||
modeCommanded = false;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size) {
|
||||
switch (actionId) {
|
||||
case (GpsHyperion::TRIGGER_RESET_PIN_GNSS): {
|
||||
if (resetCallback != nullptr) {
|
||||
PoolReadGuard pg(&gpsSet);
|
||||
// Set HK entries invalid
|
||||
gpsSet.setValidity(false, true);
|
||||
resetCallback(data, size, resetCallbackArgs);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(GpsHyperion::ALTITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::LONGITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::LATITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::SPEED, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::YEAR, new PoolEntry<uint16_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::MONTH, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::DAY, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::HOURS, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::MINUTES, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::SECONDS, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::UNIX_SECONDS, new PoolEntry<uint32_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>());
|
||||
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
|
||||
poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), false, 30.0});
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void GpsHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallback,
|
||||
void *args) {
|
||||
this->resetCallback = resetCallback;
|
||||
resetCallbackArgs = args;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::performOperation(uint8_t opCode) {
|
||||
handleQueue();
|
||||
poolManager.performHkOperation();
|
||||
while (true) {
|
||||
#if OBSW_THREAD_TRACING == 1
|
||||
trace::threadTrace(opCounter, "GPS CTRL");
|
||||
#endif
|
||||
bool callAgainImmediately = readGpsDataFromGpsd();
|
||||
if (not callAgainImmediately) {
|
||||
handleQueue();
|
||||
poolManager.performHkOperation();
|
||||
TaskFactory::delayTask(250);
|
||||
}
|
||||
}
|
||||
// Should never be reached.
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::initialize() {
|
||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
auto openError = [&](const char *type, int error) {
|
||||
// Opening failed
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Opening GPSMM " << type
|
||||
<< " failed | Error " << error << " | " << gps_errstr(error) << std::endl;
|
||||
#endif
|
||||
};
|
||||
if (readMode == ReadModes::SOCKET) {
|
||||
int retval = gps_open("localhost", DEFAULT_GPSD_PORT, &gps);
|
||||
if (retval != 0) {
|
||||
openError("Socket", retval);
|
||||
return ObjectManager::CHILD_INIT_FAILED;
|
||||
}
|
||||
gps_stream(&gps, WATCH_ENABLE | WATCH_JSON, nullptr);
|
||||
} else if (readMode == ReadModes::SHM) {
|
||||
int retval = gps_open(GPSD_SHARED_MEMORY, "", &gps);
|
||||
if (retval != 0) {
|
||||
openError("SHM", retval);
|
||||
return ObjectManager::CHILD_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::handleCommandMessage(CommandMessage *message) {
|
||||
return ExtendedControllerBase::handleCommandMessage(message);
|
||||
}
|
||||
|
||||
void GpsHyperionLinuxController::performControlOperation() {}
|
||||
|
||||
bool GpsHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
auto readError = [&]() {
|
||||
if (oneShotSwitches.gpsReadFailedSwitch) {
|
||||
oneShotSwitches.gpsReadFailedSwitch = false;
|
||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed | "
|
||||
"Error "
|
||||
<< errno << " | " << gps_errstr(errno) << std::endl;
|
||||
}
|
||||
};
|
||||
// GPS is off, no point in reading data from GPSD.
|
||||
if (mode == MODE_OFF) {
|
||||
return false;
|
||||
}
|
||||
if (readMode == ReadModes::SOCKET) {
|
||||
// Poll the GPS.
|
||||
if (gps_waiting(&gps, 0)) {
|
||||
if (-1 == gps_read(&gps)) {
|
||||
readError();
|
||||
return false;
|
||||
}
|
||||
oneShotSwitches.gpsReadFailedSwitch = true;
|
||||
ReturnValue_t result = handleGpsReadData();
|
||||
if (result == returnvalue::OK) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
noModeSetCntr = 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (readMode == ReadModes::SHM) {
|
||||
sif::error << "GpsHyperionLinuxController::readGpsDataFromGpsdPermanentLoop: "
|
||||
"SHM read not implemented"
|
||||
<< std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
||||
bool modeIsSet = true;
|
||||
if (MODE_SET != (MODE_SET & gps.set)) {
|
||||
if (mode != MODE_OFF) {
|
||||
if (maxTimeToReachFix.hasTimedOut() and oneShotSwitches.cantGetFixSwitch) {
|
||||
sif::warning << "GpsHyperionLinuxController: No mode could be set in allowed "
|
||||
<< maxTimeToReachFix.getTimeoutMs() / 1000 << " seconds" << std::endl;
|
||||
triggerEvent(GpsHyperion::CANT_GET_FIX, maxTimeToReachFix.getTimeoutMs());
|
||||
oneShotSwitches.cantGetFixSwitch = false;
|
||||
}
|
||||
modeIsSet = false;
|
||||
} else {
|
||||
// GPS device is off anyway, so do other handling
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
PoolReadGuard pg(&gpsSet);
|
||||
if (pg.getReadResult() != returnvalue::OK) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading dataset failed" << std::endl;
|
||||
#endif
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
bool validFix = false;
|
||||
uint8_t newFix = 0;
|
||||
if (modeIsSet) {
|
||||
// 0: Not seen, 1: No fix, 2: 2D-Fix, 3: 3D-Fix
|
||||
if (gps.fix.mode == 2 or gps.fix.mode == 3) {
|
||||
validFix = true;
|
||||
}
|
||||
newFix = gps.fix.mode;
|
||||
if (newFix == 0 or newFix == 1) {
|
||||
if (modeCommanded and maxTimeToReachFix.hasTimedOut()) {
|
||||
// We are supposed to be on and functioning, but no fix was found
|
||||
if (mode == MODE_ON or mode == MODE_NORMAL) {
|
||||
mode = MODE_OFF;
|
||||
}
|
||||
modeCommanded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gpsSet.fixMode.value != newFix) {
|
||||
triggerEvent(GpsHyperion::GPS_FIX_CHANGE, gpsSet.fixMode.value, newFix);
|
||||
}
|
||||
gpsSet.fixMode = newFix;
|
||||
gpsSet.fixMode.setValid(modeIsSet);
|
||||
|
||||
// Only set on specific messages, so only set a valid flag to invalid
|
||||
// if not set for more than a full message set (10 messages here)
|
||||
if (SATELLITE_SET == (SATELLITE_SET & gps.set)) {
|
||||
gpsSet.satInUse.value = gps.satellites_used;
|
||||
gpsSet.satInView.value = gps.satellites_visible;
|
||||
if (not gpsSet.satInUse.isValid()) {
|
||||
gpsSet.satInUse.setValid(true);
|
||||
gpsSet.satInView.setValid(true);
|
||||
}
|
||||
satNotSetCounter = 0;
|
||||
} else {
|
||||
satNotSetCounter++;
|
||||
if (gpsSet.satInUse.isValid() and satNotSetCounter >= 10) {
|
||||
gpsSet.satInUse.setValid(false);
|
||||
gpsSet.satInView.setValid(false);
|
||||
}
|
||||
}
|
||||
|
||||
// LATLON is set for every message, no need for a counter
|
||||
bool latValid = false;
|
||||
bool longValid = false;
|
||||
if (LATLON_SET == (LATLON_SET & gps.set)) {
|
||||
if (std::isfinite(gps.fix.latitude)) {
|
||||
// Negative latitude -> South direction
|
||||
gpsSet.latitude.value = gps.fix.latitude;
|
||||
// As specified in gps.h: Only valid if mode >= 2
|
||||
if (gps.fix.mode >= 2) {
|
||||
latValid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (std::isfinite(gps.fix.longitude)) {
|
||||
// Negative longitude -> West direction
|
||||
gpsSet.longitude.value = gps.fix.longitude;
|
||||
// As specified in gps.h: Only valid if mode >= 2
|
||||
if (gps.fix.mode >= 2) {
|
||||
longValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
gpsSet.latitude.setValid(latValid);
|
||||
gpsSet.longitude.setValid(longValid);
|
||||
|
||||
// ALTITUDE is set for every message, no need for a counter
|
||||
bool altitudeValid = false;
|
||||
if (ALTITUDE_SET == (ALTITUDE_SET & gps.set) && std::isfinite(gps.fix.altitude)) {
|
||||
gpsSet.altitude.value = gps.fix.altitude;
|
||||
// As specified in gps.h: Only valid if mode == 3
|
||||
if (gps.fix.mode == 3) {
|
||||
altitudeValid = true;
|
||||
}
|
||||
}
|
||||
gpsSet.altitude.setValid(altitudeValid);
|
||||
|
||||
// SPEED is set for every message, no need for a counter
|
||||
bool speedValid = false;
|
||||
if (SPEED_SET == (SPEED_SET & gps.set) && std::isfinite(gps.fix.speed)) {
|
||||
gpsSet.speed.value = gps.fix.speed;
|
||||
speedValid = true;
|
||||
}
|
||||
gpsSet.speed.setValid(speedValid);
|
||||
|
||||
// TIME is set for every message, no need for a counter
|
||||
bool timeValid = false;
|
||||
if (TIME_SET == (TIME_SET & gps.set)) {
|
||||
// To prevent totally incorrect times from being declared valid.
|
||||
if (gpsSet.satInView.isValid() and gpsSet.satInView.value >= 1) {
|
||||
timeValid = true;
|
||||
}
|
||||
timeval time = {};
|
||||
#if LIBGPS_VERSION_MINOR <= 17
|
||||
gpsSet.unixSeconds.value = std::floor(gps.fix.time);
|
||||
double fractionalPart = gps.fix.time - gpsSet.unixSeconds.value;
|
||||
time.tv_usec = fractionalPart * 1000.0 * 1000.0;
|
||||
#else
|
||||
gpsSet.unixSeconds.value = gps.fix.time.tv_sec;
|
||||
time.tv_usec = gps.fix.time.tv_nsec / 1000;
|
||||
#endif
|
||||
time.tv_sec = gpsSet.unixSeconds.value;
|
||||
// If the time is totally wrong (e.g. year 2000 after system reset because we do not have a RTC
|
||||
// and no time file available) we set it with the roughly valid time from the GPS.
|
||||
// NTP might only work if the time difference between sys time and current time is not too
|
||||
// large.
|
||||
overwriteTimeIfNotSane(time, validFix);
|
||||
Clock::TimeOfDay_t timeOfDay = {};
|
||||
Clock::convertTimevalToTimeOfDay(&time, &timeOfDay);
|
||||
gpsSet.year = timeOfDay.year;
|
||||
gpsSet.month = timeOfDay.month;
|
||||
gpsSet.day = timeOfDay.day;
|
||||
gpsSet.hours = timeOfDay.hour;
|
||||
gpsSet.minutes = timeOfDay.minute;
|
||||
gpsSet.seconds = timeOfDay.second;
|
||||
}
|
||||
gpsSet.unixSeconds.setValid(timeValid);
|
||||
gpsSet.year.setValid(timeValid);
|
||||
gpsSet.month.setValid(timeValid);
|
||||
gpsSet.day.setValid(timeValid);
|
||||
gpsSet.hours.setValid(timeValid);
|
||||
gpsSet.minutes.setValid(timeValid);
|
||||
gpsSet.seconds.setValid(timeValid);
|
||||
|
||||
if (debugHyperionGps) {
|
||||
sif::info << "-- Hyperion GPS Data --" << std::endl;
|
||||
#if LIBGPS_VERSION_MINOR <= 17
|
||||
time_t timeRaw = gpsSet.unixSeconds.value;
|
||||
#else
|
||||
time_t timeRaw = gps.fix.time.tv_sec;
|
||||
#endif
|
||||
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;
|
||||
std::cout << "Satellites used: " << gps.satellites_used << std::endl;
|
||||
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;
|
||||
#if LIBGPS_VERSION_MINOR <= 17
|
||||
std::cout << "Altitude(MSL): " << gps.fix.altitude << std::endl;
|
||||
#else
|
||||
std::cout << "Altitude(MSL): " << gps.fix.altMSL << std::endl;
|
||||
#endif
|
||||
std::cout << "Speed(m/s): " << gps.fix.speed << std::endl;
|
||||
std::time_t t = std::time(nullptr);
|
||||
std::tm tm = *std::gmtime(&t);
|
||||
std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void GpsHyperionLinuxController::overwriteTimeIfNotSane(timeval time, bool validFix) {
|
||||
if (not timeInit and validFix) {
|
||||
if (not utility::timeSanityCheck()) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
time_t timeRaw = time.tv_sec;
|
||||
std::tm *timeTm = std::gmtime(&timeRaw);
|
||||
sif::info << "Overwriting invalid system time from GPS data directly: "
|
||||
<< std::put_time(timeTm, "%c %Z") << std::endl;
|
||||
#endif
|
||||
// For some reason, the clock needs to be somewhat correct for NTP to work. Really dumb..
|
||||
Clock::setClock(&time);
|
||||
}
|
||||
timeInit = true;
|
||||
}
|
||||
}
|
93
linux/acs/GpsHyperionLinuxController.h
Normal file
93
linux/acs/GpsHyperionLinuxController.h
Normal file
@ -0,0 +1,93 @@
|
||||
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
|
||||
#include "eive/eventSubsystemIds.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
||||
#include "mission/trace.h"
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
#include <gps.h>
|
||||
#include <libgpsmm.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Device handler for the Hyperion HT-GPS200 device
|
||||
* @details
|
||||
* Flight manual:
|
||||
* https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/Hyperion_HT-GPS200
|
||||
* This device handler can only be used on Linux system where the gpsd daemon with shared memory
|
||||
* export is running.
|
||||
*/
|
||||
class GpsHyperionLinuxController : public ExtendedControllerBase {
|
||||
public:
|
||||
// 30 minutes
|
||||
static constexpr uint32_t MAX_SECONDS_TO_REACH_FIX = 60 * 30;
|
||||
|
||||
enum ReadModes { SHM = 0, SOCKET = 1 };
|
||||
|
||||
GpsHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
||||
bool debugHyperionGps = false);
|
||||
virtual ~GpsHyperionLinuxController();
|
||||
|
||||
using gpioResetFunction_t = ReturnValue_t (*)(const uint8_t* actionData, size_t len, void* args);
|
||||
|
||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||
void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void* args);
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
void performControlOperation() override;
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t* msToReachTheMode) override;
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
protected:
|
||||
gpioResetFunction_t resetCallback = nullptr;
|
||||
void* resetCallbackArgs = nullptr;
|
||||
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
|
||||
ReturnValue_t handleGpsReadData();
|
||||
|
||||
private:
|
||||
GpsPrimaryDataset gpsSet;
|
||||
gps_data_t gps = {};
|
||||
const char* currentClientBuf = nullptr;
|
||||
ReadModes readMode = ReadModes::SOCKET;
|
||||
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
|
||||
bool modeCommanded = false;
|
||||
bool timeInit = false;
|
||||
uint8_t satNotSetCounter = 0;
|
||||
|
||||
#if OBSW_THREAD_TRACING == 1
|
||||
uint32_t opCounter = 0;
|
||||
#endif
|
||||
|
||||
struct OneShotSwitches {
|
||||
void reset() {
|
||||
gpsReadFailedSwitch = true;
|
||||
cantGetFixSwitch = true;
|
||||
}
|
||||
bool gpsReadFailedSwitch = true;
|
||||
bool cantGetFixSwitch = true;
|
||||
|
||||
} oneShotSwitches;
|
||||
|
||||
bool debugHyperionGps = false;
|
||||
int32_t noModeSetCntr = 0;
|
||||
|
||||
// Returns true if the function should be called again or false if other
|
||||
// controller handling can be done.
|
||||
bool readGpsDataFromGpsd();
|
||||
// If the time is totally wrong (e.g. year 2000 after system reset because we do not have a RTC)
|
||||
// we set it with the roughly valid time from the GPS. For some reason, NTP might only work
|
||||
// if the time difference between sys time and current time is not too large
|
||||
void overwriteTimeIfNotSane(timeval time, bool validFix);
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_GPSHYPERIONHANDLER_H_ */
|
@ -4,6 +4,7 @@
|
||||
#include <fsfw/filesystem/HasFileSystemIF.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
#include <mission/acs/str/strHelpers.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <filesystem>
|
||||
@ -12,8 +13,6 @@
|
||||
#include "OBSWConfig.h"
|
||||
#include "eive/definitions.h"
|
||||
#include "fsfw/timemanager/Countdown.h"
|
||||
#include "helpers.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
#include "mission/utility/Filenaming.h"
|
||||
#include "mission/utility/ProgressPrinter.h"
|
||||
#include "mission/utility/Timestamp.h"
|
||||
@ -554,12 +553,12 @@ ReturnValue_t StrComHandler::sendAndRead(size_t size, uint32_t failParameter) {
|
||||
}
|
||||
|
||||
ReturnValue_t StrComHandler::checkActionReply(size_t replySize) {
|
||||
uint8_t type = str::getReplyFrameType(replyPtr);
|
||||
uint8_t type = startracker::getReplyFrameType(replyPtr);
|
||||
if (type != TMTC_ACTIONREPLY) {
|
||||
sif::warning << "StrHelper::checkActionReply: Received reply with invalid type ID" << std::endl;
|
||||
return INVALID_TYPE_ID;
|
||||
}
|
||||
uint8_t status = str::getStatusField(replyPtr);
|
||||
uint8_t status = startracker::getStatusField(replyPtr);
|
||||
if (status != ArcsecDatalinkLayer::STATUS_OK) {
|
||||
sif::warning << "StrHelper::checkActionReply: Status failure: "
|
||||
<< static_cast<unsigned int>(status) << std::endl;
|
@ -1,9 +1,10 @@
|
||||
#ifndef BSP_Q7S_DEVICES_STRHELPER_H_
|
||||
#define BSP_Q7S_DEVICES_STRHELPER_H_
|
||||
|
||||
#include <mission/acs/str/ArcsecDatalinkLayer.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ArcsecDatalinkLayer.h"
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
#ifdef XIPHOS_Q7S
|
@ -1,73 +0,0 @@
|
||||
#include "ArcsecDatalinkLayer.h"
|
||||
|
||||
ArcsecDatalinkLayer::ArcsecDatalinkLayer() : decodeRingBuf(BUFFER_LENGTHS, true) { slipInit(); }
|
||||
|
||||
ArcsecDatalinkLayer::~ArcsecDatalinkLayer() {}
|
||||
|
||||
ReturnValue_t ArcsecDatalinkLayer::checkRingBufForFrame(const uint8_t** decodedFrame,
|
||||
size_t& frameLen) {
|
||||
size_t currentLen = decodeRingBuf.getAvailableReadData();
|
||||
if (currentLen == 0) {
|
||||
return DEC_IN_PROGRESS;
|
||||
}
|
||||
decodeRingBuf.readData(rxAnalysisBuffer, currentLen);
|
||||
for (size_t idx = 0; idx < currentLen; idx++) {
|
||||
enum arc_dec_result decResult =
|
||||
arc_transport_decode_body(rxAnalysisBuffer[idx], &slipInfo, decodedRxFrame, &rxFrameSize);
|
||||
switch (decResult) {
|
||||
case ARC_DEC_INPROGRESS: {
|
||||
break;
|
||||
}
|
||||
case ARC_DEC_ERROR_FRAME_SHORT: {
|
||||
decodeRingBuf.deleteData(idx);
|
||||
return REPLY_TOO_SHORT;
|
||||
}
|
||||
case ARC_DEC_ERROR_CHECKSUM:
|
||||
decodeRingBuf.deleteData(idx);
|
||||
return CRC_FAILURE;
|
||||
case ARC_DEC_ASYNC:
|
||||
case ARC_DEC_SYNC: {
|
||||
// Reset length of SLIP struct for next frame
|
||||
slipInfo.length = 0;
|
||||
if (decodedFrame != nullptr) {
|
||||
*decodedFrame = decodedRxFrame;
|
||||
}
|
||||
frameLen = rxFrameSize;
|
||||
decodeRingBuf.deleteData(idx);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
default:
|
||||
sif::debug << "ArcsecDatalinkLayer::decodeFrame: Unknown result code" << std::endl;
|
||||
break;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
}
|
||||
decodeRingBuf.deleteData(currentLen);
|
||||
return DEC_IN_PROGRESS;
|
||||
}
|
||||
|
||||
ReturnValue_t ArcsecDatalinkLayer::feedData(const uint8_t* rawData, size_t rawDataLen) {
|
||||
if (rawDataLen > 4096) {
|
||||
sif::error << "ArcsecDatalinklayer: Can not write more than 4096 bytes to ring buffer"
|
||||
<< std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
return decodeRingBuf.writeData(rawData, rawDataLen);
|
||||
}
|
||||
|
||||
void ArcsecDatalinkLayer::reset() {
|
||||
slipInit();
|
||||
decodeRingBuf.clear();
|
||||
}
|
||||
|
||||
void ArcsecDatalinkLayer::slipInit() {
|
||||
slip_decode_init(rxBufferArc, sizeof(rxBufferArc), &slipInfo);
|
||||
}
|
||||
|
||||
void ArcsecDatalinkLayer::encodeFrame(const uint8_t* data, size_t length, const uint8_t** txFrame,
|
||||
size_t& size) {
|
||||
arc_transport_encode_body(data, length, txEncoded, &size);
|
||||
if (txFrame != nullptr) {
|
||||
*txFrame = txEncoded;
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
#ifndef BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
|
||||
#define BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
|
||||
|
||||
#include <fsfw/container/SimpleRingBuffer.h>
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
|
||||
#include "arcsec/common/misc.h"
|
||||
#include "eive/resultClassIds.h"
|
||||
#include "fsfw/returnvalues/returnvalue.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
|
||||
/**
|
||||
* @brief Helper class to handle the datalinklayer of replies from the star tracker of arcsec.
|
||||
*/
|
||||
class ArcsecDatalinkLayer {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] More data required to complete frame
|
||||
static const ReturnValue_t DEC_IN_PROGRESS = MAKE_RETURN_CODE(0xA0);
|
||||
//! [EXPORT] : [COMMENT] Data too short to represent a valid frame
|
||||
static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xA1);
|
||||
//! [EXPORT] : [COMMENT] Detected CRC failure in received frame
|
||||
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA2);
|
||||
|
||||
static const uint8_t STATUS_OK = 0;
|
||||
|
||||
static constexpr size_t BUFFER_LENGTHS = 4096;
|
||||
|
||||
ArcsecDatalinkLayer();
|
||||
virtual ~ArcsecDatalinkLayer();
|
||||
|
||||
/**
|
||||
* Feed received data to the internal ring buffer.
|
||||
* @param rawData
|
||||
* @param rawDataLen
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t feedData(const uint8_t* rawData, size_t rawDataLen);
|
||||
|
||||
/**
|
||||
* Runs the arcsec datalink layer decoding algorithm on the data in the ring buffer, decoding
|
||||
* frames in the process.
|
||||
* @param decodedFrame
|
||||
* @param frameLen
|
||||
* @return
|
||||
* - returnvalue::OK if a frame was found
|
||||
* - DEC_IN_PROGRESS if frame decoding is in progress
|
||||
* - Anything else is a decoding error
|
||||
*/
|
||||
ReturnValue_t checkRingBufForFrame(const uint8_t** decodedFrame, size_t& frameLen);
|
||||
|
||||
/**
|
||||
* @brief SLIP encodes data pointed to by data pointer.
|
||||
*
|
||||
* @param data Pointer to data to encode
|
||||
* @param length Length of buffer to encode
|
||||
*/
|
||||
void encodeFrame(const uint8_t* data, size_t length, const uint8_t** txFrame, size_t& frameLen);
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
static const uint8_t ID_OFFSET = 1;
|
||||
static const uint8_t STATUS_OFFSET = 2;
|
||||
|
||||
// User to buffer and analyse data and allow feeding and checking for frames asychronously.
|
||||
SimpleRingBuffer decodeRingBuf;
|
||||
uint8_t rxAnalysisBuffer[BUFFER_LENGTHS];
|
||||
|
||||
// Used by arcsec slip decoding function to process received data. This should only be written
|
||||
// to or read from by arcsec functions!
|
||||
uint8_t rxBufferArc[startracker::MAX_FRAME_SIZE];
|
||||
// Decoded frame will be copied to this buffer
|
||||
uint8_t decodedRxFrame[startracker::MAX_FRAME_SIZE];
|
||||
// Size of decoded frame
|
||||
uint32_t rxFrameSize = 0;
|
||||
|
||||
// Buffer where encoded frames will be stored. First byte of encoded frame represents type of
|
||||
// reply
|
||||
uint8_t txEncoded[startracker::MAX_FRAME_SIZE * 2 + 2];
|
||||
// Size of encoded frame
|
||||
uint32_t txFrameSize = 0;
|
||||
|
||||
slip_decode_state slipInfo;
|
||||
|
||||
void slipInit();
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_ */
|
@ -1,101 +0,0 @@
|
||||
#include "ArcsecJsonParamBase.h"
|
||||
|
||||
#include "arcsecJsonKeys.h"
|
||||
|
||||
ArcsecJsonParamBase::ArcsecJsonParamBase(std::string setName) : setName(setName) {}
|
||||
|
||||
ReturnValue_t ArcsecJsonParamBase::create(uint8_t* buffer) {
|
||||
ReturnValue_t result = createCommand(buffer);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "ArcsecJsonParamBase::create: Failed to create parameter command for set "
|
||||
<< setName << std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t ArcsecJsonParamBase::getParam(const std::string name, std::string& value) {
|
||||
for (json::iterator it = set.begin(); it != set.end(); ++it) {
|
||||
if ((*it)[arcseckeys::NAME] == name) {
|
||||
value = (*it)[arcseckeys::VALUE];
|
||||
convertEmpty(value);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
}
|
||||
return PARAM_NOT_EXISTS;
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::convertEmpty(std::string& value) {
|
||||
if (value == "") {
|
||||
value = "0";
|
||||
}
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::addfloat(const std::string value, uint8_t* buffer) {
|
||||
float param = std::stof(value);
|
||||
std::memcpy(buffer, ¶m, sizeof(param));
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::adduint8(const std::string value, uint8_t* buffer) {
|
||||
uint8_t param = std::stoi(value);
|
||||
std::memcpy(buffer, ¶m, sizeof(param));
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::addint16(const std::string value, uint8_t* buffer) {
|
||||
int16_t param = std::stoi(value);
|
||||
std::memcpy(buffer, ¶m, sizeof(param));
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::adduint16(const std::string value, uint8_t* buffer) {
|
||||
uint16_t param = std::stoi(value);
|
||||
std::memcpy(buffer, ¶m, sizeof(param));
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::adduint32(const std::string value, uint8_t* buffer) {
|
||||
uint32_t param = std::stoi(value);
|
||||
std::memcpy(buffer, ¶m, sizeof(param));
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::addSetParamHeader(uint8_t* buffer, uint8_t setId) {
|
||||
*buffer = static_cast<uint8_t>(TMTC_SETPARAMREQ);
|
||||
*(buffer + 1) = setId;
|
||||
}
|
||||
|
||||
ReturnValue_t ArcsecJsonParamBase::init(const std::string filename) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
if (not std::filesystem::exists(filename)) {
|
||||
sif::warning << "ArcsecJsonParamBase::init: JSON file " << filename << " does not exist"
|
||||
<< std::endl;
|
||||
return JSON_FILE_NOT_EXISTS;
|
||||
}
|
||||
try {
|
||||
createJsonObject(filename);
|
||||
result = initSet();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
} catch (json::exception& e) {
|
||||
// TODO: Re-create json file from backup here.
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
void ArcsecJsonParamBase::createJsonObject(const std::string fullname) {
|
||||
json j;
|
||||
std::ifstream file(fullname);
|
||||
file >> j;
|
||||
file.close();
|
||||
properties = j[arcseckeys::PROPERTIES];
|
||||
}
|
||||
|
||||
ReturnValue_t ArcsecJsonParamBase::initSet() {
|
||||
for (json::iterator it = properties.begin(); it != properties.end(); ++it) {
|
||||
if ((*it)["name"] == setName) {
|
||||
set = (*it)["fields"];
|
||||
return returnvalue::OK;
|
||||
}
|
||||
}
|
||||
sif::warning << "ArcsecJsonParamBase::initSet: Set " << setName << "not present in json file"
|
||||
<< std::endl;
|
||||
return SET_NOT_EXISTS;
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
#ifndef BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_
|
||||
#define BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "arcsec/common/generated/tmtcstructs.h"
|
||||
#include "arcsec/common/genericstructs.h"
|
||||
#include "eive/resultClassIds.h"
|
||||
#include "fsfw/returnvalues/returnvalue.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
/**
|
||||
* @brief Base class for creation of parameter configuration commands. Reads parameter set
|
||||
* from a json file located on the filesystem and generates the appropriate command
|
||||
* to apply the parameters to the star tracker software.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class ArcsecJsonParamBase {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::ARCSEC_JSON_BASE;
|
||||
//! [EXPORT] : [COMMENT] Specified json file does not exist
|
||||
static const ReturnValue_t JSON_FILE_NOT_EXISTS = MAKE_RETURN_CODE(1);
|
||||
//! [EXPORT] : [COMMENT] Requested set does not exist in json file
|
||||
static const ReturnValue_t SET_NOT_EXISTS = MAKE_RETURN_CODE(2);
|
||||
//! [EXPORT] : [COMMENT] Requested parameter does not exist in json file
|
||||
static const ReturnValue_t PARAM_NOT_EXISTS = MAKE_RETURN_CODE(3);
|
||||
|
||||
virtual ~ArcsecJsonParamBase() = default;
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param fullname Name with absolute path of json file containing the parameters to set.
|
||||
*/
|
||||
ArcsecJsonParamBase(std::string setName);
|
||||
|
||||
/**
|
||||
* @brief Initializes the properties json object and the set json object
|
||||
*
|
||||
* @param fullname Name including absolute path to json file
|
||||
* @param setName The name of the set to work on
|
||||
*
|
||||
* @param return JSON_FILE_NOT_EXISTS if specified file does not exist, otherwise
|
||||
* returnvalue::OK
|
||||
*/
|
||||
ReturnValue_t init(const std::string filename);
|
||||
|
||||
/**
|
||||
* @brief Fills a buffer with a parameter set
|
||||
*
|
||||
* @param fullname The name including the absolute path of the json file containing the
|
||||
* parameter set.
|
||||
* @param buffer Pointer to the buffer the command will be written to
|
||||
*/
|
||||
ReturnValue_t create(uint8_t* buffer);
|
||||
|
||||
/**
|
||||
* @brief Returns the size of the parameter command.
|
||||
*/
|
||||
virtual size_t getSize() = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Reads the value of a parameter from a json set
|
||||
*
|
||||
* @param name The name of the parameter
|
||||
* @param value The string representation of the read value
|
||||
*
|
||||
* @return returnvalue::OK if successful, otherwise PARAM_NOT_EXISTS
|
||||
*/
|
||||
ReturnValue_t getParam(const std::string name, std::string& value);
|
||||
|
||||
/**
|
||||
* @brief Converts empty string which is equal to define a value as zero.
|
||||
*/
|
||||
void convertEmpty(std::string& value);
|
||||
|
||||
/**
|
||||
* @brief This function adds a float represented as string to a buffer
|
||||
*
|
||||
* @param value The float in string representation to add
|
||||
* @param buffer Pointer to the buffer the float will be written to
|
||||
*/
|
||||
void addfloat(const std::string value, uint8_t* buffer);
|
||||
|
||||
/**
|
||||
* @brief This function adds a uint8_t represented as string to a buffer
|
||||
*
|
||||
* @param value The uint8_t in string representation to add
|
||||
* @param buffer Pointer to the buffer the uint8_t will be written to
|
||||
*/
|
||||
void adduint8(const std::string value, uint8_t* buffer);
|
||||
|
||||
/**
|
||||
* @brief This function adds a int16_t represented as string to a buffer
|
||||
*
|
||||
* @param value The int16_t in string representation to add
|
||||
* @param buffer Pointer to the buffer the int16_t will be written to
|
||||
*/
|
||||
void addint16(const std::string value, uint8_t* buffer);
|
||||
|
||||
/**
|
||||
* @brief This function adds a uint16_t represented as string to a buffer
|
||||
*
|
||||
* @param value The uint16_t in string representation to add
|
||||
* @param buffer Pointer to the buffer the uint16_t will be written to
|
||||
*/
|
||||
void adduint16(const std::string value, uint8_t* buffer);
|
||||
|
||||
/**
|
||||
* @brief This function adds a uint32_t represented as string to a buffer
|
||||
*
|
||||
* @param value The uint32_t in string representation to add
|
||||
* @param buffer Pointer to the buffer the uint32_t will be written to
|
||||
*/
|
||||
void adduint32(const std::string value, uint8_t* buffer);
|
||||
|
||||
void addSetParamHeader(uint8_t* buffer, uint8_t setId);
|
||||
|
||||
private:
|
||||
json properties;
|
||||
json set;
|
||||
std::string setName;
|
||||
|
||||
/**
|
||||
* @brief This function must be implemented by the derived class to define creation of a
|
||||
* parameter command.
|
||||
*/
|
||||
virtual ReturnValue_t createCommand(uint8_t* buffer) = 0;
|
||||
|
||||
void createJsonObject(const std::string fullname);
|
||||
|
||||
/**
|
||||
* @brief Extracts the json set object form the json file
|
||||
*
|
||||
* @param setName The name of the set to create the json object from
|
||||
*/
|
||||
ReturnValue_t initSet();
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_ */
|
@ -1,4 +0,0 @@
|
||||
target_sources(
|
||||
${OBSW_NAME}
|
||||
PRIVATE StarTrackerHandler.cpp strJsonCommands.cpp ArcsecDatalinkLayer.cpp
|
||||
ArcsecJsonParamBase.cpp StrComHandler.cpp helpers.cpp)
|
File diff suppressed because it is too large
Load Diff
@ -1,499 +0,0 @@
|
||||
#ifndef MISSION_DEVICES_STARTRACKERHANDLER_H_
|
||||
#define MISSION_DEVICES_STARTRACKERHANDLER_H_
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "ArcsecJsonParamBase.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "StrComHandler.h"
|
||||
#include "arcsec/common/SLIP.h"
|
||||
#include "devices/powerSwitcherList.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "fsfw/src/fsfw/serialize/SerializeAdapter.h"
|
||||
#include "fsfw/timemanager/Countdown.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
#include "strJsonCommands.h"
|
||||
|
||||
/**
|
||||
* @brief This is the device handler for the star tracker from arcsec.
|
||||
*
|
||||
* @details Datasheet: https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/
|
||||
* Arbeitsdaten/08_Used%20Components/ArcSec_KULeuven_Startracker/
|
||||
* Sagitta%201.0%20Datapack&fileid=659181
|
||||
* @author J. Meier
|
||||
*/
|
||||
class StarTrackerHandler : public DeviceHandlerBase {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param objectId
|
||||
* @param comIF
|
||||
* @param comCookie
|
||||
* @param gpioComIF Pointer to gpio communication interface
|
||||
* @param enablePin GPIO connected to the enable pin of the reaction wheels. Must be pulled
|
||||
* to high to enable the device.
|
||||
*/
|
||||
StarTrackerHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
||||
const char* jsonFileStr, StrComHandler* strHelper,
|
||||
power::Switch_t powerSwitch);
|
||||
virtual ~StarTrackerHandler();
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
/**
|
||||
* @brief Overwrite this function from DHB to handle commands executed by the str image
|
||||
* loader task.
|
||||
*/
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
|
||||
void performOperationHook() override;
|
||||
|
||||
Submode_t getInitialSubmode() override;
|
||||
|
||||
static const Submode_t SUBMODE_BOOTLOADER = 1;
|
||||
static const Submode_t SUBMODE_FIRMWARE = 2;
|
||||
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t* id) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
||||
size_t commandDataLen) override;
|
||||
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
|
||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
||||
size_t* foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
void setNormalDatapoolEntriesInvalid() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
/**
|
||||
* @brief Overwritten here to always read all available data from theSerialComIF.
|
||||
*/
|
||||
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||
virtual ReturnValue_t doSendReadHook() override;
|
||||
ReturnValue_t getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) override;
|
||||
virtual void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
||||
|
||||
private:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Status in temperature reply signals error
|
||||
static const ReturnValue_t TEMPERATURE_REQ_FAILED = MAKE_RETURN_CODE(0xA0);
|
||||
//! [EXPORT] : [COMMENT] Ping command failed
|
||||
static const ReturnValue_t PING_FAILED = MAKE_RETURN_CODE(0xA1);
|
||||
//! [EXPORT] : [COMMENT] Status in version reply signals error
|
||||
static const ReturnValue_t VERSION_REQ_FAILED = MAKE_RETURN_CODE(0xA2);
|
||||
//! [EXPORT] : [COMMENT] Status in interface reply signals error
|
||||
static const ReturnValue_t INTERFACE_REQ_FAILED = MAKE_RETURN_CODE(0xA3);
|
||||
//! [EXPORT] : [COMMENT] Status in power reply signals error
|
||||
static const ReturnValue_t POWER_REQ_FAILED = MAKE_RETURN_CODE(0xA4);
|
||||
//! [EXPORT] : [COMMENT] Status of reply to parameter set command signals error
|
||||
static const ReturnValue_t SET_PARAM_FAILED = MAKE_RETURN_CODE(0xA5);
|
||||
//! [EXPORT] : [COMMENT] Status of reply to action command signals error
|
||||
static const ReturnValue_t ACTION_FAILED = MAKE_RETURN_CODE(0xA6);
|
||||
//! [EXPORT] : [COMMENT] Received invalid path string. Exceeds allowed length
|
||||
static const ReturnValue_t FILE_PATH_TOO_LONG = MAKE_RETURN_CODE(0xA7);
|
||||
//! [EXPORT] : [COMMENT] Name of file received with command is too long
|
||||
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA8);
|
||||
//! [EXPORT] : [COMMENT] Received version reply with invalid program ID
|
||||
static const ReturnValue_t INVALID_PROGRAM = MAKE_RETURN_CODE(0xA9);
|
||||
//! [EXPORT] : [COMMENT] Status field reply signals error
|
||||
static const ReturnValue_t REPLY_ERROR = MAKE_RETURN_CODE(0xAA);
|
||||
//! [EXPORT] : [COMMENT] Received command which is too short (some data is missing for proper
|
||||
//! execution)
|
||||
static const ReturnValue_t COMMAND_TOO_SHORT = MAKE_RETURN_CODE(0xAB);
|
||||
//! [EXPORT] : [COMMENT] Received command with invalid length (too few or too many parameters)
|
||||
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xAC);
|
||||
//! [EXPORT] : [COMMENT] Region mismatch between send and received data
|
||||
static const ReturnValue_t REGION_MISMATCH = MAKE_RETURN_CODE(0xAD);
|
||||
//! [EXPORT] : [COMMENT] Address mismatch between send and received data
|
||||
static const ReturnValue_t ADDRESS_MISMATCH = MAKE_RETURN_CODE(0xAE);
|
||||
//! [EXPORT] : [COMMENT] Length field mismatch between send and received data
|
||||
static const ReturnValue_t lENGTH_MISMATCH = MAKE_RETURN_CODE(0xAF);
|
||||
//! [EXPORT] : [COMMENT] Specified file does not exist
|
||||
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xB0);
|
||||
//! [EXPORT] : [COMMENT] Download blob pixel command has invalid type field
|
||||
static const ReturnValue_t INVALID_TYPE = MAKE_RETURN_CODE(0xB1);
|
||||
//! [EXPORT] : [COMMENT] Received FPGA action command with invalid ID
|
||||
static const ReturnValue_t INVALID_ID = MAKE_RETURN_CODE(0xB2);
|
||||
//! [EXPORT] : [COMMENT] Received reply is too short
|
||||
static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xB3);
|
||||
//! [EXPORT] : [COMMENT] Received reply with invalid CRC
|
||||
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xB4);
|
||||
//! [EXPORT] : [COMMENT] Star tracker handler currently executing a command and using the
|
||||
//! communication interface
|
||||
static const ReturnValue_t STR_HELPER_EXECUTING = MAKE_RETURN_CODE(0xB5);
|
||||
//! [EXPORT] : [COMMENT] Star tracker is already in firmware mode
|
||||
static const ReturnValue_t STARTRACKER_ALREADY_BOOTED = MAKE_RETURN_CODE(0xB6);
|
||||
//! [EXPORT] : [COMMENT] Star tracker must be in firmware mode to run this command
|
||||
static const ReturnValue_t STARTRACKER_NOT_RUNNING_FIRMWARE = MAKE_RETURN_CODE(0xB7);
|
||||
//! [EXPORT] : [COMMENT] Star tracker must be in bootloader mode to run this command
|
||||
static const ReturnValue_t STARTRACKER_NOT_RUNNING_BOOTLOADER = MAKE_RETURN_CODE(0xB8);
|
||||
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Failed to boot firmware
|
||||
static const Event BOOTING_FIRMWARE_FAILED_EVENT = MAKE_EVENT(1, severity::LOW);
|
||||
//! [EXPORT] : [COMMENT] Failed to boot star tracker into bootloader mode
|
||||
static const Event BOOTING_BOOTLOADER_FAILED_EVENT = MAKE_EVENT(2, severity::LOW);
|
||||
|
||||
static const size_t MAX_PATH_SIZE = 50;
|
||||
static const size_t MAX_FILE_NAME = 30;
|
||||
|
||||
static const uint8_t STATUS_OFFSET = 2;
|
||||
static const uint8_t PARAMS_OFFSET = 2;
|
||||
static const uint8_t TICKS_OFFSET = 3;
|
||||
static const uint8_t TIME_OFFSET = 7;
|
||||
static const uint8_t PARAMETER_ID_OFFSET = 1;
|
||||
static const uint8_t ACTION_ID_OFFSET = 1;
|
||||
static const uint8_t ACTION_DATA_OFFSET = 3;
|
||||
|
||||
// Ping request will reply ping with this ID (data field)
|
||||
static const uint32_t PING_ID = 0x55;
|
||||
static const uint32_t BOOT_REGION_ID = 1;
|
||||
static const MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
|
||||
static const uint32_t MUTEX_TIMEOUT = 20;
|
||||
static const uint32_t BOOT_TIMEOUT = 1000;
|
||||
static const uint32_t DEFAULT_TRANSITION_DELAY = 15000;
|
||||
|
||||
struct FlashReadCmd {
|
||||
// Minimum length of a read command (region, length and filename)
|
||||
static const size_t MIN_LENGTH = 7;
|
||||
};
|
||||
|
||||
struct ChecksumCmd {
|
||||
static const uint8_t ADDRESS_OFFSET = 1;
|
||||
static const uint8_t LENGTH_OFFSET = 5;
|
||||
// Length of checksum command
|
||||
static const size_t LENGTH = 9;
|
||||
uint8_t rememberRegion = 0;
|
||||
uint32_t rememberAddress = 0;
|
||||
uint32_t rememberLength = 0;
|
||||
};
|
||||
|
||||
ChecksumCmd checksumCmd;
|
||||
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
|
||||
startracker::TemperatureSet temperatureSet;
|
||||
startracker::VersionSet versionSet;
|
||||
startracker::PowerSet powerSet;
|
||||
startracker::InterfaceSet interfaceSet;
|
||||
startracker::TimeSet timeSet;
|
||||
startracker::SolutionSet solutionSet;
|
||||
startracker::HistogramSet histogramSet;
|
||||
startracker::ChecksumSet checksumSet;
|
||||
startracker::CameraSet cameraSet;
|
||||
startracker::LimitsSet limitsSet;
|
||||
startracker::LogLevelSet loglevelSet;
|
||||
startracker::MountingSet mountingSet;
|
||||
startracker::ImageProcessorSet imageProcessorSet;
|
||||
startracker::CentroidingSet centroidingSet;
|
||||
startracker::LisaSet lisaSet;
|
||||
startracker::MatchingSet matchingSet;
|
||||
startracker::TrackingSet trackingSet;
|
||||
startracker::ValidationSet validationSet;
|
||||
startracker::AlgoSet algoSet;
|
||||
startracker::SubscriptionSet subscriptionSet;
|
||||
startracker::LogSubscriptionSet logSubscriptionSet;
|
||||
startracker::DebugCameraSet debugCameraSet;
|
||||
|
||||
// Pointer to object responsible for uploading and downloading images to/from the star tracker
|
||||
StrComHandler* strHelper = nullptr;
|
||||
|
||||
uint8_t commandBuffer[startracker::MAX_FRAME_SIZE];
|
||||
|
||||
// Countdown to insert delay for star tracker to switch from bootloader to firmware program
|
||||
// Loading firmware requires some time and the command will not trigger a reply when executed
|
||||
Countdown bootCountdown;
|
||||
|
||||
struct JsonConfigs {
|
||||
Tracking tracking;
|
||||
LogLevel logLevel;
|
||||
LogSubscription logSubscription;
|
||||
DebugCamera debugCamera;
|
||||
Algo algo;
|
||||
Validation validation;
|
||||
Matching matching;
|
||||
Lisa lisa;
|
||||
Centroiding centroiding;
|
||||
Camera camera;
|
||||
ImageProcessor imageProcessor;
|
||||
Mounting mounting;
|
||||
Limits limits;
|
||||
Subscription subscription;
|
||||
};
|
||||
JsonConfigs jcfgs;
|
||||
Countdown jcfgCountdown = Countdown(250);
|
||||
bool commandExecuted = false;
|
||||
std::thread jsonCfgTask;
|
||||
static void setUpJsonCfgs(JsonConfigs& cfgs, const char* paramJsonFile);
|
||||
|
||||
std::string paramJsonFile;
|
||||
|
||||
enum class NormalState { TEMPERATURE_REQUEST, SOLUTION_REQUEST };
|
||||
|
||||
NormalState normalState = NormalState::TEMPERATURE_REQUEST;
|
||||
|
||||
enum class StartupState {
|
||||
IDLE,
|
||||
CHECK_PROGRAM,
|
||||
WAIT_CHECK_PROGRAM,
|
||||
BOOT_BOOTLOADER,
|
||||
WAIT_JCFG,
|
||||
DONE
|
||||
};
|
||||
StartupState startupState = StartupState::IDLE;
|
||||
|
||||
enum class InternalState {
|
||||
IDLE,
|
||||
BOOT_FIRMWARE,
|
||||
DONE,
|
||||
FAILED_FIRMWARE_BOOT,
|
||||
BOOT_BOOTLOADER,
|
||||
BOOTLOADER_CHECK,
|
||||
FAILED_BOOTLOADER_BOOT
|
||||
};
|
||||
|
||||
enum class FwBootState {
|
||||
NONE,
|
||||
BOOT_DELAY,
|
||||
REQ_VERSION,
|
||||
VERIFY_BOOT,
|
||||
LOGLEVEL,
|
||||
LIMITS,
|
||||
TRACKING,
|
||||
MOUNTING,
|
||||
IMAGE_PROCESSOR,
|
||||
CAMERA,
|
||||
BLOB,
|
||||
CENTROIDING,
|
||||
LISA,
|
||||
MATCHING,
|
||||
VALIDATION,
|
||||
ALGO,
|
||||
LOG_SUBSCRIPTION,
|
||||
DEBUG_CAMERA,
|
||||
WAIT_FOR_EXECUTION,
|
||||
};
|
||||
FwBootState bootState = FwBootState::NONE;
|
||||
|
||||
InternalState internalState = InternalState::IDLE;
|
||||
|
||||
bool strHelperHandlingSpecialRequest = false;
|
||||
|
||||
const power::Switch_t powerSwitch = power::NO_SWITCH;
|
||||
|
||||
/**
|
||||
* @brief Handles internal state
|
||||
*/
|
||||
void handleInternalState();
|
||||
|
||||
/**
|
||||
* @brief Checks mode for commands requiring MODE_ON of MODE_NORMAL for execution.
|
||||
*
|
||||
* @param actionId Action id of command to execute
|
||||
*/
|
||||
ReturnValue_t checkMode(ActionId_t actionId);
|
||||
|
||||
/**
|
||||
* @brief This function initializes the serial link ip protocol struct slipInfo.
|
||||
*/
|
||||
void slipInit();
|
||||
|
||||
ReturnValue_t scanForActionReply(uint8_t replyId, DeviceCommandId_t* foundId);
|
||||
ReturnValue_t scanForSetParameterReply(uint8_t replyId, DeviceCommandId_t* foundId);
|
||||
ReturnValue_t scanForGetParameterReply(uint8_t replyId, DeviceCommandId_t* foundId);
|
||||
ReturnValue_t scanForTmReply(uint8_t replyId, DeviceCommandId_t* foundId);
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to ping the star tracker
|
||||
*/
|
||||
void preparePingRequest();
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to request the time telemetry.
|
||||
*/
|
||||
void prepareTimeRequest();
|
||||
|
||||
/**
|
||||
* @brief Handles all received event messages
|
||||
*/
|
||||
void handleEvent(EventMessage* eventMessage);
|
||||
|
||||
/**
|
||||
* @brief Extracts information for flash-read-command from TC data and starts execution of
|
||||
* flash-read-procedure
|
||||
*
|
||||
* @param commandData Pointer to received command data
|
||||
* @param commandDataLen Size of received command data
|
||||
*
|
||||
* @return returnvalue::OK if start of execution was successful, otherwise error return value
|
||||
*/
|
||||
ReturnValue_t executeFlashReadCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to boot image (works only when star tracker is
|
||||
* in bootloader mode).
|
||||
*/
|
||||
void prepareBootCommand();
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with command to get the checksum of a flash part
|
||||
*/
|
||||
ReturnValue_t prepareChecksumCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||
|
||||
/**
|
||||
* @brief Fills the command buffer with the command to take an image.
|
||||
*/
|
||||
void prepareTakeImageCommand(const uint8_t* commandData);
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to request the version telemetry packet
|
||||
*/
|
||||
void prepareVersionRequest();
|
||||
|
||||
/**
|
||||
* @brief Fills the command buffer with data to request the interface telemetry packet.
|
||||
*/
|
||||
void prepareInterfaceRequest();
|
||||
|
||||
/**
|
||||
* @brief Fills the command buffer with data to request the power telemetry packet.
|
||||
*/
|
||||
void preparePowerRequest();
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to reboot star tracker.
|
||||
*/
|
||||
void prepareSwitchToBootloaderCmd();
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to subscribe to a telemetry packet.
|
||||
*
|
||||
* @param tmId The ID of the telemetry packet to subscribe to
|
||||
*/
|
||||
void prepareSubscriptionCommand(const uint8_t* tmId);
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to request solution telemtry packet (contains
|
||||
* attitude information)
|
||||
*/
|
||||
void prepareSolutionRequest();
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to request temperature from star tracker
|
||||
*/
|
||||
void prepareTemperatureRequest();
|
||||
|
||||
/**
|
||||
* @brief Fills command buffer with data to request histogram
|
||||
*/
|
||||
void prepareHistogramRequest();
|
||||
|
||||
/**
|
||||
* @brief Reads parameters from json file specified by string in commandData and
|
||||
* prepares the command to apply the parameter set to the star tracker
|
||||
*
|
||||
* @param commandData Contains string with file name
|
||||
* @param commandDataLen Length of command
|
||||
* @param paramSet The object defining the command generation
|
||||
*
|
||||
* @return returnvalue::OK if successful, otherwise error return Value
|
||||
*/
|
||||
ReturnValue_t prepareParamCommand(const uint8_t* commandData, size_t commandDataLen,
|
||||
ArcsecJsonParamBase& paramSet);
|
||||
|
||||
/**
|
||||
* @brief The following function will fill the command buffer with the command to request
|
||||
* a parameter set.
|
||||
*/
|
||||
ReturnValue_t prepareRequestCameraParams();
|
||||
ReturnValue_t prepareRequestLimitsParams();
|
||||
ReturnValue_t prepareRequestLogLevelParams();
|
||||
ReturnValue_t prepareRequestMountingParams();
|
||||
ReturnValue_t prepareRequestImageProcessorParams();
|
||||
ReturnValue_t prepareRequestCentroidingParams();
|
||||
ReturnValue_t prepareRequestLisaParams();
|
||||
ReturnValue_t prepareRequestMatchingParams();
|
||||
ReturnValue_t prepareRequestTrackingParams();
|
||||
ReturnValue_t prepareRequestValidationParams();
|
||||
ReturnValue_t prepareRequestAlgoParams();
|
||||
ReturnValue_t prepareRequestSubscriptionParams();
|
||||
ReturnValue_t prepareRequestLogSubscriptionParams();
|
||||
ReturnValue_t prepareRequestDebugCameraParams();
|
||||
|
||||
/**
|
||||
* @brief Handles action replies with datasets.
|
||||
*/
|
||||
ReturnValue_t handleActionReplySet(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset,
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
* @brief Default function to handle action replies
|
||||
*/
|
||||
ReturnValue_t handleActionReply(const uint8_t* rawFrame);
|
||||
|
||||
/**
|
||||
* @brief Handles reply to upload centroid command
|
||||
*/
|
||||
ReturnValue_t handleUploadCentroidReply();
|
||||
|
||||
/**
|
||||
* @brief Handles reply to checksum command
|
||||
*/
|
||||
ReturnValue_t handleChecksumReply(const uint8_t* rawFrame);
|
||||
|
||||
/**
|
||||
* @brief Handles all set parameter replies
|
||||
*/
|
||||
ReturnValue_t handleSetParamReply(const uint8_t* rawFrame);
|
||||
|
||||
ReturnValue_t handlePingReply(const uint8_t* rawFrame);
|
||||
|
||||
ReturnValue_t handleParamRequest(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset,
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
* @brief Checks the loaded program by means of the version set
|
||||
*/
|
||||
ReturnValue_t checkProgram();
|
||||
|
||||
/**
|
||||
* @brief Handles the startup state machine
|
||||
*/
|
||||
void handleStartup(uint8_t parameterId);
|
||||
|
||||
/**
|
||||
* @brief Handles telemtry replies and fills the appropriate dataset
|
||||
*
|
||||
* @param dataset Dataset where reply data will be written to
|
||||
* @param size Size of the dataset
|
||||
*
|
||||
* @return returnvalue::OK if successful, otherwise error return value
|
||||
*/
|
||||
ReturnValue_t handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Checks if star tracker is in valid mode for executing the received command.
|
||||
*
|
||||
* @param actioId Id of received command
|
||||
*
|
||||
* @return returnvalue::OK if star tracker is in valid mode, otherwise error return value
|
||||
*/
|
||||
ReturnValue_t checkCommand(ActionId_t actionId);
|
||||
|
||||
void doOnTransition(Submode_t subModeFrom);
|
||||
void doNormalTransition(Mode_t modeFrom, Submode_t subModeFrom);
|
||||
void bootFirmware(Mode_t toMode);
|
||||
void bootBootloader();
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_STARTRACKERHANDLER_H_ */
|
@ -1,181 +0,0 @@
|
||||
#ifndef BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_
|
||||
#define BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_
|
||||
|
||||
/**
|
||||
* @brief Keys used in JSON file of ARCSEC.
|
||||
*/
|
||||
namespace arcseckeys {
|
||||
static const char PROPERTIES[] = "properties";
|
||||
static const char NAME[] = "name";
|
||||
static const char VALUE[] = "value";
|
||||
|
||||
static const char LIMITS[] = "limits";
|
||||
static const char ACTION[] = "action";
|
||||
static const char FPGA18CURRENT[] = "FPGA18Current";
|
||||
static const char FPGA25CURRENT[] = "FPGA25Current";
|
||||
static const char FPGA10CURRENT[] = "FPGA10Current";
|
||||
static const char MCUCURRENT[] = "MCUCurrent";
|
||||
static const char CMOS21CURRENT[] = "CMOS21Current";
|
||||
static const char CMOSPIXCURRENT[] = "CMOSPixCurrent";
|
||||
static const char CMOS33CURRENT[] = "CMOS33Current";
|
||||
static const char CMOSVRESCURRENT[] = "CMOSVResCurrent";
|
||||
static const char CMOS_TEMPERATURE[] = "CMOSTemperature";
|
||||
static const char MCU_TEMPERATURE[] = "MCUTemperature";
|
||||
|
||||
static const char MOUNTING[] = "mounting";
|
||||
static const char qw[] = "qw";
|
||||
static const char qx[] = "qx";
|
||||
static const char qy[] = "qy";
|
||||
static const char qz[] = "qz";
|
||||
|
||||
static const char IMAGE_PROCESSOR[] = "imageprocessor";
|
||||
static const char IMAGE_PROCESSOR_MODE[] = "mode";
|
||||
static const char STORE[] = "store";
|
||||
static const char SIGNAL_THRESHOLD[] = "signalThreshold";
|
||||
static const char IMAGE_PROCESSOR_DARK_THRESHOLD[] = "darkThreshold";
|
||||
static const char BACKGROUND_COMPENSATION[] = "backgroundcompensation";
|
||||
|
||||
static const char CAMERA[] = "camera";
|
||||
static const char MODE[] = "mode";
|
||||
static const char FOCALLENGTH[] = "focallength";
|
||||
static const char EXPOSURE[] = "exposure";
|
||||
static const char INTERVAL[] = "interval";
|
||||
static const char OFFSET[] = "offset";
|
||||
static const char PGAGAIN[] = "PGAGain";
|
||||
static const char ADCGAIN[] = "ADCGain";
|
||||
static const char REG_1[] = "reg1";
|
||||
static const char VAL_1[] = "val1";
|
||||
static const char REG_2[] = "reg2";
|
||||
static const char VAL_2[] = "val2";
|
||||
static const char REG_3[] = "reg3";
|
||||
static const char VAL_3[] = "val3";
|
||||
static const char REG_4[] = "reg4";
|
||||
static const char VAL_4[] = "val4";
|
||||
static const char REG_5[] = "reg5";
|
||||
static const char VAL_5[] = "val5";
|
||||
static const char REG_6[] = "reg6";
|
||||
static const char VAL_6[] = "val6";
|
||||
static const char REG_7[] = "reg7";
|
||||
static const char VAL_7[] = "val7";
|
||||
static const char REG_8[] = "reg8";
|
||||
static const char VAL_8[] = "val8";
|
||||
static const char FREQ_1[] = "freq1";
|
||||
|
||||
static const char BLOB[] = "blob";
|
||||
static const char MIN_VALUE[] = "minValue";
|
||||
static const char MIN_DISTANCE[] = "minDistance";
|
||||
static const char NEIGHBOUR_DISTANCE[] = "neighbourDistance";
|
||||
static const char NEIGHBOUR_BRIGHT_PIXELS[] = "neighbourBrightPixels";
|
||||
static const char MIN_TOTAL_VALUE[] = "minTotalValue";
|
||||
static const char MAX_TOTAL_VALUE[] = "maxTotalValue";
|
||||
static const char MIN_BRIGHT_NEIGHBOURS[] = "minBrightNeighbours";
|
||||
static const char MAX_BRIGHT_NEIGHBOURS[] = "maxBrightNeighbours";
|
||||
static const char MAX_PIXEL_TO_CONSIDER[] = "maxPixelsToConsider";
|
||||
// static const char SIGNAL_THRESHOLD[] = "signalThreshold";
|
||||
static const char BLOB_DARK_THRESHOLD[] = "darkThreshold";
|
||||
static const char ENABLE_HISTOGRAM[] = "enableHistogram";
|
||||
static const char ENABLE_CONTRAST[] = "enableContrast";
|
||||
static const char BIN_MODE[] = "binMode";
|
||||
|
||||
static const char CENTROIDING[] = "centroiding";
|
||||
static const char ENABLE_FILTER[] = "enableFilter";
|
||||
static const char MAX_QUALITY[] = "maxquality";
|
||||
static const char DARK_THRESHOLD[] = "darkthreshold";
|
||||
static const char MIN_QUALITY[] = "minquality";
|
||||
static const char MAX_INTENSITY[] = "maxintensity";
|
||||
static const char MIN_INTENSITY[] = "minintensity";
|
||||
static const char MAX_MAGNITUDE[] = "maxmagnitude";
|
||||
static const char GAUSSIAN_CMAX[] = "gaussianCmax";
|
||||
static const char GAUSSIAN_CMIN[] = "gaussianCmin";
|
||||
static const char TRANSMATRIX_00[] = "transmatrix00";
|
||||
static const char TRANSMATRIX_01[] = "transmatrix01";
|
||||
static const char TRANSMATRIX_10[] = "transmatrix10";
|
||||
static const char TRANSMATRIX_11[] = "transmatrix11";
|
||||
|
||||
static const char LISA[] = "lisa";
|
||||
static const char LISA_MODE[] = "mode";
|
||||
static const char PREFILTER_DIST_THRESHOLD[] = "prefilterDistThreshold";
|
||||
static const char PREFILTER_ANGLE_THRESHOLD[] = "prefilterAngleThreshold";
|
||||
static const char FOV_WIDTH[] = "fov_width";
|
||||
static const char FOV_HEIGHT[] = "fov_height";
|
||||
static const char FLOAT_STAR_LIMIT[] = "float_star_limit";
|
||||
static const char CLOSE_STAR_LIMIT[] = "close_star_limit";
|
||||
static const char RATING_WEIGHT_CLOSE_STAR_COUNT[] = "rating_weight_close_star_count";
|
||||
static const char RATING_WEIGHT_FRACTION_CLOSE[] = "rating_weight_fraction_close";
|
||||
static const char RATING_WEIGHT_MEAN_SUM[] = "rating_weight_mean_sum";
|
||||
static const char RATING_WEIGHT_DB_STAR_COUNT[] = "rating_weight_db_star_count";
|
||||
static const char MAX_COMBINATIONS[] = "max_combinations";
|
||||
static const char NR_STARS_STOP[] = "nr_stars_stop";
|
||||
static const char FRACTION_CLOSE_STOP[] = "fraction_close_stop";
|
||||
|
||||
static const char MATCHING[] = "matching";
|
||||
static const char SQUARED_DISTANCE_LIMIT[] = "squaredDistanceLimit";
|
||||
static const char SQUARED_SHIFT_LIMIT[] = "squaredShiftLimit";
|
||||
|
||||
static const char VALIDATION[] = "validation";
|
||||
static const char STABLE_COUNT[] = "stable_count";
|
||||
static const char MAX_DIFFERENCE[] = "max_difference";
|
||||
static const char MIN_TRACKER_CONFIDENCE[] = "min_trackerConfidence";
|
||||
static const char MIN_MATCHED_STARS[] = "min_matchedStars";
|
||||
|
||||
static const char TRACKING[] = "tracking";
|
||||
static const char THIN_LIMIT[] = "thinLimit";
|
||||
static const char OUTLIER_THRESHOLD[] = "outlierThreshold";
|
||||
static const char OUTLIER_THRESHOLD_QUEST[] = "outlierThresholdQUEST";
|
||||
static const char TRACKER_CHOICE[] = "trackerChoice";
|
||||
|
||||
static const char ALGO[] = "algo";
|
||||
static const char L2T_MIN_CONFIDENCE[] = "l2t_minConfidence";
|
||||
static const char L2T_MIN_MATCHED[] = "l2t_minMatched";
|
||||
static const char T2L_MIN_CONFIDENCE[] = "t2l_minConfidence";
|
||||
static const char T2L_MIN_MATCHED[] = "t2l_minMatched";
|
||||
|
||||
static const char LOGLEVEL[] = "loglevel";
|
||||
static const char LOGLEVEL1[] = "loglevel1";
|
||||
static const char LOGLEVEL2[] = "loglevel2";
|
||||
static const char LOGLEVEL3[] = "loglevel3";
|
||||
static const char LOGLEVEL4[] = "loglevel4";
|
||||
static const char LOGLEVEL5[] = "loglevel5";
|
||||
static const char LOGLEVEL6[] = "loglevel6";
|
||||
static const char LOGLEVEL7[] = "loglevel7";
|
||||
static const char LOGLEVEL8[] = "loglevel8";
|
||||
static const char LOGLEVEL9[] = "loglevel9";
|
||||
static const char LOGLEVEL10[] = "loglevel10";
|
||||
static const char LOGLEVEL11[] = "loglevel11";
|
||||
static const char LOGLEVEL12[] = "loglevel12";
|
||||
static const char LOGLEVEL13[] = "loglevel13";
|
||||
static const char LOGLEVEL14[] = "loglevel14";
|
||||
static const char LOGLEVEL15[] = "loglevel15";
|
||||
static const char LOGLEVEL16[] = "loglevel16";
|
||||
|
||||
static const char SUBSCRIPTION[] = "subscription";
|
||||
static const char TELEMETRY_1[] = "telemetry1";
|
||||
static const char TELEMETRY_2[] = "telemetry2";
|
||||
static const char TELEMETRY_3[] = "telemetry3";
|
||||
static const char TELEMETRY_4[] = "telemetry4";
|
||||
static const char TELEMETRY_5[] = "telemetry5";
|
||||
static const char TELEMETRY_6[] = "telemetry6";
|
||||
static const char TELEMETRY_7[] = "telemetry7";
|
||||
static const char TELEMETRY_8[] = "telemetry8";
|
||||
static const char TELEMETRY_9[] = "telemetry9";
|
||||
static const char TELEMETRY_10[] = "telemetry10";
|
||||
static const char TELEMETRY_11[] = "telemetry11";
|
||||
static const char TELEMETRY_12[] = "telemetry12";
|
||||
static const char TELEMETRY_13[] = "telemetry13";
|
||||
static const char TELEMETRY_14[] = "telemetry14";
|
||||
static const char TELEMETRY_15[] = "telemetry15";
|
||||
static const char TELEMETRY_16[] = "telemetry16";
|
||||
|
||||
static const char LOG_SUBSCRIPTION[] = "logsubscription";
|
||||
static const char LEVEL1[] = "level1";
|
||||
static const char MODULE1[] = "module1";
|
||||
static const char LEVEL2[] = "level2";
|
||||
static const char MODULE2[] = "module2";
|
||||
|
||||
static const char DEBUG_CAMERA[] = "debugcamera";
|
||||
static const char TIMING[] = "timing";
|
||||
static const char TEST[] = "test";
|
||||
|
||||
} // namespace arcseckeys
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_ */
|
@ -1,7 +0,0 @@
|
||||
#include "helpers.h"
|
||||
|
||||
uint8_t str::getReplyFrameType(const uint8_t* rawFrame) { return rawFrame[0]; }
|
||||
|
||||
uint8_t str::getId(const uint8_t* rawFrame) { return rawFrame[1]; }
|
||||
|
||||
uint8_t str::getStatusField(const uint8_t* rawFrame) { return rawFrame[2]; }
|
@ -1,17 +0,0 @@
|
||||
#ifndef LINUX_DEVICES_STARTRACKER_HELPERS_H_
|
||||
#define LINUX_DEVICES_STARTRACKER_HELPERS_H_
|
||||
|
||||
#include "arcsec/common/genericstructs.h"
|
||||
|
||||
namespace str {
|
||||
|
||||
/**
|
||||
* @brief Returns the frame type field of a decoded frame.
|
||||
*/
|
||||
uint8_t getReplyFrameType(const uint8_t* rawFrame);
|
||||
uint8_t getId(const uint8_t* rawFrame);
|
||||
uint8_t getStatusField(const uint8_t* rawFrame);
|
||||
|
||||
} // namespace str
|
||||
|
||||
#endif /* LINUX_DEVICES_STARTRACKER_HELPERS_H_ */
|
@ -1,917 +0,0 @@
|
||||
#include "strJsonCommands.h"
|
||||
|
||||
#include "arcsecJsonKeys.h"
|
||||
|
||||
Limits::Limits() : ArcsecJsonParamBase(arcseckeys::LIMITS) {}
|
||||
|
||||
size_t Limits::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Limits::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::LIMITS);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::ACTION, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::FPGA18CURRENT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::FPGA25CURRENT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::FPGA10CURRENT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MCUCURRENT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::CMOS21CURRENT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::CMOSPIXCURRENT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::CMOS33CURRENT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::CMOSVRESCURRENT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::CMOS_TEMPERATURE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MCU_TEMPERATURE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Tracking::Tracking() : ArcsecJsonParamBase(arcseckeys::TRACKING) {}
|
||||
|
||||
size_t Tracking::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Tracking::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::TRACKING);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::THIN_LIMIT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::OUTLIER_THRESHOLD, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::OUTLIER_THRESHOLD_QUEST, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::TRACKER_CHOICE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Mounting::Mounting() : ArcsecJsonParamBase(arcseckeys::MOUNTING) {}
|
||||
|
||||
size_t Mounting::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Mounting::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::MOUNTING);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::qw, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::qx, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::qy, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::qz, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ImageProcessor::ImageProcessor() : ArcsecJsonParamBase(arcseckeys::IMAGE_PROCESSOR) {}
|
||||
|
||||
size_t ImageProcessor::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t ImageProcessor::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::IMAGE_PROCESSOR);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::IMAGE_PROCESSOR_MODE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::STORE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::SIGNAL_THRESHOLD, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint16(param, buffer + offset);
|
||||
offset += sizeof(uint16_t);
|
||||
result = getParam(arcseckeys::IMAGE_PROCESSOR_DARK_THRESHOLD, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint16(param, buffer + offset);
|
||||
offset += sizeof(uint16_t);
|
||||
result = getParam(arcseckeys::BACKGROUND_COMPENSATION, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Camera::Camera() : ArcsecJsonParamBase(arcseckeys::CAMERA) {}
|
||||
|
||||
size_t Camera::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Camera::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::CAMERA);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::MODE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::FOCALLENGTH, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::EXPOSURE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::INTERVAL, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::OFFSET, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addint16(param, buffer + offset);
|
||||
offset += sizeof(int16_t);
|
||||
result = getParam(arcseckeys::PGAGAIN, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::ADCGAIN, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::REG_1, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::VAL_1, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::REG_2, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::VAL_2, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::REG_3, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::VAL_3, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::REG_4, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::VAL_4, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::REG_5, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::VAL_5, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::REG_6, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::VAL_6, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::REG_7, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::VAL_7, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::REG_8, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::VAL_8, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::FREQ_1, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint32(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Centroiding::Centroiding() : ArcsecJsonParamBase(arcseckeys::CENTROIDING) {}
|
||||
|
||||
size_t Centroiding::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Centroiding::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::CENTROIDING);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::ENABLE_FILTER, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::MAX_QUALITY, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::DARK_THRESHOLD, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MIN_QUALITY, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MAX_INTENSITY, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MIN_INTENSITY, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MAX_MAGNITUDE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::GAUSSIAN_CMAX, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::GAUSSIAN_CMIN, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::TRANSMATRIX_00, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::TRANSMATRIX_01, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::TRANSMATRIX_10, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::TRANSMATRIX_11, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Lisa::Lisa() : ArcsecJsonParamBase(arcseckeys::LISA) {}
|
||||
|
||||
size_t Lisa::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Lisa::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::LISA);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::LISA_MODE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint32(param, buffer + offset);
|
||||
offset += sizeof(uint32_t);
|
||||
result = getParam(arcseckeys::PREFILTER_DIST_THRESHOLD, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::PREFILTER_ANGLE_THRESHOLD, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::FOV_WIDTH, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::FOV_HEIGHT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::FLOAT_STAR_LIMIT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::CLOSE_STAR_LIMIT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::RATING_WEIGHT_CLOSE_STAR_COUNT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::RATING_WEIGHT_FRACTION_CLOSE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::RATING_WEIGHT_MEAN_SUM, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::RATING_WEIGHT_DB_STAR_COUNT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MAX_COMBINATIONS, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::NR_STARS_STOP, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::FRACTION_CLOSE_STOP, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Matching::Matching() : ArcsecJsonParamBase(arcseckeys::MATCHING) {}
|
||||
|
||||
size_t Matching::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Matching::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::MATCHING);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::SQUARED_DISTANCE_LIMIT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::SQUARED_SHIFT_LIMIT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Validation::Validation() : ArcsecJsonParamBase(arcseckeys::VALIDATION) {}
|
||||
|
||||
size_t Validation::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Validation::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::VALIDATION);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::STABLE_COUNT, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::MAX_DIFFERENCE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MIN_TRACKER_CONFIDENCE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::MIN_MATCHED_STARS, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Algo::Algo() : ArcsecJsonParamBase(arcseckeys::ALGO) {}
|
||||
|
||||
size_t Algo::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Algo::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::ALGO);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::MODE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::L2T_MIN_CONFIDENCE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::L2T_MIN_MATCHED, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::T2L_MIN_CONFIDENCE, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
addfloat(param, buffer + offset);
|
||||
offset += sizeof(float);
|
||||
result = getParam(arcseckeys::T2L_MIN_MATCHED, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
LogLevel::LogLevel() : ArcsecJsonParamBase(arcseckeys::LOGLEVEL) {}
|
||||
|
||||
size_t LogLevel::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t LogLevel::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::LOG_LEVEL);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::LOGLEVEL1, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL2, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL3, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL4, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL5, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL6, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL7, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL8, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL9, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL10, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL11, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL12, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL13, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL14, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL15, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LOGLEVEL16, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
Subscription::Subscription() : ArcsecJsonParamBase(arcseckeys::SUBSCRIPTION) {}
|
||||
|
||||
size_t Subscription::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t Subscription::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::SUBSCRIPTION);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::TELEMETRY_1, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_2, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_3, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_4, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_5, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_6, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_7, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_8, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_9, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_10, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_11, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_12, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_13, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_14, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_15, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::TELEMETRY_16, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
LogSubscription::LogSubscription() : ArcsecJsonParamBase(arcseckeys::LOG_SUBSCRIPTION) {}
|
||||
|
||||
size_t LogSubscription::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t LogSubscription::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::LOG_SUBSCRIPTION);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::LEVEL1, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::MODULE1, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::LEVEL2, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
offset += sizeof(uint8_t);
|
||||
result = getParam(arcseckeys::MODULE2, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint8(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
DebugCamera::DebugCamera() : ArcsecJsonParamBase(arcseckeys::DEBUG_CAMERA) {}
|
||||
|
||||
size_t DebugCamera::getSize() { return COMMAND_SIZE; }
|
||||
|
||||
ReturnValue_t DebugCamera::createCommand(uint8_t* buffer) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
uint8_t offset = 0;
|
||||
std::string param;
|
||||
addSetParamHeader(buffer, startracker::ID::DEBUG_CAMERA);
|
||||
offset = 2;
|
||||
result = getParam(arcseckeys::TIMING, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint32(param, buffer + offset);
|
||||
offset += sizeof(uint32_t);
|
||||
result = getParam(arcseckeys::TEST, param);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
adduint32(param, buffer + offset);
|
||||
return returnvalue::OK;
|
||||
}
|
@ -1,240 +0,0 @@
|
||||
#ifndef BSP_Q7S_DEVICES_DEVICEDEFINITIONS_STARTRACKERJSONCOMMANDS_H_
|
||||
#define BSP_Q7S_DEVICES_DEVICEDEFINITIONS_STARTRACKERJSONCOMMANDS_H_
|
||||
|
||||
/**
|
||||
* @brief This file defines a few helper classes to generate commands by means of the parameters
|
||||
* defined in the arcsec json files.
|
||||
* @author J. Meier
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ArcsecJsonParamBase.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
/**
|
||||
* @brief Generates command to set the limit parameters
|
||||
*
|
||||
*/
|
||||
class Limits : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Limits();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 43;
|
||||
|
||||
virtual ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates the command to configure the tracking algorithm.
|
||||
*
|
||||
*/
|
||||
class Tracking : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Tracking();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 15;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates the command to set the mounting quaternion
|
||||
*
|
||||
*/
|
||||
class Mounting : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Mounting();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 18;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates the command to configure the image processor
|
||||
*
|
||||
*/
|
||||
class ImageProcessor : public ArcsecJsonParamBase {
|
||||
public:
|
||||
ImageProcessor();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 9;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates the command to set the mounting quaternion
|
||||
*
|
||||
*/
|
||||
class Camera : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Camera();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 39;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates the command to configure the centroiding algorithm
|
||||
*
|
||||
*/
|
||||
class Centroiding : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Centroiding();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 51;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates the command to configure the LISA (lost in space algorithm)
|
||||
*
|
||||
*/
|
||||
class Lisa : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Lisa();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 52;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates the command to configure the matching algorithm
|
||||
*
|
||||
*/
|
||||
class Matching : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Matching();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 10;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates the command to configure the validation parameters
|
||||
*
|
||||
*/
|
||||
class Validation : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Validation();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 12;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates command to configure the mechanism of automatically switching between the
|
||||
* LISA and other algorithms.
|
||||
*
|
||||
*/
|
||||
class Algo : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Algo();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 13;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates command to configure the log level parameters.
|
||||
*
|
||||
*/
|
||||
class LogLevel : public ArcsecJsonParamBase {
|
||||
public:
|
||||
LogLevel();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 18;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates command to set subscription parameters.
|
||||
*
|
||||
*/
|
||||
class Subscription : public ArcsecJsonParamBase {
|
||||
public:
|
||||
Subscription();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 18;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates command to set log subscription parameters.
|
||||
*
|
||||
*/
|
||||
class LogSubscription : public ArcsecJsonParamBase {
|
||||
public:
|
||||
LogSubscription();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 6;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Generates command to set debug camera parameters
|
||||
*
|
||||
*/
|
||||
class DebugCamera : public ArcsecJsonParamBase {
|
||||
public:
|
||||
DebugCamera();
|
||||
|
||||
size_t getSize();
|
||||
|
||||
private:
|
||||
static const size_t COMMAND_SIZE = 10;
|
||||
|
||||
ReturnValue_t createCommand(uint8_t* buffer) override;
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_STARTRACKERJSONCOMMANDS_H_ */
|
Reference in New Issue
Block a user