mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-17 07:30:36 +08:00
commander: require local position for home
This fixes (or at least works around) a race condition where the `status_flags.condition_local_position_valid` is still `false` but the `status_flags.condition_global_position_valid` is already `true`. The way to reproduce it is t: 1. Poll home position to check if home is initialized 2. Send arm and takeoff command as soon as home is initialized Then arming will succeed but takeoff will fail because there is a check for `status_flags.condition_local_position_valid` in `main_state_transition()` to enter TAKEOFF.
This commit is contained in:
@@ -1264,8 +1264,8 @@ static void commander_set_home_position(orb_advert_t &homePub, home_position_s &
|
||||
const vehicle_local_position_s &localPosition, const vehicle_global_position_s &globalPosition,
|
||||
const vehicle_attitude_s &attitude)
|
||||
{
|
||||
//Need global position fix to be able to set home
|
||||
if (!status_flags.condition_global_position_valid) {
|
||||
//Need global and local position fix to be able to set home
|
||||
if (!status_flags.condition_global_position_valid || !status_flags.condition_local_position_valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user