heading issue on Multiwii pro

Post Reply
air_n_water
Posts: 10
Joined: Sun Dec 21, 2014 1:48 am

heading issue on Multiwii pro

Post by air_n_water »

I have a multiwii pro (red board from HK). I am using Multiwii2.3 nsvi-b7 and WinGUI2.3pre10b71. The heading will show correctly in the GUI, but if I set up a mission with SET HEADING points, theheading is 180 degrees off. Has anyone seen this, and how do you fix it?

brewski
Posts: 483
Joined: Tue Apr 29, 2014 12:04 am
Location: Cleveland Qld Australia

Re: heading issue on Multiwii pro

Post by brewski »

air_n_water wrote:I have a multiwii pro (red board from HK). I am using Multiwii2.3 nsvi-b7 and WinGUI2.3pre10b71. The heading will show correctly in the GUI, but if I set up a mission with SET HEADING points, theheading is 180 degrees off. Has anyone seen this, and how do you fix it?

Are you sure (check with a compass) that with front of multi pointing to north that north is also showing accurately in WinGUI. Are you using onboard or Ext Mag?

air_n_water
Posts: 10
Joined: Sun Dec 21, 2014 1:48 am

Re: heading issue on Multiwii pro

Post by air_n_water »

Brewski,

I am as sure as I think I can be on where north it. Since I am a pilot and an amateur astronomer I have true and magnetic north nailed down pretty good. The GUI also show that it is pointing north after I have calibrated the mag sensor and put in the magnetic declination. Even the map graph in the GUI shows it pointing to the north. However, if I set a mission and use SET_HEAD of 040 (my runway heading), it turns and flies with the tail at 040 and the front at 220. So I check to see how it should navigate without a set heading and I have this in config.h

#define NAV_CONTROLS_HEADING 1
#define NAV_TAIL_FIRST 0
#define NAV_SET_TAKEOFF_HEADING 1

It does turn to the correct heading when doing RTH. Any clues on what I should check? Oh also I am using the onboard MAG sensor.

brewski
Posts: 483
Joined: Tue Apr 29, 2014 12:04 am
Location: Cleveland Qld Australia

Re: heading issue on Multiwii pro

Post by brewski »

No doesn't make sense. I suggest you post in the Software Dev > GPS Nav section of forum

whirligig
Posts: 14
Joined: Fri Nov 21, 2014 6:52 pm

Re: heading issue on Multiwii pro

Post by whirligig »

You should check if the magnetometer is fluxuating with motors running. The EMF generated by the motor wires and distribution board can cause the magnetometer to swing, in my case +/- 90 degrees. To run the test, hookup the FC to the MultiwiiConf or MultiwiiGUI. Uncheck all readings except the magnetometer. Restrain the aircraft then power up with propellers on. If the compass swings wildly as you throttle up, that's the problem.

There's two ways to fix this and that is either to mount a remote magnetometer or add shielding. I chose the latter and used steel top from a can of vegetables as my low tech solution. Punched four holes and mounted it between the power distribution board and the Multiwii. Running the test afterward, the compass needle varied 5 to 10 degrees on my Tricopter. A bigger diameter can top might improve this. GPS hold is working great. I have not tested RTH yet. That's next.

air_n_water
Posts: 10
Joined: Sun Dec 21, 2014 1:48 am

Re: heading issue on Multiwii pro

Post by air_n_water »

I have all the under control, EMF, vbration,etc. This is obviously a code error.

I am working in SW Development to get the answer.

Just in case someone stumbles on this thread here is the fix. The 180 degree reciprocal should be removed (magHold = wrap_18000((GPS_directionToPoi*100)-18000)/100;)

In GPS.cpp, this is the original section:

//This controls the heading
if (f.GPS_head_set) // We have seen a SET_POI or a SET_HEADING command
{
if (GPS_poi[LAT] == 0)
magHold = wrap_18000((GPS_directionToPoi*100)-18000)/100;
else
{
GPS_bearing(&GPS_coord[LAT],&GPS_coord[LON],&GPS_poi[LAT],&GPS_poi[LON],&GPS_directionToPoi);
GPS_distance_cm(&GPS_coord[LAT],&GPS_coord[LON],&GPS_poi[LAT],&GPS_poi[LON],&wp_distance);
magHold = GPS_directionToPoi /100;
}
}

It should if this:

//This controls the heading
if (f.GPS_head_set){ // We have seen a SET_POI or a SET_HEADING command
if (GPS_poi[LAT] == 0)
magHold = wrap_18000((GPS_directionToPoi*100))/100;

else {
GPS_bearing(&GPS_coord[LAT],&GPS_coord[LON],&GPS_poi[LAT],&GPS_poi[LON],&GPS_directionToPoi);
GPS_distance_cm(&GPS_coord[LAT],&GPS_coord[LON],&GPS_poi[LAT],&GPS_poi[LON],&wp_distance);
magHold = GPS_directionToPoi /100;
}
}

CreedyNZ
Posts: 1
Joined: Tue Dec 30, 2014 8:33 pm

Re: heading issue on Multiwii pro

Post by CreedyNZ »

Not sure if this is a related issue or not, but...My V-Tail running the Whitespy MultiWii PRO Ez3.0 Blacked MAG Editon Flight Controller with the uBlox 6H GPS and Compass suddenly started heading into the wild blue yonder when GPS hold was activated. Once collected it again I ran some tests and noticed that while the mag calibration was fine up to 200 deg, as soon as the heading was what should be 201, the heading value went negative and remained negative till it hit zero again? I assume this is not normal?

I'm running MWCW 2.3 using the Whitespy config.

I tried a new mag sensor and had the exact same issue, so assuming it's not a mag hardware issue

Any thoughts or suggestions appreciated

Post Reply