added GpsDummy

This commit is contained in:
Marius Eggert 2022-10-12 15:04:19 +02:00
parent 4aecd07970
commit 2a9dc518a0
5 changed files with 95 additions and 2 deletions

View File

@ -161,6 +161,7 @@ void initmission::initTasks() {
acsTask->addComponent(objects::GYRO_1_L3G_HANDLER); acsTask->addComponent(objects::GYRO_1_L3G_HANDLER);
acsTask->addComponent(objects::GYRO_2_ADIS_HANDLER); acsTask->addComponent(objects::GYRO_2_ADIS_HANDLER);
acsTask->addComponent(objects::GYRO_3_L3G_HANDLER); acsTask->addComponent(objects::GYRO_3_L3G_HANDLER);
acsTask->addComponent(objects::GPS_CONTROLLER);
acsTask->addComponent(objects::STAR_TRACKER); acsTask->addComponent(objects::STAR_TRACKER);
#endif #endif

View File

@ -12,6 +12,7 @@ target_sources(
AcuDummy.cpp AcuDummy.cpp
PduDummy.cpp PduDummy.cpp
P60DockDummy.cpp P60DockDummy.cpp
GpsDummy.cpp
GyroAdisDummy.cpp GyroAdisDummy.cpp
GyroL3GD20Dummy.cpp GyroL3GD20Dummy.cpp
MgmLIS3MDLDummy.cpp MgmLIS3MDLDummy.cpp

56
dummies/GpsDummy.cpp Normal file
View File

@ -0,0 +1,56 @@
#include "GpsDummy.h"
#include <mission/devices/devicedefinitions/GPSDefinitions.h>
GpsDummy::GpsDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
: DeviceHandlerBase(objectId, comif, comCookie) {}
GpsDummy::~GpsDummy() {}
void GpsDummy::doStartUp() {}
void GpsDummy::doShutDown() {}
ReturnValue_t GpsDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
ReturnValue_t GpsDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t GpsDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData, size_t commandDataLen) {
return returnvalue::OK;
}
ReturnValue_t GpsDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) {
return returnvalue::OK;
}
ReturnValue_t GpsDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
return returnvalue::OK;
}
void GpsDummy::fillCommandAndReplyMap() {}
uint32_t GpsDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t GpsDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(GpsHyperion::LATITUDE, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(GpsHyperion::LONGITUDE, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(GpsHyperion::ALTITUDE, new PoolEntry<double>({0.0}));
localDataPoolMap.emplace(GpsHyperion::SPEED, new PoolEntry<double>({7684.2}));
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(GpsHyperion::YEAR, new PoolEntry<uint16_t>({0}));
localDataPoolMap.emplace(GpsHyperion::MONTH, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(GpsHyperion::DAY, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(GpsHyperion::HOURS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(GpsHyperion::MINUTES, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(GpsHyperion::SECONDS, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(GpsHyperion::UNIX_SECONDS, new PoolEntry<uint32_t>({0}));
return returnvalue::OK;
}

33
dummies/GpsDummy.h Normal file
View File

@ -0,0 +1,33 @@
#ifndef DUMMIES_GPSDUMMY_H_
#define DUMMIES_GPSDUMMY_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
class GpsDummy : public DeviceHandlerBase {
public:
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
static const DeviceCommandId_t PERIODIC_REPLY = 2;
static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2;
GpsDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
virtual ~GpsDummy();
protected:
void doStartUp() override;
void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override;
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void fillCommandAndReplyMap() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
};
#endif /* DUMMIES_GPSDUMMY_H_ */

View File

@ -1,10 +1,9 @@
#include "helpers.h"
#include <dummies/AcuDummy.h> #include <dummies/AcuDummy.h>
#include <dummies/BpxDummy.h> #include <dummies/BpxDummy.h>
#include <dummies/ComCookieDummy.h> #include <dummies/ComCookieDummy.h>
#include <dummies/ComIFDummy.h> #include <dummies/ComIFDummy.h>
#include <dummies/CoreControllerDummy.h> #include <dummies/CoreControllerDummy.h>
#include <dummies/GpsDummy.h>
#include <dummies/GyroAdisDummy.h> #include <dummies/GyroAdisDummy.h>
#include <dummies/GyroL3GD20Dummy.h> #include <dummies/GyroL3GD20Dummy.h>
#include <dummies/ImtqDummy.h> #include <dummies/ImtqDummy.h>
@ -18,6 +17,8 @@
#include <dummies/SusDummy.h> #include <dummies/SusDummy.h>
#include <dummies/SyrlinksDummy.h> #include <dummies/SyrlinksDummy.h>
#include "helpers.h"
using namespace dummy; using namespace dummy;
void dummy::createDummies(DummyCfg cfg) { void dummy::createDummies(DummyCfg cfg) {
@ -51,6 +52,7 @@ void dummy::createDummies(DummyCfg cfg) {
new MgmLIS3MDLDummy(objects::MGM_2_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new MgmLIS3MDLDummy(objects::MGM_2_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new MgmRm3100Dummy(objects::MGM_1_RM3100_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new MgmRm3100Dummy(objects::MGM_1_RM3100_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new MgmRm3100Dummy(objects::MGM_3_RM3100_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new MgmRm3100Dummy(objects::MGM_3_RM3100_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GpsDummy(objects::GPS_CONTROLLER, objects::DUMMY_COM_IF, comCookieDummy);
} }
if (cfg.addSusDummies) { if (cfg.addSusDummies) {