fixed merge conflicts
This commit is contained in:
@ -1,5 +1,89 @@
|
||||
#include "AcsSubsystem.h"
|
||||
|
||||
#include <fsfw/events/EventManagerIF.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
|
||||
#include "fsfw/modes/ModeMessage.h"
|
||||
#include "mission/acsDefs.h"
|
||||
|
||||
AcsSubsystem::AcsSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences,
|
||||
uint32_t maxNumberOfTables)
|
||||
: Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) {}
|
||||
: Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) {
|
||||
auto mqArgs = MqArgs(getObjectId(), static_cast<void*>(this));
|
||||
eventQueue =
|
||||
QueueFactory::instance()->createMessageQueue(10, EventMessage::EVENT_MESSAGE_SIZE, &mqArgs);
|
||||
}
|
||||
|
||||
ReturnValue_t AcsSubsystem::initialize() {
|
||||
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||
if (manager == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "AcsSubsystem::initialize: Invalid event manager" << std::endl;
|
||||
#endif
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
ReturnValue_t result = manager->registerListener(eventQueue->getId());
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "AcsSubsystem::registerListener: Failed to register as "
|
||||
"listener"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
;
|
||||
}
|
||||
result =
|
||||
manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::SAFE_RATE_VIOLATION));
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "AcsSubsystem: Subscribing for acs::SAFE_RATE_VIOLATION failed" << std::endl;
|
||||
}
|
||||
result =
|
||||
manager->subscribeToEvent(eventQueue->getId(), event::getEventId(acs::SAFE_RATE_RECOVERY));
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "AcsSubsystem: Subscribing for acs::SAFE_RATE_RECOVERY failed" << std::endl;
|
||||
}
|
||||
return Subsystem::initialize();
|
||||
}
|
||||
|
||||
void AcsSubsystem::performChildOperation() {
|
||||
handleEventMessages();
|
||||
return Subsystem::performChildOperation();
|
||||
}
|
||||
|
||||
void AcsSubsystem::handleEventMessages() {
|
||||
EventMessage event;
|
||||
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
|
||||
result = eventQueue->receiveMessage(&event)) {
|
||||
switch (event.getMessageId()) {
|
||||
case EventMessage::EVENT_MESSAGE:
|
||||
if (event.getEvent() == acs::SAFE_RATE_VIOLATION) {
|
||||
CommandMessage msg;
|
||||
ModeMessage::setCmdModeMessage(msg, acs::AcsMode::DETUMBLE, 0);
|
||||
ReturnValue_t result = commandQueue->sendMessage(commandQueue->getId(), &msg);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "AcsSubsystem: sending DETUMBLE mode cmd to self has failed" << std::endl;
|
||||
}
|
||||
}
|
||||
if (event.getEvent() == acs::SAFE_RATE_RECOVERY) {
|
||||
CommandMessage msg;
|
||||
ModeMessage::setCmdModeMessage(msg, acs::AcsMode::SAFE, 0);
|
||||
ReturnValue_t result = commandQueue->sendMessage(commandQueue->getId(), &msg);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "AcsSubsystem: sending IDLE mode cmd to self has failed" << std::endl;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sif::debug << "AcsSubsystem::performChildOperation: Did not subscribe "
|
||||
"to this event message"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AcsSubsystem::announceMode(bool recursive) {
|
||||
const char* modeStr = acs::getModeStr(static_cast<acs::AcsMode>(mode));
|
||||
sif::info << "ACS subsystem is now in " << modeStr << " mode" << std::endl;
|
||||
return Subsystem::announceMode(recursive);
|
||||
}
|
||||
|
@ -8,6 +8,13 @@ class AcsSubsystem : public Subsystem {
|
||||
AcsSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables);
|
||||
|
||||
private:
|
||||
ReturnValue_t initialize() override;
|
||||
void performChildOperation() override;
|
||||
void announceMode(bool recursive) override;
|
||||
|
||||
void handleEventMessages();
|
||||
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
};
|
||||
|
||||
#endif /* MISSION_SYSTEM_ACSSUBSYSTEM_H_ */
|
||||
|
@ -4,6 +4,7 @@ target_sources(
|
||||
CamSwitcher.cpp
|
||||
AcsSubsystem.cpp
|
||||
ComSubsystem.cpp
|
||||
TcsSubsystem.cpp
|
||||
PayloadSubsystem.cpp
|
||||
AcsBoardAssembly.cpp
|
||||
Stack5VHandler.cpp
|
||||
|
@ -1,5 +1,43 @@
|
||||
#include "EiveSystem.h"
|
||||
|
||||
#include <mission/acsDefs.h>
|
||||
|
||||
EiveSystem::EiveSystem(object_id_t setObjectId, uint32_t maxNumberOfSequences,
|
||||
uint32_t maxNumberOfTables)
|
||||
: Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables) {}
|
||||
|
||||
void EiveSystem::announceMode(bool recursive) {
|
||||
const char* modeStr = "UNKNOWN";
|
||||
switch (mode) {
|
||||
case (acs::AcsMode::OFF): {
|
||||
modeStr = "OFF";
|
||||
break;
|
||||
}
|
||||
case (acs::AcsMode::SAFE): {
|
||||
modeStr = "SAFE";
|
||||
break;
|
||||
}
|
||||
case (acs::AcsMode::DETUMBLE): {
|
||||
modeStr = "DETUBMLE";
|
||||
break;
|
||||
}
|
||||
case (acs::AcsMode::PTG_IDLE): {
|
||||
modeStr = "POINTING IDLE";
|
||||
break;
|
||||
}
|
||||
case (acs::AcsMode::PTG_INERTIAL): {
|
||||
modeStr = "POINTING INERTIAL";
|
||||
break;
|
||||
}
|
||||
case (acs::AcsMode::PTG_TARGET): {
|
||||
modeStr = "POINTING TARGET";
|
||||
break;
|
||||
}
|
||||
case (acs::AcsMode::PTG_TARGET_GS): {
|
||||
modeStr = "POINTING TARGET GS";
|
||||
break;
|
||||
}
|
||||
}
|
||||
sif::info << "EIVE system is now in " << modeStr << " mode" << std::endl;
|
||||
return Subsystem::announceMode(recursive);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ class EiveSystem : public Subsystem {
|
||||
EiveSystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables);
|
||||
|
||||
private:
|
||||
void announceMode(bool recursive) override;
|
||||
};
|
||||
|
||||
#endif /* MISSION_SYSTEM_EIVESYSTEM_H_ */
|
||||
|
27
mission/system/objects/TcsSubsystem.cpp
Normal file
27
mission/system/objects/TcsSubsystem.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "TcsSubsystem.h"
|
||||
|
||||
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
|
||||
|
||||
TcsSubsystem::TcsSubsystem(object_id_t objectId, uint32_t maxNumberOfSequences,
|
||||
uint32_t maxNumberOfTables)
|
||||
: Subsystem(objectId, maxNumberOfSequences, maxNumberOfTables) {}
|
||||
|
||||
void TcsSubsystem::announceMode(bool recursive) {
|
||||
const char* modeStr = "UNKNOWN";
|
||||
switch (mode) {
|
||||
case (HasModesIF::MODE_OFF): {
|
||||
modeStr = "OFF";
|
||||
break;
|
||||
}
|
||||
case (HasModesIF::MODE_ON): {
|
||||
modeStr = "ON";
|
||||
break;
|
||||
}
|
||||
case (DeviceHandlerIF::MODE_NORMAL): {
|
||||
modeStr = "NORMAL";
|
||||
break;
|
||||
}
|
||||
}
|
||||
sif::info << "TCS subsystem is now in " << modeStr << " mode" << std::endl;
|
||||
return Subsystem::announceMode(recursive);
|
||||
}
|
13
mission/system/objects/TcsSubsystem.h
Normal file
13
mission/system/objects/TcsSubsystem.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef MISSION_SYSTEM_OBJECTS_TCSSUBSYSTEM_H_
|
||||
#define MISSION_SYSTEM_OBJECTS_TCSSUBSYSTEM_H_
|
||||
#include <fsfw/subsystem/Subsystem.h>
|
||||
|
||||
class TcsSubsystem : public Subsystem {
|
||||
public:
|
||||
TcsSubsystem(object_id_t objectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables);
|
||||
|
||||
private:
|
||||
void announceMode(bool recursive) override;
|
||||
};
|
||||
|
||||
#endif /* MISSION_SYSTEM_OBJECTS_TCSSUBSYSTEM_H_ */
|
@ -18,7 +18,14 @@ enum Submodes : Submode_t { A_SIDE = 0, B_SIDE = 1, DUAL_MODE = 2 };
|
||||
|
||||
namespace payload {
|
||||
|
||||
enum Mode { OFF = 0, SUPV_ONLY = 1, MPSOC_STREAM = 2, CAM_STREAM = 3, EARTH_OBSV = 4, SCEX = 5 };
|
||||
enum Mode {
|
||||
OFF = 0,
|
||||
SUPV_ONLY = 10,
|
||||
MPSOC_STREAM = 11,
|
||||
CAM_STREAM = 12,
|
||||
EARTH_OBSV = 13,
|
||||
SCEX = 14
|
||||
};
|
||||
|
||||
namespace ploc {
|
||||
|
||||
|
Reference in New Issue
Block a user