External compass, which orientation?

2,313 views
Skip to first unread message

Stefan Gofferje

unread,
Aug 13, 2013, 3:04:00 PM8/13/13
to drones-...@googlegroups.com
Hi,

I got my HMC5983 today and started experimenting but whatever I do, the
copter starts toiletbowling badly and aggressively immediately.
Of course, I recalibrated and did compassmot again every time.
Unfortunately, the orientation of the external compass is not clearly
documented in the wiki. I tried to mount it with Y arrow facing forward
and with X arrow facing forward. Both didn't work. Still trying but
maybe somebody could give me a hint, how the compass should be mounted
in respect to the axis, not something like "connector forward" or so.

--Stefan

Jonathan Challinger

unread,
Aug 13, 2013, 3:15:43 PM8/13/13
to drones-...@googlegroups.com

Well, I would just adjust it until the heading comes out correct.

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Brandon Basso

unread,
Aug 13, 2013, 3:24:09 PM8/13/13
to drones-...@googlegroups.com
Stefan,
Are you clicking on 'External Compass' in the Initial Setup > Mandatory Hardware > Compass menu of mission planner?  If so, this sets COMPASS_ORIENT=8, which is the right setting for the combined external gps/mag, but I believe is wrong for just the external mag, as described here.  You probably want COMPASS_ORIENT=0.

-Brandon


--
Brandon Basso, PhD :: Senior Research and Development Engineer :: 3D Robotics :: Berkeley, CA

Stefan Gofferje

unread,
Aug 13, 2013, 3:41:33 PM8/13/13
to drones-...@googlegroups.com
Brandon,

I think, you didn't get my point :).
I got an HMC5_9_83 module to experiment with it. Not the standard
HMC5_8_83L. The module - as most magnetos - has X, Y and Z axis arrow
printed on it. What I need to know is how are those X, Y and Z axis from
the APM's point of view, so I can mount the module right.

That seems nowhere documented. Every doc only speaks of specific
products, like the 3DR compass module and then speak of "connectors to
the front" or similar.

--Stefan

On 08/13/2013 10:24 PM, Brandon Basso wrote:
> Stefan,
> Are you clicking on 'External Compass' in the Initial Setup > Mandatory
> Hardware > Compass menu of mission planner? If so, this sets
> COMPASS_ORIENT
> <http://copter.ardupilot.com/wiki/arducopter-parameters/#Compass_orientation_COMPASS_ORIENT>=8,
> which is the right setting for the combined external gps/mag, but I
> believe is wrong for just the external mag, as described here
> <http://copter.ardupilot.com/wiki/common-external-magnetometer-for-improved-performance/>.
> You probably want COMPASS_ORIENT=0.
>
> -Brandon
>
>
>
>
> On Tue, Aug 13, 2013 at 12:15 PM, Jonathan Challinger
> <mr.cha...@gmail.com <mailto:mr.cha...@gmail.com>> wrote:
>
> Well, I would just adjust it until the heading comes out correct.
>
> On Aug 13, 2013 12:04 PM, "Stefan Gofferje"
> <stefan....@gmail.com <mailto:stefan....@gmail.com>> wrote:
>
> Hi,
>
> I got my HMC5983 today and started experimenting but whatever I
> do, the
> copter starts toiletbowling badly and aggressively immediately.
> Of course, I recalibrated and did compassmot again every time.
> Unfortunately, the orientation of the external compass is not
> clearly
> documented in the wiki. I tried to mount it with Y arrow facing
> forward
> and with X arrow facing forward. Both didn't work. Still trying but
> maybe somebody could give me a hint, how the compass should be
> mounted
> in respect to the axis, not something like "connector forward"
> or so.
>
> --Stefan
>
> --
> You received this message because you are subscribed to the
> Google Groups "drones-discuss" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to drones-discus...@googlegroups.com
> <mailto:drones-discuss%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google
> Groups "drones-discuss" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to drones-discus...@googlegroups.com
> <mailto:drones-discuss%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>
>
> --
> Brandon Basso, PhD :: Senior Research and Development Engineer :: 3D
> Robotics :: Berkeley, CA
>

neuro copter

unread,
Aug 14, 2013, 6:58:52 AM8/14/13
to drones-...@googlegroups.com
hi stefan,
i needed to do some testing to figure out the correct orientation settings for our external compass ( HMC5883L connected to apm2.5 / ArduCopter) as well.
luckily we still got an apm1 lying around, which has the same compass attached. now assuming that the axis are printed correctly on the compass board, i was able to derive the default orientation for the ardupilot code.

APM1 default orientation (according to source code (compass.h)):   
    ROTATION_ROLL_180

The compass is mounted on the imu-shield by the manufacturer with the following orientation:
      X right
      Y back
      Z down
   
