test_thrForceMapping

test_thrForceMapping.controlAxesSet(numControlAxis, axesOrder)[source]

Return orthonormal control axes that span the same subspace as the leading numControlAxis body axes.

Parameters:
  • numControlAxis – number of control axes

  • axesOrder – "leading" for the leading body axes, "reversed" for the same axes in reverse order, or "rotated" for an orthonormal rotation of these axes

Returns:

control axes as rows of a numControlAxis x 3 array

test_thrForceMapping.runCubeRcsMapping(controlAxes, Lr_B, maxThrust, angErrThresh)[source]

Run the module once with 8 RCS thrusters at the corners of a 2 m cube that fire tangentially.

Parameters:
  • controlAxes – control axes as rows of an array with up to 3 rows

  • Lr_B – requested control torque in body frame components [Nm]

  • maxThrust – thruster force saturation limit [N]

  • angErrThresh – torque angle error beyond which saturated forces are scaled [rad]

Returns:

thruster forces [N], outTorqAngErr [rad], thruster locations [m] and thruster directions

test_thrForceMapping.test_controlAxesOrdering(controlAxes, saturated)[source]

Validate the torque angle error for several controlled subspaces and the saturation scaling decision for alternative orthonormal bases of the full three-dimensional space.

The test uses 8 RCS thrusters and checks that

  • the produced torque matches the requested torque on the control axes, \([C][D]\bm F = [C]\bm L_r\),

  • outTorqAngErr is the angle between \([C]^T [C] \bm L_r\) and the saturation-clipped torque \([D]\bm F_{\mathrm{clip}}\) in body frame components,

  • for the three-axis cases, with saturated thrusters and angErrThresh between the true angle error and the angle error obtained by comparing control axis components with body frame components, the forces are not scaled and match the forces found with the identity control axes.

test_thrForceMapping.test_controlAxesOrthogonalityWarning(capfd, controlAxes, expectWarning)[source]

Validate that Reset() logs a warning if the control axes are not mutually orthogonal, and stays silent for orthonormal control axes.

test_thrForceMapping.test_module(show_plots, useDVThruster, useCOMOffset, dropThruster, asymmetricDrop, numControlAxis, saturateThrusters, misconfigThruster, use2ndLoop)[source]

Validate the thruster forces and the torque angle error against the Python reference model using the leading numControlAxis body axes as control axes.

test_thrForceMapping.test_moduleAxesOrder(show_plots, useDVThruster, dropThruster, numControlAxis, saturateThrusters, use2ndLoop, axesOrder)[source]

Validate the thruster forces and the torque angle error against the Python reference model when the control axes are not the leading body axes.

The axesOrder parameter spans the same controlled subspace as the leading body axes, either with the same axes in reversed order or with an orthonormal rotation of these axes. The thruster forces and outTorqAngErr must not depend on this choice. To limit the test runtime, only a representative subset of the test_module() parameters is used.

test_thrForceMapping.torqueAngErr(LrBar_B, r_B, gt_B, F, FMag)[source]

Compute the angle between the reduced requested torque and the saturation limited thruster torque.

Parameters:
  • LrBar_B – reduced requested torque \([C]^T [C] {}^B\bm L_r\) in body frame components [Nm]

  • r_B – thruster locations relative to the center of mass, one row per thruster [m]

  • gt_B – thruster force unit direction vectors, one row per thruster

  • F – thruster force solution [N]

  • FMag – thruster force saturation limits [N]

Returns:

angle between the two torque vectors [rad]