mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-12-02 22:40:27 +08:00
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 <dahl.jakejacob@gmail.com>
This commit is contained in:
1 parent
8c5f4e0788
commit
9ad42167e0
1 file changed
+4
-1
@@ -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<OpticalFlowOpenCV>(focal_length, focal_length,
|
||||
update_rate, image_width, image_height);
|
||||
0, image_width, image_height);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user