cleaner calculation of sus rate
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
This commit is contained in:
parent
5a7f0d08a4
commit
110c822f41
@ -142,8 +142,6 @@ void SensorProcessing::processMgm(const float *mgm0Value, bool mgm0valid, const
|
|||||||
double mgmVecTotDerivative[3] = {0.0, 0.0, 0.0};
|
double mgmVecTotDerivative[3] = {0.0, 0.0, 0.0};
|
||||||
bool mgmVecTotDerivativeValid = false;
|
bool mgmVecTotDerivativeValid = false;
|
||||||
double timeDiff = timevalOperations::toDouble(timeOfMgmMeasurement - timeOfSavedMagFieldEst);
|
double timeDiff = timevalOperations::toDouble(timeOfMgmMeasurement - timeOfSavedMagFieldEst);
|
||||||
sif::debug << "timeDiff = " << timeDiff << std::endl;
|
|
||||||
sif::debug << "tv_sec = " << (double)timeOfSavedMagFieldEst.tv_sec << std::endl;
|
|
||||||
if (timeOfSavedMagFieldEst.tv_sec != 0 and timeDiff > 0 and
|
if (timeOfSavedMagFieldEst.tv_sec != 0 and timeDiff > 0 and
|
||||||
VectorOperations<double>::norm(savedMgmVecTot, 3) != 0) {
|
VectorOperations<double>::norm(savedMgmVecTot, 3) != 0) {
|
||||||
VectorOperations<double>::subtract(mgmVecTot, savedMgmVecTot, mgmVecTotDerivative, 3);
|
VectorOperations<double>::subtract(mgmVecTot, savedMgmVecTot, mgmVecTotDerivative, 3);
|
||||||
@ -280,6 +278,7 @@ void SensorProcessing::processSus(
|
|||||||
susDataProcessed->sunIjkModel.setValid(true);
|
susDataProcessed->sunIjkModel.setValid(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::memcpy(savedSusVecTot, ZERO_VEC_D, sizeof(savedSusVecTot));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,13 +367,13 @@ void SensorProcessing::processSus(
|
|||||||
double susVecTotDerivative[3] = {0.0, 0.0, 0.0};
|
double susVecTotDerivative[3] = {0.0, 0.0, 0.0};
|
||||||
bool susVecTotDerivativeValid = false;
|
bool susVecTotDerivativeValid = false;
|
||||||
double timeDiff = timevalOperations::toDouble(timeOfSusMeasurement - timeOfSavedSusDirEst);
|
double timeDiff = timevalOperations::toDouble(timeOfSusMeasurement - timeOfSavedSusDirEst);
|
||||||
if (timeOfSavedSusDirEst.tv_sec != 0 and timeDiff > 0) {
|
if (timeOfSavedSusDirEst.tv_sec != 0 and timeDiff > 0 and
|
||||||
for (uint8_t i = 0; i < 3; i++) {
|
VectorOperations<double>::norm(savedSusVecTot, 3) != 0) {
|
||||||
susVecTotDerivative[i] = (susVecTot[i] - savedSusVecTot[i]) / timeDiff;
|
VectorOperations<double>::subtract(susVecTot, savedSusVecTot, susVecTotDerivative, 3);
|
||||||
savedSusVecTot[i] = susVecTot[i];
|
VectorOperations<double>::mulScalar(susVecTotDerivative, 1. / timeDiff, susVecTotDerivative, 3);
|
||||||
susVecTotDerivativeValid = true;
|
susVecTotDerivativeValid = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
std::memcpy(savedSusVecTot, susVecTot, sizeof(savedSusVecTot));
|
||||||
if (VectorOperations<double>::norm(susVecTotDerivative, 3) != 0 and
|
if (VectorOperations<double>::norm(susVecTotDerivative, 3) != 0 and
|
||||||
susDataProcessed->susVecTotDerivative.isValid()) {
|
susDataProcessed->susVecTotDerivative.isValid()) {
|
||||||
lowPassFilter(susVecTotDerivative, susDataProcessed->susVecTotDerivative.value,
|
lowPassFilter(susVecTotDerivative, susDataProcessed->susVecTotDerivative.value,
|
||||||
|
Loading…
Reference in New Issue
Block a user