Hi Craig,
I've been looking at the compass orientation doc page here:
http://copter.ardupilot.com/wiki/common-installing-3dr-ublox-gps-compass-module/
I think we also need the instructions (and photos!) for the PX4, which
is different.
The PX4 has a different base orientation of its compass to the
APM2. That means that when you use an external compass on the PX4 you
need a different COMPASS_ORIENT setting.
For the default orientation of the PX4 (ie. SD card side up, with SD
card at the rear of the aircraft), you need the following settings for
an external compass, if you point the external compass white arrow
forward:
AHRS_ORIENTATION=0
COMPASS_ORIENT=4 (Yaw180)
For the default orientation of the APM2 with an external compass you need:
AHRS_ORIENTATION=0
COMPASS_ORIENT=8 (Roll180)
If you had the PX4 upside down, then you would need:
AHRS_ORIENTATION=8
COMPASS_ORIENT=12 (Pitch180)
It is important that users understand that the AHRS_ORIENTATION affects
the orientation of the compass too. So for an external compass the two
orientations combine. The reason it works this way is that when the
compass was attached to the board we didn't want users to have to set
two parameters, so we made it that when you changed the AHRS_ORIENTATION
master orientation it also applied to the compass.
With an external compass I suspect this is going to be pretty confusing
for users. They'll need to know how to combine rotations, and it isn't a
matter of just adding them up.
To solve this I think we'll need to do one of the following:
- add a COMPASS_EXTERNAL=0/1 parameter. If set to 1 then it would
decouple the two orientations, so changing AHRS_ORIENTATION doesn't
change the compass orientation
- add some graphical feedback to MissionPlanner and other ground
stations so users can easily tell if their compass is correctly
oriented. I'm not sure what that would look like.
- implement something to auto-detect the compass orientation. That
should be possible based on the gyro/accel changes when rotating the
board, but I'm not sure what form the interface should take
- create a JavaScript web page that allows users to select different
orientations of the board and the compass, plus their board type, and
have it spit out the correct AHRS_ORIENTATION and COMPASS_ORIENT
settings. The web page would show the board and compass in their
chosen orientation.
Another slight issue with the external compass on the APM2 is that the
connectors on the compass+GPS combo are rather unfortunately placed. The
cables from the APM2.6 have to be twisted around to get both APM2 and
compass+GPS in the "correct" orientation. This makes for messier wiring,
and also means you can't put the compass as far from the APM2.6 as you
can if you had the connectors on the other side (or we just put the
white arrow on the other end of the circuit board, and recommended a
different COMPASS_ORIENT setting).
Cheers, Tridge