Back to catalog

Marine PID

H01 Marine PID Unit

Simple correctness tests for pMarinePIDV22 output behavior. These cases keep the mission to one MOOS community and verify rudder, thrust, elevator, override, stale-input, yaw-source, and debug publication paths.

Stem Mission

Baseline scenario context

The stem mission runs one shoreside MOOS community with scripted desired/nav mail and pMarinePIDV22 using suffixed outputs. It deliberately avoids a simulated vehicle so the cases can grade the PID app's direct actuator contract.

Examples

Representative runs

This unit harness uses variable-level PID evidence instead of pMarineViewer captures because it intentionally checks pMarinePIDV22 input/output behavior before adding vehicle dynamics. The visuals call out the evidence that makes each case pass.

Heading Wrap

Description: Requests heading 5 from NAV_HEADING=355, testing the positive 10-degree path across north instead of a 350-degree turn; passes when 9.5<=DESIRED_RUDDER_PID<=10.5 and 39<=DESIRED_THRUST_PID<=41.

Manual Override

Description: Establishes nonzero PID inputs, then posts MOOS_MANUAL_OVERRIDE=true, testing the normal override input; passes when rudder and thrust are each within [-0.1,0.1] and PID_HAS_CONTROL=false.

Case Matrix

All cases

rudder_starboard_pass

Requests heading 90 from NAV_HEADING=0 with desired speed 2, testing the positive-rudder course correction; passes when DESIRED_RUDDER_PID>1 and 39<=DESIRED_THRUST_PID<=41.

rudder_port_pass

Requests heading 270 from NAV_HEADING=0 with desired speed 2, testing the negative-rudder course correction; passes when DESIRED_RUDDER_PID<-1 and 39<=DESIRED_THRUST_PID<=41.

heading_wrap_pass

Requests heading 5 from NAV_HEADING=355, testing the positive 10-degree path across north instead of a 350-degree turn; passes when 9.5<=DESIRED_RUDDER_PID<=10.5 and 39<=DESIRED_THRUST_PID<=41.

speed_factor_update_pass

Posts SPEED_FACTOR=10 before requesting speed 3 with no heading error, testing runtime factor-based thrust scaling; passes when rudder remains within [-0.1,0.1] and thrust is in [29,31].

speed_pid_control_pass

Configures speed_factor=0 with desired speed 2 and NAV_SPEED=0, selecting the speed PID instead of direct factor scaling; passes when positive rudder is produced and thrust reaches the configured [99,100] cap band.

max_thrust_limit_pass

Configures speed_factor=50 and maxthrust=60 for a speed demand that would otherwise produce thrust 100, testing the configured thrust limit; passes when rudder is positive and thrust is in [59,60].

depth_elevator_pass

Enables depth control with desired depth 6, NAV_DEPTH=5, and NAV_PITCH=0, testing the depth-to-pitch and pitch-to-elevator cascade; passes when rudder is positive, thrust is in [39,41], and elevator is in [11.3,11.7].

manual_override_zero_pass

Establishes nonzero PID inputs, then posts MOOS_MANUAL_OVERRIDE=true, testing the normal override input; passes when rudder and thrust are each within [-0.1,0.1] and PID_HAS_CONTROL=false.

stale_nav_pass

Sets the nav tardy threshold to one second, keeps desired heading, desired speed, and nav heading fresh, and lets only NAV_SPEED expire; passes after first proving DESIRED_RUDDER_PID>1 and thrust in [39,41], then requiring both outputs within [-0.1,0.1] and a PID_STALE publication.

nav_yaw_used_pass

Omits NAV_HEADING and posts NAV_YAW=-1.5708 with desired heading 0, testing conversion from yaw radians to heading; passes when rudder is negative and thrust is in [39,41].

ignore_nav_yaw_pass

Posts conflicting NAV_YAW=-1.5708 and NAV_HEADING=0 with ignore_nav_yaw=true, testing that heading mail remains authoritative; passes when rudder is positive and thrust is in [39,41].

heading_debug_saturation_pass

Enables heading_debug, requests heading 180 from 0, and sets maxrudder=10; passes when PID_HDG_DEBUG publishes while rudder is saturated in [-10,-9] and thrust is in [39,41], with the diagnostic's desired, current, error, and rudder fields retained in the result.

speed_zero_allstop_pass

Requests DESIRED_SPEED=0 while retaining a 90-degree heading error, testing the zero-speed all-stop branch; passes when rudder and thrust are each within [-0.1,0.1] and PID_HAS_CONTROL=true.

speed_negative_allstop_pass

Requests DESIRED_SPEED=-1 while retaining a 90-degree heading error, testing clipping of a negative speed request to all-stop; passes when rudder and thrust are each within [-0.1,0.1] and PID_HAS_CONTROL=true.

output_suffix_alt_pass

