From 9ad42167e0943715fc0b27cec8e06a74aa73ba44 Mon Sep 17 00:00:00 2001 From: Jacob Dahl <37091262+dakejahl@users.noreply.github.com> Date: Sun, 18 Oct 2026 17:55:50 -0600 Subject: [PATCH] fix(simulation): publish every gz optical flow frame (#29306) The plugin gave the flow library the camera rate as its output rate. The library's rate limiter publishes only after more than one period has passed, so it withheld every other frame and returned quality -1 for it. The plugin published those frames anyway and the bridge stored -1 as quality 255, so over a featureless floor EKF2 fused zero flow at full quality and the vehicle drifted. The averaged frames counted the time of a quality-0 frame but not its motion, under-reading flow on patchy texture. Output rate 0 disables the limiter, so every frame goes out with its own quality and a 20 ms integration time. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jacob Dahl --- .../simulation/gz_plugins/optical_flow/OpticalFlowSensor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/simulation/gz_plugins/optical_flow/OpticalFlowSensor.cpp b/src/modules/simulation/gz_plugins/optical_flow/OpticalFlowSensor.cpp index 6ec20d6c356..fb8d3eb6183 100644 --- a/src/modules/simulation/gz_plugins/optical_flow/OpticalFlowSensor.cpp +++ b/src/modules/simulation/gz_plugins/optical_flow/OpticalFlowSensor.cpp @@ -99,8 +99,11 @@ bool OpticalFlowSensor::Load(const sdf::Sensor &_sdf) // Assume pinhole camera and 1:1 aspect ratio const float focal_length = (image_width / 2.0f) / tanf(hfov / 2.0f); + + // Output rate 0 disables the library's rate limiter: at the camera rate its strict + // interval check withholds every other frame and returns quality -1 for it. _optical_flow = std::make_shared(focal_length, focal_length, - update_rate, image_width, image_height); + 0, image_width, image_height); return true; }