mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 09:13:33 +08:00
Added "bottom distance" switch, multirotor_pos_control implemented: use bottom distance to surface to control altitde
This commit is contained in:
@@ -439,12 +439,12 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
|
||||
} else {
|
||||
/* new ground level */
|
||||
surface_offset -= sonar_corr;
|
||||
mavlink_log_info(mavlink_fd, "[inav] new surface level: %.3f", surface_offset);
|
||||
alt_avg -= sonar_corr; // TODO check this
|
||||
sonar_corr = 0.0f;
|
||||
sonar_corr_filtered = 0.0f;
|
||||
sonar_valid_time = t;
|
||||
sonar_valid = true;
|
||||
local_pos.surface_bottom_timestamp = t;
|
||||
mavlink_log_info(mavlink_fd, "[inav] new surface level: %.2f", surface_offset);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -521,14 +521,12 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
|
||||
if (gps_valid) {
|
||||
if (gps.eph_m > 10.0f) {
|
||||
gps_valid = false;
|
||||
warnx("GPS signal lost");
|
||||
mavlink_log_info(mavlink_fd, "[inav] GPS signal lost");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (gps.eph_m < 5.0f) {
|
||||
gps_valid = true;
|
||||
warnx("GPS signal found");
|
||||
mavlink_log_info(mavlink_fd, "[inav] GPS signal found");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user