test_ConstrainedAttitudeManeuver

test_ConstrainedAttitudeManeuver.test_antipodal_boundary_node_collision(cost_type, goal_z)[source]

Reject distinct endpoints mapped to the same sampled half-turn for either goal sign.

test_ConstrainedAttitudeManeuver.test_backtrack_is_private()[source]

Only the planner’s searches can follow predecessor pointers.

test_ConstrainedAttitudeManeuver.test_blocked_goal(cost_type)[source]

Reject a forbidden goal even when nearby free nodes support a maneuver.

test_ConstrainedAttitudeManeuver.test_boresight_capacity(kind)[source]

Accept the final boresight slot and reject invalid counts before array access.

test_ConstrainedAttitudeManeuver.test_chart_selection_near_mrp_pole(tilt)[source]

Score the closest approach between waypoints even when the final axis is tilted.

test_ConstrainedAttitudeManeuver.test_coincident_endpoint_keys(goal_z)[source]

Reject a maneuver whose start and goal occupy the same grid node.

test_ConstrainedAttitudeManeuver.test_cone_boundary(kind, public_arrays, offset)[source]

Include the rim in either cone and distinguish goals just to either side.

test_ConstrainedAttitudeManeuver.test_constrainedAttitudeManeuver(show_plots, N, keepOutFov, keepInFov, costFcnType, accuracy)[source]

Validation Test Description

This unit test script tests the correctness of the path computed by the ConstrainedAttitudeManeuver module. The module is tested against Python scripts that mirror the same functions contained in the module. Tests are run for different grid coarseness levels, different keep-out fields of view, and one keep-in field of view.

Test Parameters

Parameters:
  • N (int) – grid coarseness;

  • keepOutFov (float) – Field of View (in radiants) of the keep-out boresight;

  • keepInFov (float) – Field of View (in radiants) of the keep-in boresight;

  • costFcnType (int) – 0 for the MRP distance-based graph search, 1 for the effort-based graph search.

  • accuracy (float) – absolute accuracy value used in the validation tests

Description of Variables Being Tested

The tests to show the correctness of the module are the following:

  • First of all, an equivalent grid is built in python. The first test consists in comparing the nodes generated in Python versus the nodes generated in C++. The check consists in verifying whether the same key indices \((i,j,k)\) generate the same node coordinates \(\sigma_{BN}\). Secondly, it is checked whether the same node is constraint-compliant or -incompliant both in Python and in C++.

  • After running the graph-search algorithm, a check is conduced to ensure the equivalence of the computed paths. Note that this unit test does not run the effort-based version of A*, due to the slow nature of the Python implementation. If the user wishes, it is possible to uncomment line 429 to also test the effort-based graph-search algorithm.

  • The interpolated trajectory obtained in Python is checked versus the interpolated trajectory obtained in C++. The Python code uses the BSK-native BSpline library, which has its own unit test.

  • Lastly, a check is run on the norm of the required control torque for each time step of the interpolated trajectory. The correctness of this check should imply the correctness of the functions used in the effort-based graph-search algorithm as well.

test_ConstrainedAttitudeManeuver.test_default_constructor_requires_grid_refinement()[source]

Require an explicit refinement level when using the no-argument constructor.

test_ConstrainedAttitudeManeuver.test_direct_planning_requires_successful_input_read(failed_source)[source]

Only a complete input read makes cached rates and inertia available to direct calls.

test_ConstrainedAttitudeManeuver.test_direct_replanning_invalidates_reference(method)[source]

Each public replanning step blocks publication of the previously accepted reference.

test_ConstrainedAttitudeManeuver.test_disconnected_grid(refinement, reason, cost_type, shortest_path, entry_point)[source]

Reject a disconnected grid and resume publishing only after a successful reset.

test_ConstrainedAttitudeManeuver.test_effort_requires_fitted_samples()[source]

Reject effort evaluation before a fit and accept samples from a completed fit.

test_ConstrainedAttitudeManeuver.test_equivalent_shadow_endpoints(cost_type, start)[source]

Reject opposite boundary nodes that describe the same physical attitude.

test_ConstrainedAttitudeManeuver.test_extra_revolutions_reject_fit(tilt, spline_type)[source]

A finite spline that adds a full turn inside a leg must be discarded.

test_ConstrainedAttitudeManeuver.test_failed_refit_discards_previous_output()[source]

A failed refit clears the old spline while preserving the waypoints for a retry.

test_ConstrainedAttitudeManeuver.test_feasible_half_turn_direction(reverse)[source]

Take the finite short arc at a half-turn when the other choice runs into a pole.

test_ConstrainedAttitudeManeuver.test_full_sphere_keep_in_roundoff()[source]

Include antipodal nodes whose computed unit-vector dot products fall below -1.

test_ConstrainedAttitudeManeuver.test_goal_defaults(args)[source]

Require a finite goal, accept an explicit identity, and default to rest at the goal.

test_ConstrainedAttitudeManeuver.test_grid_backed_path_copy()[source]

Reject borrowed and mixed paths before replacing the destination, while allowing self-assignment.

