Prevent STR Blinding #859

Merged
meggert merged 35 commits from prevent-str-blinding into main 2024-02-27 13:48:20 +01:00
Showing only changes of commit c064d1f625 - Show all commits

View File

@ -8,8 +8,8 @@ void Guidance::targetQuatPtgIdle(timeval timeAbsolute, const double timeDelta,
const double sunDirI[3], const double posSatF[4],
double targetQuat[4], double targetSatRotRate[3]) {
// positive z-Axis of EIVE in direction of sun
double zAxisXI[3] = {0, 0, 0};
VectorOperations<double>::normalize(sunDirI, zAxisXI, 3);
double zAxisIX[3] = {0, 0, 0};
VectorOperations<double>::normalize(sunDirI, zAxisIX, 3);
// determine helper vector to point x-Axis and therefore the STR away from Earth
double helperXI[3] = {0, 0, 0}, posSatI[3] = {0, 0, 0};
@ -17,20 +17,20 @@ void Guidance::targetQuatPtgIdle(timeval timeAbsolute, const double timeDelta,
VectorOperations<double>::normalize(posSatI, helperXI, 3);
// construct y-axis from helper vector and z-axis
double yAxisXI[3] = {0, 0, 0};
VectorOperations<double>::cross(zAxisXI, helperXI, yAxisXI);
VectorOperations<double>::normalize(yAxisXI, yAxisXI, 3);
double yAxisIX[3] = {0, 0, 0};
VectorOperations<double>::cross(zAxisIX, helperXI, yAxisIX);
VectorOperations<double>::normalize(yAxisIX, yAxisIX, 3);
// x-axis completes RHS
double xAxisXI[3] = {0, 0, 0};
VectorOperations<double>::cross(yAxisXI, zAxisXI, xAxisXI);
VectorOperations<double>::normalize(xAxisXI, xAxisXI, 3);
double xAxisIX[3] = {0, 0, 0};
VectorOperations<double>::cross(yAxisIX, zAxisIX, xAxisIX);
VectorOperations<double>::normalize(xAxisIX, xAxisIX, 3);
// join transformation matrix
double dcmXI[3][3] = {{xAxisXI[0], yAxisXI[0], zAxisXI[0]},
{xAxisXI[1], yAxisXI[1], zAxisXI[1]},
{xAxisXI[2], yAxisXI[2], zAxisXI[2]}};
QuaternionOperations::fromDcm(dcmXI, targetQuat);
double dcmIX[3][3] = {{xAxisIX[0], yAxisIX[0], zAxisIX[0]},
{xAxisIX[1], yAxisIX[1], zAxisIX[1]},
{xAxisIX[2], yAxisIX[2], zAxisIX[2]}};
QuaternionOperations::fromDcm(dcmIX, targetQuat);
// calculate of reference rotation rate
targetRotationRate(timeDelta, targetQuat, targetSatRotRate);
@ -59,8 +59,8 @@ void Guidance::targetQuatPtgTarget(timeval timeAbsolute, const double timeDelta,
// x-axis aligned with target direction
// this aligns with the camera, E- and S-band antennas
double xAxisXI[3] = {0, 0, 0};
VectorOperations<double>::normalize(targetDirI, xAxisXI, 3);
double xAxisIX[3] = {0, 0, 0};
VectorOperations<double>::normalize(targetDirI, xAxisIX, 3);
// transform velocity into inertial frame
double velSatI[3] = {0, 0, 0};
@ -73,18 +73,18 @@ void Guidance::targetQuatPtgTarget(timeval timeAbsolute, const double timeDelta,
// y-axis of satellite in orbit plane so that z-axis is parallel to long side of picture
// resolution
double yAxisXI[3] = {0, 0, 0};
VectorOperations<double>::cross(orbitalNormalI, xAxisXI, yAxisXI);
VectorOperations<double>::normalize(yAxisXI, yAxisXI, 3);
double yAxisIX[3] = {0, 0, 0};
VectorOperations<double>::cross(orbitalNormalI, xAxisIX, yAxisIX);
VectorOperations<double>::normalize(yAxisIX, yAxisIX, 3);
// z-axis completes RHS
double zAxisXI[3] = {0, 0, 0};
VectorOperations<double>::cross(xAxisXI, yAxisXI, zAxisXI);
double zAxisIX[3] = {0, 0, 0};
VectorOperations<double>::cross(xAxisIX, yAxisIX, zAxisIX);
// join transformation matrix
double dcmIX[3][3] = {{xAxisXI[0], yAxisXI[0], zAxisXI[0]},
{xAxisXI[1], yAxisXI[1], zAxisXI[1]},
{xAxisXI[2], yAxisXI[2], zAxisXI[2]}};
double dcmIX[3][3] = {{xAxisIX[0], yAxisIX[0], zAxisIX[0]},
{xAxisIX[1], yAxisIX[1], zAxisIX[1]},
{xAxisIX[2], yAxisIX[2], zAxisIX[2]}};
QuaternionOperations::fromDcm(dcmIX, targetQuat);
targetRotationRate(timeDelta, targetQuat, targetSatRotRate);
@ -111,32 +111,32 @@ void Guidance::targetQuatPtgGs(timeval timeAbsolute, const double timeDelta, dou
// negative x-axis aligned with target direction
// this aligns with the camera, E- and S-band antennas
double xAxisXI[3] = {0, 0, 0};
VectorOperations<double>::normalize(groundStationDirI, xAxisXI, 3);
VectorOperations<double>::mulScalar(xAxisXI, -1, xAxisXI, 3);
double xAxisIX[3] = {0, 0, 0};
VectorOperations<double>::normalize(groundStationDirI, xAxisIX, 3);
VectorOperations<double>::mulScalar(xAxisIX, -1, xAxisIX, 3);
// get sun vector model in ECI
VectorOperations<double>::normalize(sunDirI, sunDirI, 3);
// calculate z-axis as projection of sun vector into plane defined by x-axis as normal vector
// z = sPerpenticular = s - sParallel = s - (x*s)/norm(x)^2 * x
double xDotS = VectorOperations<double>::dot(xAxisXI, sunDirI);
xDotS /= pow(VectorOperations<double>::norm(xAxisXI, 3), 2);
double sunParallel[3], zAxisXI[3];
VectorOperations<double>::mulScalar(xAxisXI, xDotS, sunParallel, 3);
VectorOperations<double>::subtract(sunDirI, sunParallel, zAxisXI, 3);
VectorOperations<double>::normalize(zAxisXI, zAxisXI, 3);
double xDotS = VectorOperations<double>::dot(xAxisIX, sunDirI);
xDotS /= pow(VectorOperations<double>::norm(xAxisIX, 3), 2);
double sunParallel[3], zAxisIX[3];
VectorOperations<double>::mulScalar(xAxisIX, xDotS, sunParallel, 3);
VectorOperations<double>::subtract(sunDirI, sunParallel, zAxisIX, 3);
VectorOperations<double>::normalize(zAxisIX, zAxisIX, 3);
// y-axis completes RHS
double yAxisXI[3];
VectorOperations<double>::cross(zAxisXI, xAxisXI, yAxisXI);
VectorOperations<double>::normalize(yAxisXI, yAxisXI, 3);
double yAxisIX[3];
VectorOperations<double>::cross(zAxisIX, xAxisIX, yAxisIX);
VectorOperations<double>::normalize(yAxisIX, yAxisIX, 3);
// join transformation matrix
double dcmXI[3][3] = {{xAxisXI[0], yAxisXI[0], zAxisXI[0]},
{xAxisXI[1], yAxisXI[1], zAxisXI[1]},
{xAxisXI[2], yAxisXI[2], zAxisXI[2]}};
QuaternionOperations::fromDcm(dcmXI, targetQuat);
double dcmIX[3][3] = {{xAxisIX[0], yAxisIX[0], zAxisIX[0]},
{xAxisIX[1], yAxisIX[1], zAxisIX[1]},
{xAxisIX[2], yAxisIX[2], zAxisIX[2]}};
QuaternionOperations::fromDcm(dcmIX, targetQuat);
targetRotationRate(timeDelta, targetQuat, targetSatRotRate);
}
@ -153,26 +153,26 @@ void Guidance::targetQuatPtgNadir(timeval timeAbsolute, const double timeDelta,
// negative x-axis aligned with position vector
// this aligns with the camera, E- and S-band antennas
double xAxisXI[3] = {0, 0, 0};
VectorOperations<double>::normalize(posSatI, xAxisXI, 3);
VectorOperations<double>::mulScalar(xAxisXI, -1, xAxisXI, 3);
double xAxisIX[3] = {0, 0, 0};
VectorOperations<double>::normalize(posSatI, xAxisIX, 3);
VectorOperations<double>::mulScalar(xAxisIX, -1, xAxisIX, 3);
// make z-Axis parallel to major part of camera resolution
double zAxisXI[3] = {0, 0, 0};
double zAxisIX[3] = {0, 0, 0};
double velSatI[3] = {0, 0, 0};
CoordinateTransformations::velocityEcfToEci(velSatE, posSatE, velSatI, &timeAbsolute);
VectorOperations<double>::cross(xAxisXI, velSatI, zAxisXI);
VectorOperations<double>::normalize(zAxisXI, zAxisXI, 3);
VectorOperations<double>::cross(xAxisIX, velSatI, zAxisIX);
VectorOperations<double>::normalize(zAxisIX, zAxisIX, 3);
// y-Axis completes RHS
double yAxisXI[3] = {0, 0, 0};
VectorOperations<double>::cross(zAxisXI, xAxisXI, yAxisXI);
double yAxisIX[3] = {0, 0, 0};
VectorOperations<double>::cross(zAxisIX, xAxisIX, yAxisIX);
// join transformation matrix
double dcmXI[3][3] = {{xAxisXI[0], yAxisXI[0], zAxisXI[0]},
{xAxisXI[1], yAxisXI[1], zAxisXI[1]},
{xAxisXI[2], yAxisXI[2], zAxisXI[2]}};
QuaternionOperations::fromDcm(dcmXI, targetQuat);
double dcmIX[3][3] = {{xAxisIX[0], yAxisIX[0], zAxisIX[0]},
{xAxisIX[1], yAxisIX[1], zAxisIX[1]},
{xAxisIX[2], yAxisIX[2], zAxisIX[2]}};
QuaternionOperations::fromDcm(dcmIX, targetQuat);
targetRotationRate(timeDelta, targetQuat, refSatRate);
}