x-axis now points away of equator plane for sunPtgMode
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Marius Eggert 2023-01-12 11:48:57 +01:00
parent 66e2d782b2
commit 27d6e95062

View File

@ -23,7 +23,11 @@ Guidance::~Guidance() {}
void Guidance::getTargetParamsSafe(double sunTargetSafe[3], double satRateSafe[3]) {
for (int i = 0; i < 3; i++) {
sunTargetSafe[i] = acsParameters.safeModeControllerParameters.sunTargetDir[i];
if (false) { // ToDo: if file does not exist anymore
sunTargetSafe[i] = acsParameters.safeModeControllerParameters.sunTargetDir[i];
} else {
sunTargetSafe[i] = acsParameters.safeModeControllerParameters.sunTargetDirLeop[i];
}
satRateSafe[i] = acsParameters.safeModeControllerParameters.satRateRef[i];
}
@ -230,10 +234,7 @@ void Guidance::targetQuatPtgThreeAxes(ACS::SensorValues *sensorValues,
acsParameters.ptgTargetParameters.altitudeTgt, targetCart);
// Position of the satellite in the earth/fixed frame via GPS
double posSatE[3] = {0, 0, 0};
double geodeticLatRad = (sensorValues->gpsSet.latitude.value) * PI / 180;
double longitudeRad = (sensorValues->gpsSet.longitude.value) * PI / 180;
MathOperations<double>::cartesianFromLatLongAlt(geodeticLatRad, longitudeRad,
sensorValues->gpsSet.altitude.value, posSatE);
std::memcpy(posSatE, gpsDataProcessed->gpsPosition.value, 3 * sizeof(double));
double targetDirE[3] = {0, 0, 0};
VectorOperations<double>::subtract(targetCart, posSatE, targetDirE, 3);
@ -406,34 +407,28 @@ void Guidance::sunQuatPtg(ACS::SensorValues *sensorValues, acsctrl::MekfData *me
double zAxis[3] = {0, 0, 0};
VectorOperations<double>::normalize(sunDirB, zAxis, 3);
// Position of the satellite in the earth/fixed frame via GPS and body
// velocity
// Position of satellite in ECEF
double posSatE[3] = {0, 0, 0};
double geodeticLatRad = (sensorValues->gpsSet.latitude.value) * PI / 180;
double longitudeRad = (sensorValues->gpsSet.longitude.value) * PI / 180;
MathOperations<double>::cartesianFromLatLongAlt(geodeticLatRad, longitudeRad,
sensorValues->gpsSet.altitude.value, posSatE);
double velocityE[3];
std::memcpy(velocityE, gpsDataProcessed->gpsVelocity.value, 3 * sizeof(double));
double velocityJ[3] = {0, 0, 0}, velPart1[3] = {0, 0, 0}, velPart2[3] = {0, 0, 0};
MatrixOperations<double>::multiply(*dcmJE, velocityE, velPart1, 3, 3, 1);
MatrixOperations<double>::multiply(*dcmJEDot, posSatE, velPart2, 3, 3, 1);
VectorOperations<double>::add(velPart1, velPart2, velocityJ, 3);
double velocityB[3] = {0, 0, 0};
MatrixOperations<double>::multiply(*dcmBJ, velocityJ, velocityB, 3, 3, 1);
std::memcpy(gpsDataProcessed->gpsPosition.value, posSatE, 3 * sizeof(double));
// Normal to velocity and sunDir
double crossVelSun[3] = {0, 0, 0};
VectorOperations<double>::cross(velocityB, sunDirB, crossVelSun);
// Check whether Sat is above or below equator
// Assign helper vector (north pole inertial) accordingly
double helperVec[3] = {0, 0, 0};
if (posSatE[2] > 0) {
double helperVec[2] = 1;
} else {
double helperVec[2] = -1;
}
// y- Axis as cross of normal velSun and zAxis
//
double yAxis[3] = {0, 0, 0};
VectorOperations<double>::cross(crossVelSun, sunDirB, yAxis);
VectorOperations<double>::cross(zAxis, helperVec, yAxis);
VectorOperations<double>::normalize(yAxis, yAxis, 3);
// complete RHS for x-Axis
//
double xAxis[3] = {0, 0, 0};
VectorOperations<double>::cross(yAxis, zAxis, xAxis);
VectorOperations<double>::normalize(xAxis, xAxis, 3);
// Transformation matrix to Sun, no further transforamtions, reference is already
// the EIVE body frame