Help with Direction to home 180 deg off

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
power67
Posts: 33
Joined: Wed Aug 22, 2012 8:37 pm

Help with Direction to home 180 deg off

Post by power67 »

Hello,

I am not sure where even to begin. I have a Paris Multiwii PNP board with the Paris GPS board with mag on the GPS board.

I seem to be having an issue with the direction to home function. The current heading is reported correctly, but the dir to home is 180 deg. off.

has anyone ever experienced this and what possibly is the issue?

I have pushed the original code back on both the Paris Multiwii board and the GPS board.

Thanks.
Ross

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Help with Direction to home 180 deg off

Post by shikra »

Depends upon orientation of the GPS board, Its intened to have the cable coming from GPS board facing forward (as this is more common)
Info is on their website under the GPS board

It will be an #define board option in v 2.2


If using 2.1...

v2.1 Code changes for PARIS Main CPU (not the GPS CPU which does not need any code) - check/comment bold text

def.h PANEL

scroll down a fair way 40%
#if defined(SIRIUS) //Special GPS PARIS version with 2nd 5883L in GPS pod underneath - wire forward - primary 5883L line cut
#define ITG3200
#define BMA180
#define BMP085
#define HMC5883
#define ACC_ORIENTATION(X, Y, Z) {accADC[ROLL] = -X; accADC[PITCH] = -Y; accADC[YAW] = Z;}
#define GYRO_ORIENTATION(X, Y, Z) {gyroADC[ROLL] = Y; gyroADC[PITCH] = -X; gyroADC[YAW] = -Z;}
#define MAG_ORIENTATION(X, Y, Z) {magADC[ROLL] = -X; magADC[PITCH] = Y; magADC[YAW] = Z;} //normal Sirius MAG on top is X Y -Z
#

power67
Posts: 33
Joined: Wed Aug 22, 2012 8:37 pm

Re: Help with Direction to home 180 deg off

Post by power67 »

thank you shikra I have all those setting set in place. As i said the heading is reported correctly. only the direction home is 180 off. my board is set cable forward, any other thoughts.

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Help with Direction to home 180 deg off

Post by shikra »

Yeah re-reading more carefully I see that now. How are you reading direction home - on the standard GUI? Not got a clue to be truthfull.... Never really paid much attention to GPS direction on the GUI. I will next time though.

Maybe its indictaor only? could test carefully to see if OK in flight. Hopefully someone else can verify soon for ya..

power67
Posts: 33
Joined: Wed Aug 22, 2012 8:37 pm

Re: Help with Direction to home 180 deg off

Post by power67 »

what started this issue was trying to integrate an osd that reads the serial stream from the multiwii. it showed the direction 180 off. I then tested with the gui and found that it is 180 off as well. that way i know the direction home was incorrect in the stream and not in the osd interpretation.

itain
Posts: 75
Joined: Tue Aug 23, 2011 10:32 pm

Re: Help with Direction to home 180 deg off

Post by itain »

