Use the example's four movements, starting at (0,0).
Procedure
Use for to accumulate movements and save the position at each step.
Check final position and total travel distance separately.
Results to retain
Path plot and position at each step.
Items to record and points to check
Step
Movement x/y [m]
Cumulative position [m]
Points to check
Have you avoided reporting total travel distance as 0 just because the path returns to the origin?
Did you include the starting point in the first row of the position array?
2. Add proceed/stop conditions
Starting conditions
The battery readings before movement are [80,78,15,14]%; proceed only at 20% or higher.
Procedure
Check the battery before movement and break if it is below the threshold.
Record the stop step, reason, and final position.
Check how an input of 20%, equal to the threshold, is handled.
Results to retain
Stopped paths and boundary checks.
Items to record and points to check
Step
Battery [%]
Proceed?
Position/stop reason
Points to check
Did you check the battery before moving?
Did execution end without continually repeating the last command?
3. Apply the same rules to another plan
Starting conditions
Use the triangular path [.3,0;0,.4;−.3,−.4] as input.
Procedure
Write a function taking the plan array, battery readings before each movement, and battery threshold as arguments. Use the preceding activity's movement accumulation and battery checking code inside the function, and return stepwise positions and the stop reason.
Run the triangular plan as valid input. Then run a copy with just one movement changed to exceed the allowed length. First record the allowed length, the changed movement's index, and its old and new values; check to stop before that movement.
Record the completed movement count, final position, and stop reason for both runs side by side. Identify coordinate units and stop rules that should remain when changing aircraft.
Results to retain
A function or function contract, and results for valid and invalid plans.
Items to record and points to check
Plan
Check result
Final position
State to return
Points to check
Have you kept command transmission functions separate from plan validation?
Can you reproduce normal and stopped paths without an actual aircraft?