diff options
Diffstat (limited to 'src/examples/flow_position_estimator/flow_position_estimator_main.c')
-rw-r--r-- | src/examples/flow_position_estimator/flow_position_estimator_main.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/examples/flow_position_estimator/flow_position_estimator_main.c b/src/examples/flow_position_estimator/flow_position_estimator_main.c index 1ac0c2d04..da4ea825b 100644 --- a/src/examples/flow_position_estimator/flow_position_estimator_main.c +++ b/src/examples/flow_position_estimator/flow_position_estimator_main.c @@ -309,8 +309,13 @@ int flow_position_estimator_thread_main(int argc, char *argv[]) if (vehicle_liftoff || params.debug) { /* copy flow */ - flow_speed[0] = flow.pixel_flow_x_integral / (flow.integration_timespan / 1e6f) * flow.ground_distance_m; - flow_speed[1] = flow.pixel_flow_y_integral / (flow.integration_timespan / 1e6f) * flow.ground_distance_m; + if (flow.integration_timespan > 0) { + flow_speed[0] = flow.pixel_flow_x_integral / (flow.integration_timespan / 1e6f) * flow.ground_distance_m; + flow_speed[1] = flow.pixel_flow_y_integral / (flow.integration_timespan / 1e6f) * flow.ground_distance_m; + } else { + flow_speed[0] = 0; + flow_speed[1] = 0; + } flow_speed[2] = 0.0f; /* convert to bodyframe velocity */ |