Coder Social home page Coder Social logo

Comments (15)

xioTechnologies avatar xioTechnologies commented on September 27, 2024 1

The North-West-Up (NWU) describes the axis directions relative to the Earth as X = North, Y = West, and Z = Up.

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

thanks for your reply, I means why to set the North-West-Up coordinate. In general, we can use the one piece of acc and mag data to calculate transformation matrix based on ENU or NWU between the earth coordinate and imu coordinate, and set this transformation as the intial pose q0. In fusion algorithm, we set the initial quaternion pose as identity matrix, and the output pose will be correct with the feed of acc and mag data, that is why the "ahrs->rampedGain" coefficient is large, because we use the acc and mag data to converge into right pose. and during this convergence process, we make sure the NWU coordinate, not ENU coordinate, is the viewpoint right ?
following codes are related with the decision with the NWU coordinate, is it right ?

   const FusionVector halfGravity = {
            .axis.x = Q.x * Q.z - Q.w * Q.y,
            .axis.y = Q.y * Q.z + Q.w * Q.x,
            .axis.z = Q.w * Q.w - 0.5f + Q.z * Q.z,
    };
   ahrs->halfAccelerometerFeedback = FusionVectorCrossProduct(FusionVectorNormalise(accelerometer), halfGravity);
   const FusionVector halfWest = {
                .axis.x = Q.x * Q.y + Q.w * Q.z,
                .axis.y = Q.w * Q.w - 0.5f + Q.y * Q.y,
                .axis.z = Q.y * Q.z - Q.w * Q.x
        };
    ahrs->halfMagnetometerFeedback = FusionVectorCrossProduct(FusionVectorNormalise(FusionVectorCrossProduct(halfGravity, magnetometer)), halfWest);

from fusion.

xioTechnologies avatar xioTechnologies commented on September 27, 2024

I am sorry but I do not understand your description and question. NWU and ENU are conventions. Fusion uses NWU.

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

Sorry for confusing you, i change my question to another. if I want to change the output quaternion pose to be based on ENU ? what should i do ?

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

I am sorry but I do not understand your description and question. NWU and ENU are conventions. Fusion uses NWU.

Sorry for giving this uncomfortable understanding for you. I want to give further explanations for you. In your thesis, you mentioned that your output is based the North-West coordinate. My question is that which step in your algorithm is based on the North-West coordinate.

Thanks for your patience and hope your reply. Cheers!

from fusion.

xioTechnologies avatar xioTechnologies commented on September 27, 2024

A change from NWU to ENU would only affect line 164. If you are only using a gyroscope and accelerometer then no change is required. In this case, NWU and ENU are identical because the algorithm would have no reference of heading.

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

I see, and if i want to change the NWU to ENU, how can i revise the line 164 to change into ENU ? can you give me an example or some related materials ?

Thanks for your patience and hope your reply. Cheers!

from fusion.

xioTechnologies avatar xioTechnologies commented on September 27, 2024

My previous comment was incorrect, several other changes would be required. The changes are too complex to guide you through here. I will consider this a feature request for Fusion to support NWU, NED, and ENU. I cannot suggest a completion date at this time. However, you can access the WIP once the feature branch is available.

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

Cool, thanks a lot.

from fusion.

xioTechnologies avatar xioTechnologies commented on September 27, 2024

ENU and NED support has been added in axes-convention.

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

Wonderful !! very thankful !!

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

One more question, i want to know the theory behind the Ned or END calculation code, can you give me some documents or advice about that ? thanks.

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

Hello, I check the axes-convention branch code, and discover that the code realization about function named by "HalfGravity(const FusionAhrs *const ahrs)" is not complete. the "case FusionConventionNwu" is not realized.

static FusionVector HalfGravity(const FusionAhrs *const ahrs) {
#define Q ahrs->quaternion.element
    switch (ahrs->settings.convention) {
        case FusionConventionNwu:
        case FusionConventionEnu:
            return (FusionVector) {
                    .axis.x = Q.x * Q.z - Q.w * Q.y,
                    .axis.y = Q.y * Q.z + Q.w * Q.x,
                    .axis.z = Q.w * Q.w - 0.5f + Q.z * Q.z,
            }; // third column of transposed rotation matrix scaled by 0.5
        case FusionConventionNed:
            return (FusionVector) {
                    .axis.x = -1.0f * (Q.x * Q.z - Q.w * Q.y),
                    .axis.y = -1.0f * (Q.y * Q.z + Q.w * Q.x),
                    .axis.z = -1.0f * (Q.w * Q.w - 0.5f + Q.z * Q.z),
            }; // third column of transposed rotation matrix scaled by -0.5
        default:
            return FUSION_VECTOR_ZERO; // avoid compiler warning
    }
#undef Q
}

Thanks for your patience and hope your reply. Cheers!

from fusion.

xioTechnologies avatar xioTechnologies commented on September 27, 2024

North-West-Up (NWU), East-North-Up (ENU), and North-East-Down (NED) describe the alignment of the Earth XYZ axes. I do not have any documentation for how calculations differ for each. It should be clear from the code and comments, assuming the reader is familiar with the underlying mathematics. For example, the acceleration of gravity is in the up direction. For NWU and ENU, up is aligned with +Z and so gravity must be equal to the third column of a rotation matrix. For NED, up is aligned with -Z and so gravity must be equal to the negated third column of a rotation matrix.

The code is complete. The value of halfGravity is the same for FusionConventionNwu and FusionConventionEnu so the switch statement implements a fall through.

from fusion.

mingrenzhu avatar mingrenzhu commented on September 27, 2024

Thanks for your reply. I check the theory from chapter 7 of Madgwick's PhD thesis combined with your explanation, and i understand the calculation of "HalfGravity" vector based on different axe conversions. thanks again.

from fusion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.