PX4 / PX4-Autopilot

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

PX4_SITL position mode height drift [Bug] #22709

Open dirksavage88 opened 9 months ago

dirksavage88 commented 9 months ago

Describe the bug

When flying x500/px4vision in px4_sitl the quadcopter will not hover stable and will drift higher and higher (infinitely) unless the throttle is lowered. This issue was repeated with both a ps4 dualshock and logitech joystick. The issue did not occur in hold mode.

To Reproduce

1) Start a px4_sitl x500 or px4vision instance 2) connect joystick and make sure qgc shows the joystick page responds to stick input 3) set to position mode, take off and attempt to hover. leave throttle at approximate thrust to maintain stable hover 4) observe height drift upward infinitely unless throttle is lowered 5) switch to hold mode and observe height drift increase not an issue

Expected behavior

PX4 SITL quadcopters in position mode should not drift upward infinitely

Screenshot / Media

No response

Flight Log

N/A

Software Version

Main

Flight controller

POSIX

Vehicle type

Multicopter

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

No response

Additional context

No response

MaEtUgR commented 9 months ago

Would it be possible to get a log from such a simulated flight? In SITL logs are stored under PX4-Autopilot/build/px4_sitl_default/tmp/rootfs/log/2024-xx-xx/xx_xx_xx.ulg

dirksavage88 commented 9 months ago

Here is the log that demonstrates it. If I look at the joystick page in QGC, I can see the stick for throttle slowly increase without touching any of the buttons. If I try to level out it will slowly increase again. 02_00_15.zip

MaEtUgR commented 8 months ago

@dirksavage88 Thanks for the log. Next time you can directly upload it to PX4 Flight Review: https://review.px4.io/plot_app?log=c5532491-2421-4af7-a2c6-205f357ade66

The data in the log shows that the autopilot listens to the stick input like expected. But the way the stick input behaves leaves me puzzled. image

It's coming through MAVLink e.g. from the ground station and it seems to drift upwards presumably every time you let go of the stick. What kind of Joystick are you using? I presume a physical joystick. Could it have physical or electronic issues in the joystick gimbals or a driver issue in the ground station OS? Could you compare against behavior with the QGC Virtual Joystick? Could you check the proper functionality of the physical joystick in the OS e.g. Windows: https://www.howtogeek.com/241421/how-to-calibrate-your-gaming-controller-in-windows-10/ Linux: https://unix.stackexchange.com/a/80935

dirksavage88 commented 8 months ago

The height drift upwards does not occur with only the qgc virtual joysticks. I can check the driver and make sure it's updated. Using ubuntu 22.04 and have tried the ps4 dualshcok and logitech f310 and they both have the same drift issue.

MaEtUgR commented 8 months ago

Then it's maybe a bug in QGC. What version do you have? I haven't used a real joystick in a while. I can give it a spin on latest daily.

dirksavage88 commented 8 months ago

It is a daily from master:cbaec9b8 2023-11-10

MaEtUgR commented 8 months ago

Just tested with a Logitech F310 and latest QGC daily image on Windows 11 against SITL and it works like expected 🤔 Did you calibrate the joystick (3rd tab under Joystick)? image

Are the joysticks working correctly if you look at the OS output e.g.

sudo apt install joystick 
jstest /dev/input0
dirksavage88 commented 8 months ago

Try enabling circle correction & deadbands

dirksavage88 commented 8 months ago

also the drift is more pronounced when you are at 50% throttle