test_ConstrainedAttitudeManeuver.test_grid_refinement_boundaries(refinement)[source]

Build grids at both supported limits and select valid endpoint keys.

test_ConstrainedAttitudeManeuver.test_grid_reset_and_recovery(cost_type, refinement)[source]

Rebuild without stale nodes, reject changed constraints, and recover after failure.

test_ConstrainedAttitudeManeuver.test_grid_without_free_nodes(cost_type, refinement)[source]

Reject fully blocked grids, including nodes affected by rotation-matrix roundoff.

test_ConstrainedAttitudeManeuver.test_half_turn_endpoint_with_free_interior_sample(cost_type, at_start, sign)[source]

Reach either representation of a half-turn whose closest free sample is an interior node.

test_ConstrainedAttitudeManeuver.test_half_turn_goal_with_both_interior_cells_free()[source]

Keep the same interior sample for either goal sign even when its mirror is free.

test_ConstrainedAttitudeManeuver.test_invalid_boresight_cone(kind, axis, angle, error)[source]

Reject an invalid append and detect the same cone when set through the public arrays.

test_ConstrainedAttitudeManeuver.test_invalid_grid_refinement(refinement, change_after_construction, entry_point)[source]

Reject invalid refinement through both entry points, including public N changes.

test_ConstrainedAttitudeManeuver.test_invalid_maneuver_rate(avg_omega, entry_point)[source]

Reject invalid timing without exposing a trial path or publishing a reference.

test_ConstrainedAttitudeManeuver.test_model_path_node_lifetime()[source]

A path view keeps its model alive and native grid cleanup releases the appended node.

test_ConstrainedAttitudeManeuver.test_narrow_keep_out_cone(separation, half_angle, blocked)[source]

An accepted public boresight length must not change the angular separation.

test_ConstrainedAttitudeManeuver.test_near_identity_reference_from_equivalent_starts(refinement, start_z, shadow_z, goal, cost_type)[source]

Fit the smaller-norm waypoint sequence and publish the same maneuver from either MRP set.

test_ConstrainedAttitudeManeuver.test_neighbor_capacity()[source]

Allow the last available slot and reject overflow without changing the count.

test_ConstrainedAttitudeManeuver.test_node_back_pointer_is_read_only()[source]

A failed predecessor assignment preserves ownership and leaves both nodes usable.

test_ConstrainedAttitudeManeuver.test_node_list_growth()[source]

Grow beyond the former capacity and preserve ownership through a path copy.

test_ConstrainedAttitudeManeuver.test_node_list_index_bounds()[source]

Reject invalid removals and swaps without changing the count or node order.

test_ConstrainedAttitudeManeuver.test_node_list_rejects_borrowed_node(monkeypatch)[source]

Reject a non-owning proxy before changing the path or its fitted cost.

test_ConstrainedAttitudeManeuver.test_node_list_retains_python_nodes()[source]

Retain duplicate entries across a path copy and release each node after its final removal.

test_ConstrainedAttitudeManeuver.test_node_list_sorts_large_priorities()[source]

Sort nodes on both sides of the former 100,000 priority cutoff.

test_ConstrainedAttitudeManeuver.test_nonfinite_fit_rejects_publication()[source]

Keep a fit with a nonfinite endpoint rate from becoming publishable.

test_ConstrainedAttitudeManeuver.test_nonunit_boresight_on_grid_rebuild(kind)[source]

A direct rebuild must recheck stored unit vectors after inputs were read.

test_ConstrainedAttitudeManeuver.test_off_axis_peak_tie()[source]

Keep the principal start for a symmetric off-axis path in either goal representation.

test_ConstrainedAttitudeManeuver.test_optional_constraint_source(kind, other)[source]

Recompute active cones after disconnecting, replacing, and restoring a source.

test_ConstrainedAttitudeManeuver.test_optional_spline_values_survive_input_copy(args)[source]

Both constructors zero optional values and copying a partial input preserves its settings.

test_ConstrainedAttitudeManeuver.test_path_coordinate_index_bounds()[source]

Return the existing missing-coordinate sentinel for either invalid index.

test_ConstrainedAttitudeManeuver.test_path_crossing_both_mrp_poles()[source]

Reject a path that crosses both poles between successive waypoints.

test_ConstrainedAttitudeManeuver.test_path_edit_invalidates_reference(edit)[source]

Editing an accepted path discards its waypoints, fit, and publishable reference.

test_ConstrainedAttitudeManeuver.test_python_goal_requires_three_components()[source]

Reject incomplete or oversized Python goals and preserve the previous attitude.

test_ConstrainedAttitudeManeuver.test_rebuild_after_source_replacement(kind)[source]

Use the cached direction until ReadInputs samples the replacement source.

test_ConstrainedAttitudeManeuver.test_rebuild_reclassifies_endpoints(capfd)[source]

Reuse a formerly free start and a formerly blocked goal after changing the boresight.

test_ConstrainedAttitudeManeuver.test_recovery_uses_replacement_inertia()[source]

Doubling the inertia after a failed read doubles effort on the same distance-based path.

test_ConstrainedAttitudeManeuver.test_reference_path_waypoints(raw_z, expected_z)[source]

