PX4 / PX4-Autopilot

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

[Bug] fixed-wing airspeed and wind estimation problem in SITL #23756

Open TigerWuu opened 1 month ago

TigerWuu commented 1 month ago

Describe the bug

PX4 software-in-the-loop calculates the airspeed using differential pressure in SensorAirspeed.cpp in the simulation module. However, SensorAirspeed.cpp generates the fake differential pressure by body velocity, it will induce some airspeed calculating and wind estimation problems when the wind comes from the x-axis of the body frame
image I think a more feasible modification is using the wind triangle concept, obtaining the ground speed from uorb topic and true wind value from gazebo plugin, and calculating the true airspeed to generate the differential pressure. What do you guys think?

To Reproduce

  1. Follow the steps in https://docs.px4.io/main/en/ros2/user_guide.html to install PX4 autopilot, ROS2 and gazebo sim.
  2. Open a standard_vtol in the windy.sdf
  3. Set the wind magnitude as (0, -2, 0) using the wind tag in the sdf file. 0 -2 0
  4. Arm the drone and transition to the fixed wing mode, fly straightly to the north.
  5. Open the plotjuggler to monitor the wind estimation value in the /fmu/out/wind

Expected behavior

the windspeed_east and windspeed_north value should converge to real value (0, -2) image

Screenshot / Media

No response

Flight Log

No response

Software Version

image

Flight controller

No response

Vehicle type

Hybrid VTOL

How are the different components wired up (including port information)

No response

Additional context

No response

Jaeyoung-Lim commented 1 month ago

@TigerWuu Thanks for reporting the bug. Feel free to open a pull request for the fix

TigerWuu commented 1 month ago

@Jaeyoung-Lim Hi, I have fixed the wind estimation problem the following is the result. Now the estimations look much more normal. 091b2229-7091-492c-8b79-3d33615bfd5b

I modified two repositories to fix this problem, gz-sim and PX4-Autopilot. The current information flow will be like this b06a7c62-07ed-4706-8890-23669a7240a0

However, I have the following problem with PR, I am currently working on

cause I run into the same issue as #23705, if I use the latest version of px4 and gz sim

what should I do? should I wait until this bug fixed then apply my modification into the latest version of px4 and gz?

Jaeyoung-Lim commented 1 month ago

@TigerWuu Thanks for looking into the problem.

You would have to reapply your modification to the latest 'main' of the PX4 repository to apply your changes. Otherwise your changes would not get applied in future versions