APM board and compass orientation

Hi,

I searched through all the website, but could not find any information on how the Navio should be oriented.
From my observations, I suppose the servo connectors should point to the back of the vehicle for “AHRS orientation 0”.
But I am totally lost with the compass orientation…

The reason I am lost is the compass always is misleading by ca. 90 degrees, if I set it to compass-orientation 0

What are you trying to create Sebastian, and what software are you using (the ardupilot software is still experimental)

I use ardupilot and I know it is experimental :-). I just noticed, my setting the AHRS_orientation to yaw 180° did not get saved ( I have the Navio/Pi mounted backwards). So the compass could not be right, of course. I just drove my thumper outside and except for weaving it worked quite well in guided mode. I set compass_learn to 1 and after driving around for a while with a solid GPS lock, the compass was showing the right heading.

Sebastian, we’ll investigate that issue in a few days and see what we can do.
Did you try to set compass orientation aside from the board orientation?
After the learning, was compass working okay all the time, without a drift?

Mikhail, I tried to save the AHRS_orientation again via udp connection to missionplanner on my desktop pc and now it worked. I suspect it was the radio link that acted up the first time.
I now have set AHRS orientation to 180° yaw and compass orientation to 0.
Yes, I tried to set compass orientation aside from board orientation to get the heading right, but that was before I noticed the board orientation was wrong/not saved.
I have to install APMplanner again on my ubuntu laptop, to test the compass performance. Right now I use qgroundcontrol and to me it is cumbersome.

Hi,

I am still struggling to get my Wild Thumper tuned.
So I have to ask again, which way the Navio board should be oriented for the APM firmware.
Where is the front of the board and is the magnetometer aligned the same way, or do I have to set “compass_orientation” to another value.

Aside from this, I now disabled the skid steer function in the APM firmware and enabled the skid steer mixing in the sabertooth motor controller. I can´t use the pivot turning in auto mode now, but the sabertooth has a better mixing implementation.
The APM limits the throttle for turning to 50%, which makes it hard to do pivot turns on rough surfaces.

Can I use my APM/Pixhawk power modules with the Navio?

Okay, perhaps I can answer my own (probably dumb) question. Since the MPU9250 is compass, accelerometer and gyro in one package, it is only logical that the alignment of the accelerometer and the compass should be the same.

Ok, now my arms are longer from juggling my 5kg rover around, but finally the compass is showing the right directions.
The settings for the APM firmware and my setup are:

AHRS_orientation 4 (180° yaw, servo connectors pointing to the front of the rover)
compass_orientation 2 (90° yaw).

I also found my external compass module and connected it to the I2C connector, but the second compass does show nothing (compass_external 0 or 1).

Sebastian,
The default orientation for RPi + Navio is USB ports in the the front and Navio is on top.
It seems that the compass orientation is lacking 90° yaw turn by default, we’ll recheck it and if it is will fix that.

Currently MPU9250 compass is used as an external compass (may seem weird, but needed due to some internal APM logic), if you’d like to use external HMC module you can change https://github.com/emlid/ardupilot/blob/navio/libraries/AP_HAL/AP_HAL_Boards.h :

  
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NAVIO  
#define HAL_BOARD_LOG_DIRECTORY "/var/APM/logs"  
#define HAL_INS_DEFAULT HAL_INS_MPU9250  
#define HAL_BARO_DEFAULT HAL_BARO_MS5611  
#define HAL_COMPASS_DEFAULT HAL_COMPASS_AK8963  

to

  
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NAVIO  
#define HAL_BOARD_LOG_DIRECTORY "/var/APM/logs"  
#define HAL_INS_DEFAULT HAL_INS_MPU9250  
#define HAL_BARO_DEFAULT HAL_BARO_MS5611  
#define HAL_COMPASS_DEFAULT HAL_COMPASS_HMC5843  

The compass orientation issue was fixed a few days ago in https://github.com/emlid/ardupilot/commit/f0753e965e525cc792a365fa23b73d1f6d6daac3 (it had an unnecessary rotation).

Hi, i have a similar issue, I’ve mounted my navio+ board with Ethernet on the back side and servo pins on the front, i’ve set up AHRS_ORIENTATION => 4 (180° YAW) but than my roll level is inverted, when i rotate left, than HUD on Mission Planner and apmplanner2 is showing the opposite, rotate left shows right and so on (firmware version 3.3.1)

I thought AHRS_ORIENTATION should do the trick, COMPASS_ORIENTATION value is 0 but I’ve tried 4 as well. ACCELERATOR was re calibrated after changing AHRS_ORIENTATION. Any hint to solve this issue would be very welcome,
Many thanks in advance

@0xCCD Christian,

Are you sure that you are interpreting the HUD correctly? It shows horizon, not the vehicle orientation. So when you you rotate left, the horizon goes right.

I guess i interprete it right :), just for clarification, i don’t mean yaw level, i’m talking about roll.

And as far as i know, if i manually roll my copter to the left, the HUD should also show a rotation to the left, if i put the vehicle nose up, i should see “the air”, before i’ve set AHRS_ORIENTATION 4 (yaw 180) HUD showed grass instead of air

When you roll it left, the horizon should roll right. Try to tilt your head :smile:

I’m still confused, but I’ve checked also the HUD with my connected Pixhawk ^^ and it is the same!
Sorry to bother you with stupid questions :smiley:

Christian,

Have you figured it out? :slight_smile: Maybe a description of HUD here could help http://planner.ardupilot.com/wiki/mission-planner-ground-control-station/