Unit 04 · lesson

Bridge Checkpoint: Read the Decision Contract

This route assumes you already know Java comparisons, booleans, if/else, and methods from java-programming.

The bridge task is to inspect one robot-side rule without confusing local Java behavior with ROS 2 configuration or physical robot behavior.

Use a rule such as:

boolean shouldWarn(double rangeMeters, double cautionMeters) {
    return rangeMeters < cautionMeters;
}

Record the contract:

  • inputs and units;
  • exact comparison boundary;
  • return meaning;
  • one valid case;
  • one boundary case;
  • one invalid-data case the method does not handle by itself.

Now compare that local rule with a supplied ROS 2 parameter snapshot such as:

caution_distance_m = 0.5

The same number appearing in both places does not prove the Java method reads the ROS parameter. It proves only that two observed values agree.

Evidence check

Write three claims and label each as proved, supported but incomplete, or not proved:

  1. the Java method returns true for 0.42, 0.50;
  2. the ROS node reports caution_distance_m=0.5;
  3. the Java method receives its threshold from that ROS parameter.

The third claim requires evidence of an integration path.

If the Java syntax is the difficult part, return to java-programming. This bridge is about the boundary, not reteaching control flow.