Check both choices of the continuous MRP sequence against known waypoints.

test_ConstrainedAttitudeManeuver.test_repeated_path_waypoint()[source]

A repeated node cannot supply a time interval. Removing it restores the fit.

test_ConstrainedAttitudeManeuver.test_required_input_must_be_written(input_name, message_type, index, previous_plan)[source]

Reject a missing state or inertia before using any previously buffered value.

test_ConstrainedAttitudeManeuver.test_reset_rejects_extra_turn_and_recovers(cost_type, reason)[source]

Both searches discard excessive fits and a subsequent feasible reset publishes again.

test_ConstrainedAttitudeManeuver.test_reset_restarts_reference_clock()[source]

Sample the same trajectory relative to two reset epochs on both outputs.

test_ConstrainedAttitudeManeuver.test_search_requires_generated_grid(method, failed_rebuild)[source]

A direct search requires a successful grid build and can recover after a failed build.

test_ConstrainedAttitudeManeuver.test_shadow_start_with_identity_waypoint(refinement, cost_type, goal_z)[source]

Equivalent starts must yield the same finite reference at and around identity.

Keep effort-based planning independent of the distance-search option.

test_ConstrainedAttitudeManeuver.test_shortest_path_reset(spline_type)[source]

Fit and publish the optional path, with a read-only expansion diagnostic.

test_ConstrainedAttitudeManeuver.test_signed_roll_through_mrp_pole(reverse, tilt)[source]

Verify signed and cumulative rotation on every fitted leg of the split maneuver.

test_ConstrainedAttitudeManeuver.test_sort_only_invalidates_reordered_planner_path()[source]

Sorting a copy preserves the fit, while reordering the planner’s own path clears it.

test_ConstrainedAttitudeManeuver.test_spline_error_clears_trial_path(method, args)[source]

Discard the effort-search candidate on a spline error and allow a retry.

test_ConstrainedAttitudeManeuver.test_spline_optional_waypoint_arrays()[source]

Use generated times when requested and require one weight per waypoint for approximation.

test_ConstrainedAttitudeManeuver.test_spline_requires_current_waypoints(search)[source]

Fit the new goal only after the waypoints for the rebuilt path have been prepared.

test_ConstrainedAttitudeManeuver.test_spline_waypoint_array_lengths(spline_type, component)[source]

Reject short and long waypoint arrays and recover after the original values are restored.

test_ConstrainedAttitudeManeuver.test_stale_cone_activation_on_grid_rebuild(kind)[source]

Require fresh inputs after enabling a cone by count or disabling it by subscription.

test_ConstrainedAttitudeManeuver.test_three_waypoint_approximation()[source]

Use a valid quartic approximation when there is one interior waypoint.

test_ConstrainedAttitudeManeuver.test_three_waypoint_approximation_control_point_limit()[source]

Reject six endpoint conditions on five control points and accept exactly five.

test_ConstrainedAttitudeManeuver.test_tied_peak_waypoint_norms(sign)[source]

Keep the same fitted waypoints when equivalent starts round tied peak norms differently.

test_ConstrainedAttitudeManeuver.test_torque_and_effort_reject_mismatched_sample_lengths(component)[source]

Require every fitted component to have exactly one value per time sample.

test_ConstrainedAttitudeManeuver.test_torque_norm_uses_supplied_inertia()[source]

Check torque scaling at the midpoint, where the gyroscopic term is nonzero.

test_ConstrainedAttitudeManeuver.test_torque_sample_index_bounds()[source]

Accept the last fitted torque sample and reject indices outside the time array.

test_ConstrainedAttitudeManeuver.test_two_waypoint_approximation_weight_lengths()[source]

Require two supplied weights even though both endpoints are fixed.

test_ConstrainedAttitudeManeuver.test_two_waypoint_endpoint_accelerations(spline_type, at_start, at_goal)[source]

Refit a two-waypoint path with the prescribed MRP derivatives at either or both endpoints.

test_ConstrainedAttitudeManeuver.test_two_waypoint_reference(spline_type, start_z, goal_z, fitted_start_z, fitted_goal_z)[source]

Fit both endpoint attitudes and rates and publish finite references.

test_ConstrainedAttitudeManeuver.test_unchanged_path_preserves_reference()[source]

Self-assignment, an unchanged ordering, and rejected edits preserve an accepted fit.

test_ConstrainedAttitudeManeuver.test_undefined_constraint_direction(kind, offset)[source]

Require a finite line of sight for each active celestial-body constraint.

test_ConstrainedAttitudeManeuver.test_undefined_inertial_axis_on_rebuild(kind, axis)[source]

Reject an undefined active inertial axis supplied directly to grid generation.

test_ConstrainedAttitudeManeuver.test_unset_cost_function()[source]

Require an explicit cost function before searching a valid grid.

test_ConstrainedAttitudeManeuver.test_unset_maneuver_rate()[source]

Both constructors leave the maneuver rate at the invalid zero default.

test_ConstrainedAttitudeManeuver.test_unset_spline_type(cost_type)[source]

Require an explicit spline selection for either search method.