Are you using Rushduino? Which version?
I will refer to recent development versions (see http://code.google.com/p/rush-osd-devel ... 2FRush_OSD) that has not been published yet. Other versions may have known bugs.

There are 5 displayed items that could be relevant:
1. The heading in degrees (either -179..180 or 0..359 depending on which version you use).
2. The heading graph. (older versions were offset by about 11 degrees).
3. Distance to home.
4. Direction to home in numbers (0..359) that just the direction from your current location to the home location.
5. Direction to home arrow. This is the difference between the direction to home and the current heading.
(that was completely useless in the original Rushduino firmware. Fixed in all versions that exist in the above site).

Now if there is a problem I suggest that you write down the home coordinates. Now while the copter is armed move it to a new location 50m or more from the home location and write down the new coordinates, direction to home, distance to home, heading and where the arrow is pointing. Try to change the heading and see if the arrow keeps pointing to the same direction. Try to see that the coordinates that you wrote are correct (you can use google earth). Now try to figure out which values are wrong.... you can post these values (but then your location will be disclosed).
-- Itai

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: Help with Direction to home 180 deg off

Post by shikra »

mmm. I don't usually bother with arrows etc on OSD, but I know when using mobidrone OSD with GPS/directions stuff enabled on first flights - it was also reporting direction home out by approx degrees. Think that is with 2.1

power67
Posts: 33
Joined: Wed Aug 22, 2012 8:37 pm

Re: Help with Direction to home 180 deg off

Post by power67 »

Ok,

Here is some pictures and some information.

I am not too afraid of the GPS zombies seeing my location so here you go.

43.1471360N 71.8897060W Home Location set

43.1466050N 71.8893960W around 70 M away still facing same heading as when I left home location.



When I checked google maps... I was very happy with the location accuracy of the gps information.
I still am stumped as to why the direction home is off.

Here is where I set the home location.

Image

after walking directly in one direction (south) here is the data

Image

Any thoughts ? I do not know how to check bearings in google maps. but I did put the lat/lon dat in for both locations and it is very accurate. I bet within a few feet.

Shouldn't the home direction arrow and heading be directly behind me? that is the arrow should point down and the bearing be around north +- (156 - 180)?

itain
Posts: 75
Joined: Tue Aug 23, 2011 10:32 pm

Re: Help with Direction to home 180 deg off

Post by itain »

You can use the ruler tool on Google earth to calculate distance and bearing.

I see only the left side of the screen images. There is no view of the distance to home (should be ~64 m), direction to home (should be ~337 degrees) and heading.
Also, please tell which version of the Rushduino firmware you are using!

(Probably a recent version because it displays "Disarmed" and not "Motors off").

The MultiWii firmware always sends distance to home = 0 when the motors are off (also see
DONT_RESET_HOME_AT_ARM option of MultiWii).

Thanks,
-- Itai

dynai
Posts: 32
Joined: Tue Mar 01, 2011 10:01 pm

Re: Help with Direction to home 180 deg off

Post by dynai »

Hi Ross,

I just went outside with a very similar setup, mtk 3339 on tinyGPS and a minimOSD.

Heading in osd is correct and so ist the arrow pointing back to "arm" location.

i used the latest sources (dev. 1303 from mulitwii and itais latest rushduino)

i attached both collections, they are allready configured to my sensors and flying wing so you'll need to discard those specific settings but it saves your from trouble of downloading every single file ;)
don't forget the magnetic declination for your place -14.84f

kind regards Chris
Attachments
Rush_OSD.zip
(21.12 KiB) Downloaded 130 times
MultiWii_1303.zip
(136.09 KiB) Downloaded 132 times

power67
Posts: 33
Joined: Wed Aug 22, 2012 8:37 pm

Re: Help with Direction to home 180 deg off

Post by power67 »

loaded your files and configured to use SirusGPS and had the same effect.

Home bearing and arrow is 180 off. I am going to contact Quinton @ multiwiicopter ( as that is where I got the boards) and see if he has any input.
Only other option at this point is to say %&*#@- it and just change the code in the OSD to reflect the information that the Paris Multiwii is putting out.

carlonb
Posts: 210
Joined: Sun Apr 03, 2011 6:29 pm

Re: Help with Direction to home 180 deg off

Post by carlonb »

power67 wrote:loaded your files and configured to use SirusGPS and had the same effect.

Home bearing and arrow is 180 off. I am going to contact Quinton @ multiwiicopter ( as that is where I got the boards) and see if he has any input.
Only other option at this point is to say %&*#@- it and just change the code in the OSD to reflect the information that the Paris Multiwii is putting out.

If your GPS unit is running with a serial/I2C converter, my opinion is to investigate on S/W that do the data conversion.
All GPS connected directly to FC with serial port are working well, the home arrow is correct.
Bye

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: Help with Direction to home 180 deg off

Post by EOSBandi »

Indeed,
The GPS_directionToHome contains the direction from home to copter when i2c_gps_nav is used....You have to rotate it by 180deg and wrap up in the MultiWii code....

power67
Posts: 33
Joined: Wed Aug 22, 2012 8:37 pm

Re: Help with Direction to home 180 deg off

Post by power67 »

Thank you EOSBandi, I was going to try to get ahold of you tonight. I spoke to Quinton and he thought you may be able to point me in the right direction. Can you give me an idea of where to look in the code.
Man, I thought I was going crazy. and it was just me.
is the calculation that the copter uses to get back home different than what is shown in the serial stream? Where in the code should I begin and does this need to be addressed in further versions? is this addressed in the Multiwii code or the I2c gps code?

Thanks for the response
Ross

power67
Posts: 33
Joined: Wed Aug 22, 2012 8:37 pm

Re: Help with Direction to home 180 deg off

Post by power67 »

EOS,

is this where I should make the correction?

in the multiwii / GPS.ino

Code: Select all

varptr = (uint8_t *)&GPS_directionToHome;
        *varptr++ = i2c_readAck();
        *varptr   = i2c_readAck();
        GPS_directionToHome = GPS_directionToHome / 100;  // 1deg =1000 in the reg, downsize
        if (GPS_directionToHome>180) GPS_directionToHome -= 360;


if yes, what is the best method to correct would the following work?

Code: Select all

varptr = (uint8_t *)&GPS_directionToHome;
        *varptr++ = i2c_readAck();
        *varptr   = i2c_readAck();
        GPS_directionToHome = GPS_directionToHome / 100;  // 1deg =1000 in the reg, downsize
        //added to correct inverted axis
        GPS_directionToHome += 180;
        if (GPS_directionToHome>180) GPS_directionToHome -= 360;


I just want to make sure that I dont break the current Nav aspect of your code.

Thanks
Ross

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Help with Direction to home 180 deg off

Post by EOSBandi »

as an interim fix, it is ok. I'll fix it in the upcoming v2.2 release of i2c-nav

power67
Posts: 33
Joined: Wed Aug 22, 2012 8:37 pm

Re: Help with Direction to home 180 deg off

Post by power67 »

Hey EOSBandi,
I upgraded my tricopter to the new Multiwii 2.2 today,

Did you get a change to fix the 180 off direction home yet, or do I have to do the above fix again for this version?

I have not uploaded the new r62 i2c_nav yet, should I?

Let me know Please

Thanks for all your work.
Ross

Post Reply