Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Regarding Basic Orientation Update #56

Closed
jacob-fw opened this issue Jan 8, 2023 · 1 comment
Closed

Question: Regarding Basic Orientation Update #56

jacob-fw opened this issue Jan 8, 2023 · 1 comment

Comments

@jacob-fw
Copy link

jacob-fw commented Jan 8, 2023

I have a quick question regarding using the basic orientation update (so ignoring the correction terms).
I've been working on an inertial navigation system as a pet project (so tracking both the changes in orientation and changes from the original position).
I've been using the euler angle to quaternion algorithm for updating the orientation, but I like that the technique you present in your paper didn't require using any trig functions to construct the quaternion. However in practice I can't get the updated quaternion to work the way the other one did, and am not sure if it has to be used in a different way.

So ignoring the correction terms, this is how the general orientation update should work

`
initial(){
orientation = buildQuaternion(1,0,0,0);
}

loop(){
deltaQuat = buildQuaternion(0, Yaw, Pitch, Roll);
deltaQuat = mult(orientation, deltaQuat) * (0.5 * deltaTime);
orientation += deltaQuat
orientation = normalize(orientation);

            // From here I can rotate the acceleration data, and use it to update the velocity and position fields
	// accelVec = (orientation * accelVec) * inverse(orientation);

}
`
The problem is that when I use the orientation quaternion to rotate the accelerometer values, it's not giving me the correct values.

As a basic proof of concept, I tested the method by using having it rotate vector (0,1,0) by 180 degrees, by setting a gyroscope vector to (0,0,PI), with deltaTime = 1
`
orientation = buildQuaternion(1,0,0,0);
vector = buildQuaternionFromVector(0,1,0);
deltaTime = 1;
orientation = madgwickOrientationUpdate(orientation, gyroData) // just have it do the same code i showed above in the loop method

// rotate the vector using the new orientation quaternion
vector = rotateVectorByQuaternion(orientation, vector);
`

Assuming I haven't looked over something horribly simple, the updated vector should be (0, -1, 0), which is what I also get
when I tested this out on the euler angle to quaternion method, however the madgwickQuaternionUpdate instead gives (-0.9715, 0.2368, 0)

So does the quaternion the Madgwick code builds not work in this way, or is there another way we're suppose to use it to rotate vectors?

Appreciate any help anyone can provide.

@xioTechnologies
Copy link
Owner

You appear to be referencing code that is not a part of this repository. I suggest you use the algorithm and code provided in this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants