mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Flow example fix for divide by zero.
This prevented publishing and made the module unusable.
This commit is contained in:
parent
7ca2553da2
commit
017f3ead47
@ -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 */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user