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