v1.10.0 #220
@ -28,6 +28,14 @@ LocalPoolDataSetBase *GPSHyperionLinuxController::getDataSetHandle(sid_t sid) {
|
|||||||
|
|
||||||
ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t *msToReachTheMode) {
|
uint32_t *msToReachTheMode) {
|
||||||
|
if(not modeCommanded) {
|
||||||
|
if(mode == MODE_ON or mode == MODE_OFF) {
|
||||||
|
// 10 minutes time to reach fix
|
||||||
|
*msToReachTheMode = 600000;
|
||||||
|
maxTimeToReachFix.resetTimer();
|
||||||
|
modeCommanded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +122,13 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
|||||||
// 0: Not seen, 1: No fix, 2: 2D-Fix, 3: 3D-Fix
|
// 0: Not seen, 1: No fix, 2: 2D-Fix, 3: 3D-Fix
|
||||||
gpsSet.fixMode.value = gps->fix.mode;
|
gpsSet.fixMode.value = gps->fix.mode;
|
||||||
if (gps->fix.mode == 0 or gps->fix.mode == 1) {
|
if (gps->fix.mode == 0 or gps->fix.mode == 1) {
|
||||||
|
if(modeCommanded and maxTimeToReachFix.hasTimedOut()) {
|
||||||
|
// We are supposed to be on and functioning, but not fix was found
|
||||||
|
if(mode == MODE_ON or mode == MODE_NORMAL) {
|
||||||
|
mode = MODE_OFF;
|
||||||
|
}
|
||||||
|
modeCommanded = false;
|
||||||
|
}
|
||||||
gpsSet.setValidity(false, true);
|
gpsSet.setValidity(false, true);
|
||||||
} else if (gps->satellites_used > 0) {
|
} else if (gps->satellites_used > 0) {
|
||||||
gpsSet.setValidity(true, true);
|
gpsSet.setValidity(true, true);
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
class GPSHyperionLinuxController : public ExtendedControllerBase {
|
class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||||
public:
|
public:
|
||||||
|
static constexpr uint32_t MAX_SECONDS_TO_REACH_FIX = 600;
|
||||||
GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
||||||
bool debugHyperionGps = false);
|
bool debugHyperionGps = false);
|
||||||
virtual ~GPSHyperionLinuxController();
|
virtual ~GPSHyperionLinuxController();
|
||||||
@ -46,6 +47,8 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
GpsPrimaryDataset gpsSet;
|
GpsPrimaryDataset gpsSet;
|
||||||
|
Countdown maxTimeToReachFix = Countdown(MAX_SECONDS_TO_REACH_FIX * 1000);
|
||||||
|
bool modeCommanded = true;
|
||||||
gpsmm myGpsmm;
|
gpsmm myGpsmm;
|
||||||
bool debugHyperionGps = false;
|
bool debugHyperionGps = false;
|
||||||
|
|
||||||
|
@ -38,11 +38,32 @@ ReturnValue_t AcsBoardAssembly::commandChildren(Mode_t mode, Submode_t submode)
|
|||||||
helper.mgm2SideBMode = childrenMap[helper.mgm2Lis3IdSideB].mode;
|
helper.mgm2SideBMode = childrenMap[helper.mgm2Lis3IdSideB].mode;
|
||||||
helper.mgm3SideBMode = childrenMap[helper.mgm3Rm3100IdSideB].mode;
|
helper.mgm3SideBMode = childrenMap[helper.mgm3Rm3100IdSideB].mode;
|
||||||
helper.gpsMode = childrenMap[helper.gpsId].mode;
|
helper.gpsMode = childrenMap[helper.gpsId].mode;
|
||||||
if (mode == DeviceHandlerIF::MODE_NORMAL) {
|
if (state == States::MODE_COMMANDING) {
|
||||||
handleNormalModeCmd(submode);
|
if (mode == DeviceHandlerIF::MODE_NORMAL or mode == MODE_ON) {
|
||||||
} else if (mode == MODE_ON) {
|
powerStateMachine(submode);
|
||||||
|
handleNormalOrOnModeCmd(mode, submode);
|
||||||
} else {
|
} 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());
|
HybridIterator<ModeListEntry> tableIter(modeTable.begin(), modeTable.end());
|
||||||
executeTable(tableIter);
|
executeTable(tableIter);
|
||||||
return result;
|
return result;
|
||||||
@ -116,12 +137,11 @@ bool AcsBoardAssembly::isUseable(object_id_t object, Mode_t mode) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AcsBoardAssembly::handleNormalModeCmd(Submode_t submode) {
|
ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
Mode_t tgtMode = DeviceHandlerIF::MODE_NORMAL;
|
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 (isUseable(objectId, mode)) {
|
||||||
if (helper.gyro0SideAMode != MODE_OFF) {
|
if (helper.gyro0SideAMode != MODE_OFF) {
|
||||||
modeTable[tableIdx].setMode(tgtMode);
|
modeTable[tableIdx].setMode(tgtMode);
|
||||||
@ -132,6 +152,12 @@ ReturnValue_t AcsBoardAssembly::handleNormalModeCmd(Submode_t submode) {
|
|||||||
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if(tgtMode == MODE_ON) {
|
||||||
|
if (isUseable(objectId, mode)) {
|
||||||
|
modeTable[tableIdx].setMode(MODE_ON);
|
||||||
|
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
switch (submode) {
|
switch (submode) {
|
||||||
case (A_SIDE): {
|
case (A_SIDE): {
|
||||||
@ -139,6 +165,7 @@ ReturnValue_t AcsBoardAssembly::handleNormalModeCmd(Submode_t submode) {
|
|||||||
cmdSeq(helper.gyro1L3gIdSideA, ModeTableIdx::GYRO_1_A);
|
cmdSeq(helper.gyro1L3gIdSideA, ModeTableIdx::GYRO_1_A);
|
||||||
cmdSeq(helper.mgm0Lis3IdSideA, ModeTableIdx::MGM_0_A);
|
cmdSeq(helper.mgm0Lis3IdSideA, ModeTableIdx::MGM_0_A);
|
||||||
cmdSeq(helper.mgm1Rm3100IdSideA, ModeTableIdx::MGM_1_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].setMode(MODE_OFF);
|
||||||
modeTable[ModeTableIdx::GYRO_2_B].setSubmode(SUBMODE_NONE);
|
modeTable[ModeTableIdx::GYRO_2_B].setSubmode(SUBMODE_NONE);
|
||||||
modeTable[ModeTableIdx::GYRO_3_B].setMode(MODE_OFF);
|
modeTable[ModeTableIdx::GYRO_3_B].setMode(MODE_OFF);
|
||||||
@ -154,6 +181,7 @@ ReturnValue_t AcsBoardAssembly::handleNormalModeCmd(Submode_t submode) {
|
|||||||
cmdSeq(helper.gyro3L3gIdSideB, ModeTableIdx::GYRO_3_B);
|
cmdSeq(helper.gyro3L3gIdSideB, ModeTableIdx::GYRO_3_B);
|
||||||
cmdSeq(helper.mgm2Lis3IdSideB, ModeTableIdx::MGM_2_B);
|
cmdSeq(helper.mgm2Lis3IdSideB, ModeTableIdx::MGM_2_B);
|
||||||
cmdSeq(helper.mgm3Rm3100IdSideB, ModeTableIdx::MGM_3_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].setMode(MODE_OFF);
|
||||||
modeTable[ModeTableIdx::GYRO_0_A].setSubmode(SUBMODE_NONE);
|
modeTable[ModeTableIdx::GYRO_0_A].setSubmode(SUBMODE_NONE);
|
||||||
modeTable[ModeTableIdx::GYRO_1_A].setMode(MODE_OFF);
|
modeTable[ModeTableIdx::GYRO_1_A].setMode(MODE_OFF);
|
||||||
@ -165,6 +193,7 @@ ReturnValue_t AcsBoardAssembly::handleNormalModeCmd(Submode_t submode) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case (DUAL_MODE): {
|
case (DUAL_MODE): {
|
||||||
|
cmdSeq(helper.gpsId, ModeTableIdx::GPS);
|
||||||
cmdSeq(helper.gyro0AdisIdSideA, ModeTableIdx::GYRO_0_A);
|
cmdSeq(helper.gyro0AdisIdSideA, ModeTableIdx::GYRO_0_A);
|
||||||
cmdSeq(helper.gyro1L3gIdSideA, ModeTableIdx::GYRO_1_A);
|
cmdSeq(helper.gyro1L3gIdSideA, ModeTableIdx::GYRO_1_A);
|
||||||
cmdSeq(helper.gyro2AdisIdSideB, ModeTableIdx::GYRO_2_B);
|
cmdSeq(helper.gyro2AdisIdSideB, ModeTableIdx::GYRO_2_B);
|
||||||
@ -179,7 +208,6 @@ ReturnValue_t AcsBoardAssembly::handleNormalModeCmd(Submode_t submode) {
|
|||||||
sif::error << "AcsBoardAssembly::handleNormalModeCmd: Unknown submode" << std::endl;
|
sif::error << "AcsBoardAssembly::handleNormalModeCmd: Unknown submode" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +272,6 @@ void AcsBoardAssembly::powerStateMachine(Submode_t submode) {
|
|||||||
state = States::SWITCHING_POWER;
|
state = States::SWITCHING_POWER;
|
||||||
}
|
}
|
||||||
if (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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class AcsBoardAssembly : public AssemblyBase {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool isUseable(object_id_t object, Mode_t mode);
|
bool isUseable(object_id_t object, Mode_t mode);
|
||||||
ReturnValue_t handleNormalModeCmd(Submode_t submode);
|
ReturnValue_t handleNormalOrOnModeCmd(Mode_t mode, Submode_t submode);
|
||||||
void powerStateMachine(Submode_t submode);
|
void powerStateMachine(Submode_t submode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user