applying the "ROLL_180" this should allow us to figure out the default orientation for a compass as assumed by ardupilot code:
    X left
    Y back
    Z up


hope this helps.
cheers,
philipp (for team neurocopter)

Stefan Gofferje

unread,
Aug 14, 2013, 8:01:43 AM8/14/13
to drones-...@googlegroups.com
Perfect, exactly what I was looking for :). Thanks!
Seems to fit my board also. Mounted and calibrated - no real
toiletbowling but when moving forward or backward in loiter, there's
also some side drift - same as I had before with the integrated compass.
Gonna mount it higher, calibrate again and report back.

--Stefan


On 08/14/2013 01:58 PM, neuro copter wrote:
> hi stefan,
> i needed to do some testing to figure out the correct orientation
> settings for our external compass ( HMC5883L
> <http://store.diydrones.com/HMC5883L_Triple_Axis_Magnetometer_p/br-hmc5883-01.htm>
> connected to apm2.5 / ArduCopter) as well.
> luckily we still got an apm1 lying around, which has the same compass
> attached. now assuming that the axis are printed correctly on the
> compass board, i was able to derive the default orientation for the
> ardupilot code.
>
> APM1 default orientation (according to source code (compass.h)):
> ROTATION_ROLL_180
>
> The compass is mounted on the imu-shield by the manufacturer with the
> following orientation:
> X right
> Y back
> Z down
>
> applying the "ROLL_180" this should allow us to figure out the *default*
> orientation for a compass as assumed by ardupilot code:
> * X left
> Y back
> Z up*
>
> hope this helps.
> cheers,
> philipp (for team neurocopter)
>
> On Tuesday, August 13, 2013 9:04:00 PM UTC+2, Stefan Gofferje wrote:
>
> Hi,
>
> I got my HMC5983 today and started experimenting but whatever I do, the
> copter starts toiletbowling badly and aggressively immediately.
> Of course, I recalibrated and did compassmot again every time.
> Unfortunately, the orientation of the external compass is not clearly
> documented in the wiki. I tried to mount it with Y arrow facing forward
> and with X arrow facing forward. Both didn't work. Still trying but
> maybe somebody could give me a hint, how the compass should be mounted
> in respect to the axis, not something like "connector forward" or so.
>
> --Stefan
>

Randy Mackay

unread,
Aug 14, 2013, 9:24:12 AM8/14/13
to drones-...@googlegroups.com

     Yes, as NeuroCopter says, you'll need to set the orientation to ROTATION_ROLL_180.  I've coincidentally just modified one of my APM2.5s to use the GPS+Compass module and uploaded a video here and put it on the wiki here: http://copter.ardupilot.com/wiki/common-installing-3dr-ublox-gps-compass-module/

-Randy



From: neuro copter <neuro...@gmail.com>
To: drones-...@googlegroups.com
Sent: Wednesday, August 14, 2013 7:58 PM
Subject: [drones-discuss] Re: External compass, which orientation?

Stefan Gofferje

