We are building a quadcopter using the SpektreWorks carrier board for PixHawk 2.1 Cube and currently facing the problem of drifting away in loiter mode as described below:
The quad is installed with firmware version 3.5.0-rc11.
In our test flight, it can take off fine and we could control it in stabilize and altitude hold modes.
But after switching to loiter, the quad started drifting away slowly but steadily for 15’-20’ and we had to switch back to stabilize mode to control its horizontal movement.
The GPS was solidly fixed
The accelerometer and compass are calibrated well.
EFK checked and performed well within limit.
Vibration was well within limit.
The flight log shows that the velocity X and Y don’t track the desired velocity (when not only in loiter mode) so I suspect the problem might be that the default PixHawk PID parameters that we used might not perform up to the task.
I’m no log guru - but looking at your RCIN channels - they’re all slightly offset - Have you done a radio calibration (both in MP and TX) recently - and made sure you’ve got no trims on? otherwise you’ll find it will drift in loiter/pos hold (as it thinks you’re putting stick inputs in).
A averages around 1545
Thank you @stik79 for your reply. I did trim the TX a little in Stabilize mode before switching to Loiter. But in loiter mode, when the quad started drifting I could not pull it back at all even when the sticks at max/min position, so I think it wasn’t because of the radio trim.
These numbers refer to the orientation of the compass versus the AHRS alignment of the flight controller.In otherwords which way the compass is pointing relative to the FC and frame.The numbers you have in your paramters actually mean this.
COMPASS_ORIENT, 28 rotation pitch 180 - yaw 90
COMPASS_ORIENT2,18 rotation roll 90 - yaw 90
COMPASS_ORIENT3, 0 rotation none
Which say either your compasses have strange mounting angles or they are set wrong.
I suspect compass 1 (or 0 ) is an external one in the GPS housing and the other two are those on the flight controller board.Those would be unusual mounts.The GPS compass will need to be worked out (probably 0) and the two FC compass also 0.In other words all pointing the same way as the flight controller and frame.The range of different numbers is to allow mounting at any angle to the frame.
For instance - the copter I have powered up in front of me now is a Pixhawk 2.4.8 and uses 1,0,0 so (unusually ) that’s Yaw 45,None and None.
Number 8 is often used ( Roll_180 ) for compasses mounted upside down on the GPS board.
Thank you @Jagger. I originally configured the compass in Mission Planner / Initial Setup / Compass with compass 1 (external) - orientation as roll90pitch 90 (because that was the way my compass mounted), compass 2 (internal) enabled and compass 3 disabled. I did not check the parameters under Config / Tuning so I don’t really know why the COMPASS_ORIENT params had those values. Why do the COMPASS_ORIENT in params list differ from the settings in Compass Setup tab?
Anyway, the problem is solved. Today I reset all params, correct all the COMPASS_ORIENT params, re-calibrate everything and finally I had a good loiter flight. I also removed all the trim on TX. Maybe it was the combination of both that caused the problem, I’m not sure.
If I had my COMPASS_ORIENT params all wrong, why didn’t error EKF COMPASS VARIANCE pop up?