I have a Here gps mounted on a stalk on my hexacopter with a Pixhawk 2.1 Cube mounted between the frame plates. Both are oriented towards the front of the copter. I have been building the machine and troubleshooting for a month or so and am almost ready for a test flight, however, I cannot get the Here compass to give accurate headings. It is out by about 16 degrees when the machine is pointed due North, 28 degrees when pointed due West, 57 degrees when pointed due South and 54 degrees when pointed due East. These are averages of several measurements taken with the copter in different locations without props, motors off, and on the ground.
I carried out compass calibration with all three compasses selected (1 in the Here and 2 in the Pixhawk) and the calibration completed normally. The Here had offsets of x33, y52 and z -22. The offsets of the second compass were x101, y-110 and z -37. The third compass had a high x offset (400+) so I’ve discounted it.
Making the first Pixhawk compass the primary yields quite good heading data but then there is no reliable backup. I have added a 1k resistor across the power and ground test pads of the Here (as suggested elsewhere) but this has made no difference. I’ve fiddled about a bit with the COMPASS_ORIENTATION parameter but not found anything useful and in 3.5.5 it is supposed to be left at zero for my configuration anyway.
My questions are:
Is the negative z offset of the Here compass indicative of a problem (I am in the UK so Northern hemisphere)?
What might be the problem with the Here unit and;
Is it safe to fly in stabilize and loiter modes with only the Pixhawk compass to rely on since I don’t know what might happen to its accuracy when actually flying?
All advice gratefully received by this inexperienced but enthusiastic budding copter pilot.
Negative offsets or offsets with opposing signs are okay. Generally it is only the magnitude that may indicate poor sensing.
You can fly in any non position-controlled flight mode without the compass. This includes Stabilize,Alt Hold, Acro, etc. Not Loiter or Poshold.
You say that the HERE is mounted on a mast away from the other electronics, but it has poor accuracy compared to the internal compass? This is quite unusual. Things that could help us diagnose:
pictures of your setup
parameter file
flight log, if available. Maybe try flying in alt hold above 5 meters (ArduCopter realigns the compass above this altitude).
That said, don’t feel obligated to fly if you are not comfortable with maidening your copter yet.
Thanks Rick. I attach links to dropbox giving pictures and parameter list. I hope to get a flight logged in the next day or so and will post a link to the log file. The last link below is to a picture of the HERE reference numbers on the side of the box - just in case it is relevant. (I note that the compass offsets are different to what I quoted in my first post - I guess I looked at the wrong notes!).
Maiden flight was successful (i.e. copter flew quite well and stayed in one piece), however, hover throttle was low at about 30% which made switching to alt hold mode slightly unnerving (sudden altitude change)! I believe that this is because the copter has no payload yet and so is relatively overpowered. I’m not sure how to interpret the dataflash log data concerning the compass performance so would value your input.
Mike
The X and Y readings of all 3 compasses follow each other well, and seem normal. Meanwhile, the Z axes of compasses 2 and 3 are in the 400’s, while compass 1’s readings are extremely noisy and suspiciously centered around 0. It doesn’t seem to react to the aircraft maneuvering or landing, which makes me suspect that readings here are invalid.
I am not an expert when it comes to magnetometers, but it looks like a bad module to me. My speculation is that the Z axis is not reading correctly due to a bad connection or sensor, and the data we see is just line noise.
Edit: Oh and congrats on your maiden flight. I took a very cursory look over your flight log. Here are my notes:
Vibrations are pretty good. Only thing is there was a moment when you switched from alt hold to stabilize which caused an abrupt throttle up. The Z IMU got saturated at this point (clipping, see VIBE.Clip2). Look for things that might be banging against the Cube, and consider some damping material.
The drone has a very slight right yaw tendency (not related to stick inputs, see RATE.YOut). This is usually caused by motors not being perfectly level. It’s quite small, so it’s not a problem.
Your throttle is on RC channel 1. Not a problem, just unusual so I wanted to make sure that was intended.
Your copter seems quite powerful, as it hovers at around 15% throttle. Consider adding weight or lowering battery voltage to 3S. It’s not actually a problem, but there’s a few things you’ll want to double-check, as it might have somewhat limited control authority on the bottom end with this configuration:
Make sure your MOT_PWM_MIN and _MAX match your ESC settings
Make sure your ESC’s have active/regenerative braking enabled
Try lowering MOT_SPIN_ARM to as low as it will go while still allowing your motors to start up reliably, so you can then lower MOT_SPIN_MIN to be slightly higher than that. This will give your motors a bit more room on the bottom end.
Your copter hasn’t yet learned what its hover throttle is yet, as you haven’t spent much time in altitude-controlled modes. I’d recommend setting MOT_THST_HOVER to 0.20 to start. The copter would learn this automatically, but it’s nice to be able to ballpark it ahead of time.
Rick thank you for your detailed analysis of the data and your helpful comments. I had spent some time looking at the data and you have given me confidence that I can now interpret it with some understanding. I’ll follow your advice regarding the low hover throttle and throttle parameters. While flying I did notice that the copter yawed right a little and had to be corrected. Not sure whether I have any freedom to affect the esc settings as the dji escs cannot be calibrated as I understand it - I’ll investigate this.
Your comments concerning the magnetometer are very useful and I’ll investigate further.
Ah, yes, DJI ESC’s are a bit funny, and sometimes you have to be careful with your parameters to make sure you’re sending them the right PWM range. See the last part of my response here: Pixhawk 2.1, APM 3.5 and DJI E800 issue
The yaw drifting you observed was due to stick inputs:
You often held the yaw stick just a tiny bit outside of the deadzone (above 1514), causing the drone to slowly rotate. This is common, since yaw is on the throttle stick. You can slightly increase the deadzone, or put an expo curve on your transmitter’s RC4 so the drone won’t be so touchy in yaw.
The yaw tendency I mentioned before was mechanical, and I’m not sure it would have been noticeable. It can be seen in this graph, where the flight controller is constantly outputting a slight right yaw (average more than 0):
Rick thanks - your insights into the data are very useful. When I solve the magnetometer issue I’ll post the results on here in case it might help others.
I found that disabling detection of the Honeywell mag of the HERE (using the COMPASS_TYPEMASK parameter) removed the malfunctioning compass. I have added a LIS3MDL magnetometer and after recalibration now have what appears to be accurate heading data and ‘normal’ z-axis plots on all compasses. Still only the new compass has acceptable offsets though.
Bottom line is that the HERE compass seems to have been defective from day one, however, the gps functions fine.