BerryGPS-IMU compass “north”

Home Forums Forums Technical Support for BerryGPS and BerryGPS-IMU BerryGPS-IMU compass “north”

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #17937
    currydem
    Participant

    I have a simple question. I’ve searched and found two separate answers. Which side of the BerryGPS-IMU is the “north” side. Like which side is facing towards the heading to be read? The short side with the “ublox” chip (Red arrow) or the long side next to the antenna switch (Blue arrow)?

     

     

     

    #17939
    Mark Williams
    Keymaster

    It is the blue arrow
    On the next version, we will place an indicator on the PCB

    Mark --OzzMaker.com --

    #17946
    currydem
    Participant

    Thank you so much I have another question about the C files used in the tutorial and the python file. Would it be appropriate to ask it in this same thread or should I make another with that specific topic?

    #17947
    Mark Williams
    Keymaster

    no.. go ahead here if you like

    Mark --OzzMaker.com --

    #17948
    currydem
    Participant

    In the tutorial for the compass it is written in C and it has a section to compensate for soft iron distortion as well as magnetic declination. In the Python compass code it does not. I tried to mimic a soft iron distortion section but when I do this it doesn’t give me the correct heading. I also get a different heading (an incorrect one) when I use the original Python compass code even after calibration

     

    code below:

     

    Hard iron distortion

     

    C code

    magRaw[0] -= (magXmin + magXmax) /2 ;

    magRaw[1] -= (magYmin + magYmax) /2 ;

    magRaw[2] -= (magZmin + magZmax) /2

     

    Python code

     

    MAGx -= (magXmin + magXmax) /2

    MAGy -= (magYmin + magYmax) /2

    MAGz -= (magZmin + magZmax) /2

     

     

     

    Soft iron distortion

     

     

     

    C code

     

    scaledMag[0]  = (float)(magRaw[0] – magXmin) / (magXmax – magXmin) * 2 – 1

    scaledMag[1]  = (float)(magRaw[1] – magYmin) / (magYmax – magYmin) * 2 – 1

    scaledMag[2]  = (float)(magRaw[2] – magZmin) / (magZmax – magZmin) * 2 – 1

     

    Python code (what I tried to adapt to the Python code)

     

    scaledMagX  = (MAGx – magXmin) / (magXmax – magXmin) * 2 – 1

    scaledMagY = (MAGy – magYmin) / (magYmax – magYmin) * 2 – 1

    scaledMagZ  = (MAGz – magZmin) / (magZmax – magZmin) * 2 – 1

     

     

     

     

    C code

    float heading = 180 * atan2(scaledMag[1],scaledMag[0])/M_PI

     

    Python code (what I tried to adapt to the Python code)

     

    float heading = 180 * atan2(scaledMagY,scaledMagX)/M_PI

     

    *****original code*********

    heading = 180 * math.atan2(MAGy,MAGx)/M_P

    ***************************

     

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Blip, blop, bloop…