This is for folks who end up here searching solutions for the same problem.
If you’ve tried all the main recommendations for getting stable loiter, such as magnetometer/compass/RC calibration, GPS signal strength/lock, stick trim, compassMOT etc. there’s one more possibility to add to the list which has had me chasing shadows for months.
My quad would slide backwards or sideways when put into loiter or Pos Hold. After tearing my hair out trying all the usual recommendations over and over, I finally got it sorted: my joysticks were not centering properly when released.
RC controller joysticks typically send a pwm signal from around 1000 (minimum) to ~2000 (highest) with the mid point at ~1500. The RC calibration function in APM Planner / Mission Planner measures these values for each of your sticks and sets the autopilot accordingly. However, it assumes that the sticks return to (nearly) exactly the same position / signal when released. Mine didn’t. Visually, you couldn’t tell, but the electronic signal was just too far off centre.
APM has a set of parameters RC1_DZ, RC2_DZ … which set a “dead zone” in the centre position, so that small errors in re-centering the sticks don’t get seen as pilot stick input. The default is 30, so if your stick centres on 1500, the flight controller needs an RC signal <1470 or >1530 before it responds to the stick.
(Note: this is not the same as adjusting trim on the RC transmitter. Adjusting trim works if the stick returns to the same value each time, but that value is not half way between min and max. My problem was that the stick returns to a random value close to the mid point, but not close enough.)
My pitch and yaw stick had a centering error of around ~60 - when released it would return to a random value between ~1440 and ~1560. So when I released the stick, the flight controller often thought I still had a small amount of stick applied, and was (correctly) flying in that direction. My problem was solved by increasing the appropriate RCx_DZ value to 100.
Drone drifts slowly in a straight line when in loiter/pos hold and sticks released despite good setup and HDOP.
You might have a cheap RC transmitter.
- Connect your drone and to APM Planner/mission planner and turn on the RC transmitter.
- Open RC calibration in the initial setup tab.
- Perform RC calibration. Note the centre values it returns for each stick (e.g. min 1008, max 2000, centre 1498 - 1498 is the value you want).
- In the RC calibration screen (without hitting calibrate), watch the RC displays. For the direction your quad drifts, flick the stick fully up (or down/left/right), and release it. See what value it returns to. Do it a few times to see the spread of results. If the stick ever fails to re-centre to within 30 of the centre value from calibration (eg. <1468 or >1528 in the example), there’s your problem.
- Brute force method: note the RC channel affected by the sticky stick. Go into Full Parameters, find the RCx_DZ value (where x is the RC channel affected) and increase to a value circa 20 or so bigger than the biggest difference between calibrated centre value and the actual stick centred values. This will make your quad a little less responsive to stick. I wouldn’t set a DZ value to much over 100 - that would indicate you have a busted RC joystick.
- Open your RC transmitter, and give the offending joystick a check. You might have gunk in the works, or might be able to tighten the return spring to centre harder. Give the potentiometer a blow out (you can also use WD40, but that can sometimes attract dust later).
- Replace the joystick in your RC unit.
Hope this helps someone.