PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.48k stars 13.5k forks source link

Weather vane working inconsistently #13725

Closed xdwgood closed 4 years ago

xdwgood commented 4 years ago

Describe the bug Through simulation in gazebo, I found that the vane will work in LAND and RTL mode only after I have performed the mission task. If I do not execute the mission mode, the vane in land and rtl mode will never work

To Reproduce Steps to reproduce the behavior:

  1. Fetch latest master branch 2.Add debug code PX4_INFO("1111") here: https://github.com/PX4/Firmware/blob/master/src/lib/flight_tasks/tasks/Auto/FlightTaskAuto.cpp#L249
  2. run make px4_sitl_default gazebo_tailsitter
  3. Execute one-click take-off command by QGC
  4. switch land mode by QGC 5.No debug output 1111 during landing 6.Execute one-click take-off command by QGC 7.Execute survey mission command by QGC 8.switch position mode by QGC 9.switch Land/RTL mode by QGC 10.debug output 1111 during landing/rtl

Expected behavior For me: I want the vane algorithm to work properly in LAND and RTL mode, and don’t rely on whether I have ever performed a mission(survey)

EDIT On the other hand: If we only want to activate the weather vane function under the mission task, we can add pos_sp_triplet-> current.allow_weather_vane = false after the mission is completed. But I prefer the weather vane to work in land and RTL

Source of the problem This problem is caused by: This (_sub_triplet_setpoint.get().current.allow_weather_vane)condition is true only when the mission task is executed. here: https://github.com/PX4/Firmware/blob/master/src/modules/navigator/mission.cpp#L692

Possible related links: https://github.com/PX4/Firmware/pull/10883

xdwgood commented 4 years ago

I solved this problem by adding pos_sp_triplet-> current.allow_weather_vane = true in LAND and RTL;

Can we make allow_weather_vane default to true? FYI: @sfuhrer

xdwgood commented 4 years ago

fix by #13761