mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 03:33:35 +08:00
Check home reset in local frame
This commit is contained in:
@@ -3128,8 +3128,8 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
|
|
||||||
float home_dist_xy = -1.0f;
|
float home_dist_xy = -1.0f;
|
||||||
float home_dist_z = -1.0f;
|
float home_dist_z = -1.0f;
|
||||||
get_distance_to_point_global_wgs84(_home.lat, _home.lon, _home.alt, global_position.lat, global_position.lon,
|
mavlink_wpm_distance_to_point_local(_home.x, _home.y, _home.z, local_position.x, local_position.y,
|
||||||
global_position.alt, &home_dist_xy, &home_dist_z);
|
local_position.z, &home_dist_xy, &home_dist_z);
|
||||||
|
|
||||||
/* First time home position update - but only if disarmed */
|
/* First time home position update - but only if disarmed */
|
||||||
if (!status_flags.condition_home_position_valid && !armed.armed) {
|
if (!status_flags.condition_home_position_valid && !armed.armed) {
|
||||||
@@ -3145,7 +3145,7 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* update when disarmed, landed and moved away from current home position */
|
/* update when disarmed, landed and moved away from current home position */
|
||||||
else if (status_flags.condition_home_position_valid && !armed.armed && land_detector.landed && !_home.manual_home &&
|
else if (status_flags.condition_home_position_valid && !armed.armed && land_detector.landed && !_home.manual_home &&
|
||||||
(home_dist_xy > global_position.epv * 2 || home_dist_z > global_position.eph * 2)) {
|
(home_dist_xy > local_position.epv * 2 || home_dist_z > local_position.eph * 2)) {
|
||||||
commander_set_home_position(home_pub, _home, local_position, global_position, attitude, false);
|
commander_set_home_position(home_pub, _home, local_position, global_position, attitude, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user