unread,
Aug 14, 2013, 10:31:40 AM8/14/13
to drones-...@googlegroups.com
As I wrote, I was not using the 3DR module but an HMC5983 module.
Remember, I wanted to experiment with this chip as it is the successor
of the HMC5883L.
Anyways, it seems that the correct orientation for this module
(http://www.ebay.com/itm/350797015473) is pins forward, chip up, when
using with APM default settings.
I'm still waiting for Honeywell to send me the information on how to
initiate the calibration and how to use the soft-iron compensation.

--Stefan

On 08/14/2013 04:24 PM, Randy Mackay wrote:
>
> Yes, as NeuroCopter says, you'll need to set the orientation to
> ROTATION_ROLL_180. I've coincidentally just modified one of my APM2.5s
> to use the GPS+Compass module and uploaded a video here
> <https://www.youtube.com/watch?v=niqvBmXeNjU> and put it on the wiki
> here:
> http://copter.ardupilot.com/wiki/common-installing-3dr-ublox-gps-compass-module/
>
> -Randy
>
>
> ------------------------------------------------------------------------
> *From:* neuro copter <neuro...@gmail.com>
> *To:* drones-...@googlegroups.com
> *Sent:* Wednesday, August 14, 2013 7:58 PM
> *Subject:* [drones-discuss] Re: External compass, which orientation?
>
> hi stefan,
> i needed to do some testing to figure out the correct orientation
> settings for our external compass ( HMC5883L
> <http://store.diydrones.com/HMC5883L_Triple_Axis_Magnetometer_p/br-hmc5883-01.htm>
> connected to apm2.5 / ArduCopter) as well.
> luckily we still got an apm1 lying around, which has the same compass
> attached. now assuming that the axis are printed correctly on the
> compass board, i was able to derive the default orientation for the
> ardupilot code.
>
> APM1 default orientation (according to source code (compass.h)):
> ROTATION_ROLL_180
>
> The compass is mounted on the imu-shield by the manufacturer with the
> following orientation:
> X right
> Y back
> Z down
>
> applying the "ROLL_180" this should allow us to figure out the *default*
> orientation for a compass as assumed by ardupilot code:
> * X left
> Y back
> Z up*

Andrew Chapman

unread,
Aug 16, 2013, 2:20:01 AM8/16/13
to drones-...@googlegroups.com
On a related note, I've been trying to solve the toilet-bowling of one of my Hexs, and recently switched to the external compass module (nice case 3DR!), but even that hasn't solved my compass woes 100%



I didn't see any TB in my initial testing in perfectly calm conditions, but I'm concerned that I still don't have a 100% accurate compass, which could lead to TB if wind is pushing from a certain direction+velocity.

The problem is if I dial the compass declination to get one dirction perfectly lined up (e.g. north) then the other axes are off by 5-15 degrees. So for now I've tuned it to minimize the average error across all directions: some are skewed a little to the right, some a little to the left. Further down are screengrabs showing the copter aligned to each compass direction (made easier by the street grid here). Is this being caused by something on my frame, or local magnetic anomalies? And although these screengrabs are from my apartment roof, I did get the same results in a wide open field the following morning.

In full-scale aircraft when performing a compass swing you end up with a compass variation card showing the remaining error and the amount to correct in various directions. Do we need something similar in the ArduCopter code? Small adjustments for each 30 degrees, defaulting to zero but user tunable?

Aircraft compass variation card:




Here's my Mission Planner screen grabs on cardinal directions, you can see it is off by quite a bit, and untunable by declination given it changes depending on the direction. I repeated the compass calibration a few times with consistent results, and my compassmot is only 6%.


North (reading 10-15 degrees under):


East (reading 5-10 degrees over):


South (reading 5-10 degrees over):


West (reading 5-10 degrees under):


AC.

Randy Mackay

unread,
Aug 16, 2013, 3:42:09 AM8/16/13
to drones-...@googlegroups.com
AC,

     The compass error needs to be over 45 degrees to get run-away toilet bowling while in Loiter but even with lower errors you will see issues when moving forward.  Still, from the compass correction card you've got below it looks like the errors are just a degree or two.  That's not enough to cause toiletbowling if the compass is the cause.

     So I guess the question is whether the issue is in the dynamic interference caused by the motors or the regular static offsets are incorrect.

     Compassmot producing an error of only 6% suggests that it's not the dynamic interference from the motors that's the problem although I see your gps+compass is mounted right on an arm and although the wires between the ESC and motors is all AC which apparently doesn't cause much interference (as opposed to the PDB<->ESC wires which are DC which do cause a lot of interference)...still I worry a bit about that.

     If it's the static offsets that are wrong then you'll see the heading change when the copter leans over so could you try leaning the copter over 30 degrees or so to see if the heading moves around a lot?

     a tlog of a flight would also be very useful because we will be able to more directly see the interference on the compass's mag field vs throttle.  The method to pull this from the tlogs is on this wiki page:  http://copter.ardupilot.com/wiki/common-diagnosing-problems-using-logs/#Compass_interference

-Randy



From: Andrew Chapman <amch...@gmail.com>
To: drones-...@googlegroups.com
Sent: Friday, August 16, 2013 3:20 PM
Subject: Re: [drones-discuss] Re: External compass, which orientation?

Jonathan Challinger

unread,
Aug 16, 2013, 1:06:37 PM8/16/13
to drones-...@googlegroups.com
Is there something near the compass which could be producing soft-iron effects? That's the only effect not being accounted for, unless the hard-iron offsets are incorrect.
gbhfffjc.png
ediiedhi.png
gehhehgh.png
jhcedjed.png
acgafjbb.png
idjdgfbf.png

Andrew Chapman

unread,
Aug 19, 2013, 1:39:21 AM8/19/13
to drones-...@googlegroups.com
On 2013-08-16 10:06 AM, Jonathan Challinger wrote:
> Is there something near the compass which could be producing soft-iron
> effects? That's the only effect not being accounted for, unless the
> hard-iron offsets are incorrect.

The compass is mounted out on one of the arms, about 15cm from the
central power distribution, ESCs, etc - so there's nothing nearby other
than the 3 plaited wires underneath which run out from the ESC to that
motor.

AC.

Craig Elder

unread,
Aug 19, 2013, 4:45:32 AM8/19/13
to drones-discuss
That location is not nearly as effective as mounting up and away from the PDB and the wiring.


Reply all
Reply to author
Forward
0 new messages