|
|
|
@ -38,11 +38,32 @@ ReturnValue_t AcsBoardAssembly::commandChildren(Mode_t mode, Submode_t submode)
|
|
|
|
|
helper.mgm2SideBMode = childrenMap[helper.mgm2Lis3IdSideB].mode;
|
|
|
|
|
helper.mgm3SideBMode = childrenMap[helper.mgm3Rm3100IdSideB].mode;
|
|
|
|
|
helper.gpsMode = childrenMap[helper.gpsId].mode;
|
|
|
|
|
if (mode == DeviceHandlerIF::MODE_NORMAL) {
|
|
|
|
|
handleNormalModeCmd(submode);
|
|
|
|
|
} else if (mode == MODE_ON) {
|
|
|
|
|
} else {
|
|
|
|
|
if (state == States::MODE_COMMANDING) {
|
|
|
|
|
if (mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_ON) {
|
|
|
|
|
powerStateMachine(submode);
|
|
|
|
|
handleNormalOrOnModeCmd(mode, submode);
|
|
|
|
|
} else {
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_0_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_0_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_1_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_1_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_2_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_2_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_3_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_3_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_0_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_0_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_1_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_1_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_2_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_2_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_3_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_3_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::GPS].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GPS].setSubmode(SUBMODE_NONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HybridIterator<ModeListEntry> tableIter(modeTable.begin(), modeTable.end());
|
|
|
|
|
executeTable(tableIter);
|
|
|
|
|
return result;
|
|
|
|
@ -116,12 +137,11 @@ bool AcsBoardAssembly::isUseable(object_id_t object, Mode_t mode) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReturnValue_t AcsBoardAssembly::handleNormalModeCmd(Submode_t submode) {
|
|
|
|
|
ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) {
|
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
|
Mode_t tgtMode = DeviceHandlerIF::MODE_NORMAL;
|
|
|
|
|
powerStateMachine(submode);
|
|
|
|
|
if (state == States::MODE_COMMANDING) {
|
|
|
|
|
auto cmdSeq = [&](object_id_t objectId, ModeTableIdx tableIdx) {
|
|
|
|
|
auto cmdSeq = [&](object_id_t objectId, ModeTableIdx tableIdx) {
|
|
|
|
|
if(tgtMode == DeviceHandlerIF::MODE_NORMAL) {
|
|
|
|
|
if (isUseable(objectId, mode)) {
|
|
|
|
|
if (helper.gyro0SideAMode != MODE_OFF) {
|
|
|
|
|
modeTable[tableIdx].setMode(tgtMode);
|
|
|
|
@ -132,53 +152,61 @@ ReturnValue_t AcsBoardAssembly::handleNormalModeCmd(Submode_t submode) {
|
|
|
|
|
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
switch (submode) {
|
|
|
|
|
case (A_SIDE): {
|
|
|
|
|
cmdSeq(helper.gyro0AdisIdSideA, ModeTableIdx::GYRO_0_A);
|
|
|
|
|
cmdSeq(helper.gyro1L3gIdSideA, ModeTableIdx::GYRO_1_A);
|
|
|
|
|
cmdSeq(helper.mgm0Lis3IdSideA, ModeTableIdx::MGM_0_A);
|
|
|
|
|
cmdSeq(helper.mgm1Rm3100IdSideA, ModeTableIdx::MGM_1_A);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_2_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_2_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_3_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_3_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_2_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_2_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_3_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_3_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case (B_SIDE): {
|
|
|
|
|
cmdSeq(helper.gyro2AdisIdSideB, ModeTableIdx::GYRO_2_B);
|
|
|
|
|
cmdSeq(helper.gyro3L3gIdSideB, ModeTableIdx::GYRO_3_B);
|
|
|
|
|
cmdSeq(helper.mgm2Lis3IdSideB, ModeTableIdx::MGM_2_B);
|
|
|
|
|
cmdSeq(helper.mgm3Rm3100IdSideB, ModeTableIdx::MGM_3_B);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_0_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_0_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_1_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_1_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_0_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_0_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_1_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_1_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case (DUAL_MODE): {
|
|
|
|
|
cmdSeq(helper.gyro0AdisIdSideA, ModeTableIdx::GYRO_0_A);
|
|
|
|
|
cmdSeq(helper.gyro1L3gIdSideA, ModeTableIdx::GYRO_1_A);
|
|
|
|
|
cmdSeq(helper.gyro2AdisIdSideB, ModeTableIdx::GYRO_2_B);
|
|
|
|
|
cmdSeq(helper.gyro3L3gIdSideB, ModeTableIdx::GYRO_3_B);
|
|
|
|
|
cmdSeq(helper.mgm0Lis3IdSideA, ModeTableIdx::MGM_0_A);
|
|
|
|
|
cmdSeq(helper.mgm1Rm3100IdSideA, ModeTableIdx::MGM_1_A);
|
|
|
|
|
cmdSeq(helper.mgm2Lis3IdSideB, ModeTableIdx::MGM_2_B);
|
|
|
|
|
cmdSeq(helper.mgm3Rm3100IdSideB, ModeTableIdx::MGM_3_B);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
sif::error << "AcsBoardAssembly::handleNormalModeCmd: Unknown submode" << std::endl;
|
|
|
|
|
} else if(tgtMode == MODE_ON) {
|
|
|
|
|
if (isUseable(objectId, mode)) {
|
|
|
|
|
modeTable[tableIdx].setMode(MODE_ON);
|
|
|
|
|
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
switch (submode) {
|
|
|
|
|
case (A_SIDE): {
|
|
|
|
|
cmdSeq(helper.gyro0AdisIdSideA, ModeTableIdx::GYRO_0_A);
|
|
|
|
|
cmdSeq(helper.gyro1L3gIdSideA, ModeTableIdx::GYRO_1_A);
|
|
|
|
|
cmdSeq(helper.mgm0Lis3IdSideA, ModeTableIdx::MGM_0_A);
|
|
|
|
|
cmdSeq(helper.mgm1Rm3100IdSideA, ModeTableIdx::MGM_1_A);
|
|
|
|
|
cmdSeq(helper.gpsId, ModeTableIdx::GPS);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_2_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_2_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_3_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_3_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_2_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_2_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_3_B].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_3_B].setSubmode(SUBMODE_NONE);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case (B_SIDE): {
|
|
|
|
|
cmdSeq(helper.gyro2AdisIdSideB, ModeTableIdx::GYRO_2_B);
|
|
|
|
|
cmdSeq(helper.gyro3L3gIdSideB, ModeTableIdx::GYRO_3_B);
|
|
|
|
|
cmdSeq(helper.mgm2Lis3IdSideB, ModeTableIdx::MGM_2_B);
|
|
|
|
|
cmdSeq(helper.mgm3Rm3100IdSideB, ModeTableIdx::MGM_3_B);
|
|
|
|
|
cmdSeq(helper.gpsId, ModeTableIdx::GPS);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_0_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_0_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_1_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::GYRO_1_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_0_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_0_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_1_A].setMode(MODE_OFF);
|
|
|
|
|
modeTable[ModeTableIdx::MGM_1_A].setSubmode(SUBMODE_NONE);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
case (DUAL_MODE): {
|
|
|
|
|
cmdSeq(helper.gpsId, ModeTableIdx::GPS);
|
|
|
|
|
cmdSeq(helper.gyro0AdisIdSideA, ModeTableIdx::GYRO_0_A);
|
|
|
|
|
cmdSeq(helper.gyro1L3gIdSideA, ModeTableIdx::GYRO_1_A);
|
|
|
|
|
cmdSeq(helper.gyro2AdisIdSideB, ModeTableIdx::GYRO_2_B);
|
|
|
|
|
cmdSeq(helper.gyro3L3gIdSideB, ModeTableIdx::GYRO_3_B);
|
|
|
|
|
cmdSeq(helper.mgm0Lis3IdSideA, ModeTableIdx::MGM_0_A);
|
|
|
|
|
cmdSeq(helper.mgm1Rm3100IdSideA, ModeTableIdx::MGM_1_A);
|
|
|
|
|
cmdSeq(helper.mgm2Lis3IdSideB, ModeTableIdx::MGM_2_B);
|
|
|
|
|
cmdSeq(helper.mgm3Rm3100IdSideB, ModeTableIdx::MGM_3_B);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
sif::error << "AcsBoardAssembly::handleNormalModeCmd: Unknown submode" << std::endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
@ -244,6 +272,6 @@ void AcsBoardAssembly::powerStateMachine(Submode_t submode) {
|
|
|
|
|
state = States::SWITCHING_POWER;
|
|
|
|
|
}
|
|
|
|
|
if (state == States::SWITCHING_POWER) {
|
|
|
|
|
// TODO: Could check for a timeout (temporal or cycles) here and resent command
|
|
|
|
|
// TODO: Could check for a timeout (temporal or cycles) here and resend command
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|