The center of a 160×120 image is (80,60), and the observed center is (110,50). x points right and y points down.
Procedure
Calculate and using the same sign convention as command(center) in the example. Plot the image center and observed point, and label both errors on an arrow from the center to the observed point.
For each axis, set the command to 0 if pixels; otherwise calculate it using , then limit it to . Calculate both axis commands for and record them beside the function outputs.
Results to retain
A center/error arrow diagram and example commands.
Items to record and points to check
Observed center
x/y errors
Validity
Command
Points to check
Have you distinguished the image y-axis direction from upward in world coordinates?
Did you distinguish pixel error and normalized commands from the aircraft's actual velocity [m/s]?
2. Handle fluctuations and missed detections
Starting conditions
x observations are [80,82,79,110,None,108], with . None denotes a frame where the object was not found.
Procedure
For each valid observation, calculate the command by applying command((x,60)) directly, and separately by applying it to the mean x of up to the 3 most recent valid observations. At startup, if fewer than 3 samples are available, average only the collected samples.
At None, set the command to 0 and clear the averaging history. Treat the later 108 as the first sample in a new history.
Record frame order, raw observations, mean x, and both commands in a table and plot them against the same frame axis. Explain the differences by identifying both commands at the frame where x changes to 110 and the command immediately after a missed detection.
Results to retain
Observation/command time series and missed detection rules.
Items to record and points to check
Frame
Observed x
Filtered x
Command
Handling missed detections
Points to check
Did you also check that a moving average causes response delay?
Have you avoided including None as numeric 0 in the average?
3. Connect detection to commands
Starting conditions
Connect the previous unit's mask center calculation to command. The basic activities use only saved or generated images.
Procedure
Separate the function returning center, area, and detection time from the command function.
Test an empty mask, a valid region, and a frame more than 0.2 seconds past detection, in that order. Identify stale frames by the difference between the current time and frame detection time, and set commands to 0 in that case.
Describe additional coordinate transformations, velocity limits, and stop conditions needed for a real device.
Results to retain
An input→detection→validation→command flowchart and an error case table.
Items to record and points to check
Input frame
Detection validity
Command
Stop reason
Points to check
Does a failed detection clear the previous velocity command?