Configures output_suffix=_ALT, requiring DESIRED_RUDDER_ALT>1 and 39<=DESIRED_THRUST_ALT<=41 while failing on any unsuffixed DESIRED_RUDDER or DESIRED_THRUST publication.

manual_overide_alias_zero_pass

Establishes nonzero PID inputs, then posts the legacy misspelled MOOS_MANUAL_OVERIDE=true, testing compatibility with that alias; passes when rudder and thrust are each within [-0.1,0.1] and PID_HAS_CONTROL=false.

override_release_needs_fresh_mail_pass

First proves starboard control with rudder above 1 and thrust in [39,41], then posts a port command while override is active and requires zero outputs with PID_HAS_CONTROL=false; after release without fresh mail, it passes only while outputs remain zero even though PID_HAS_CONTROL=true.

override_recover_fresh_mail_pass

First proves port control with rudder below -1 and thrust in [19,21], then requires zero outputs with PID_HAS_CONTROL=false during override; after release and a fresh starboard command, it passes on rudder above 1, thrust in [39,41], and PID_HAS_CONTROL=true.

stale_helm_pass

Sets the helm tardy threshold to one second, leaves desired heading and speed at their one-second values, and refreshes nav mail at five seconds, isolating stale helm input; passes when rudder and thrust are within [-0.1,0.1] and PID_STALE is present.

stale_recover_pass

First proves port control with rudder below -1 and thrust in [19,21], then requires a PID_STALE publication and zero outputs after every helm/nav input expires; after all four inputs are refreshed with a starboard command, it passes on rudder above 1, thrust in [39,41], and PID_HAS_CONTROL=true.

depth_negative_elevator_pass

Enables depth control with desired depth 5, NAV_DEPTH=10, and zero pitch, testing the opposite depth-error sign; passes when rudder is positive, thrust is in [39,41], and DESIRED_ELEVATOR_PID<-1.

depth_debug_pass

Enables depth_debug with desired depth 10, NAV_DEPTH=5, and zero pitch, testing depth diagnostic publication during elevator control; passes when DESIRED_ELEVATOR_PID>1 and PID_DEP_DEBUG is present.

max_elevator_limit_pass

Enables depth control with a five-meter depth error and maxelevator=5, testing elevator saturation; passes when DESIRED_ELEVATOR_PID is in [4.9,5.0].

speed_debug_pass

Enables speed_debug with desired speed 2 and NAV_SPEED=0, testing speed diagnostic publication during factor-based thrust control; passes when thrust is in [39,41] and PID_SPD_DEBUG is present.

nav_heading_after_yaw_pass

Posts NAV_YAW=-1.5708, then posts NAV_HEADING=0 half a second later for desired heading 90, testing that later heading mail replaces the yaw-derived value; passes when rudder is positive and thrust is in [39,41].

simulation_mode_fail

Configures simulation=true with otherwise valid steering and speed inputs, preserving a known bug in which the app claims control without actuator output; the harness passes only while rudder and thrust remain within [-0.1,0.1] and PID_HAS_CONTROL=true.

thrust_cap_runtime_fail

Posts PID_THRUST_CAP=50 before a factor-based demand of 100, preserving a known bug in which the runtime cap is ignored; the harness passes only while rudder is positive and thrust remains in [99,100].

heading_wrap_negative_pass

Requests heading 355 from NAV_HEADING=5, testing the negative 10-degree path across north; passes when rudder is between -20 and -1 and thrust is in [39,41].

nav_heading_normalize_pass

Posts NAV_HEADING=-90 with desired heading 0, testing normalization of an out-of-range heading before error calculation; passes when rudder is between 80 and 100 and thrust is in [39,41].

runtime_speed_factor_zero_pid_pass

Posts SPEED_FACTOR=0 before requesting speed 2 from NAV_SPEED=0, testing the runtime switch from factor mapping to speed PID control; passes when rudder is positive and thrust is in [99,100].

runtime_speed_factor_negative_pass

Posts SPEED_FACTOR=-10 before requesting speed 2, exercising the accepted negative-factor path and its zero-clipped output; passes when rudder and thrust are each within [-0.1,0.1] and PID_HAS_CONTROL=true.

missing_desired_speed_zero_pass

Supplies desired heading and both nav inputs but never posts DESIRED_SPEED, testing the initial desired-speed gate; passes when rudder and thrust remain within [-0.1,0.1] and PID_HAS_CONTROL=true.

missing_nav_speed_zero_pass

Supplies desired heading, desired speed, and nav heading but never posts NAV_SPEED, testing the initial nav-speed gate; passes when rudder and thrust remain within [-0.1,0.1] and PID_HAS_CONTROL=true.

depth_missing_pitch_zero_pass

Enables depth control and supplies every normal input except NAV_PITCH, testing the depth-mode pitch gate; passes when rudder, thrust, and elevator remain within [-0.1,0.1] and PID_HAS_CONTROL=true.

Source links

Harness README Mission README