I've been browsing the web for far too long, and still can't find a solution to this issue for my student project. Mind you my math skills are not that great, so I'm desperate for any help I can get! Most links I've visited or seen in forum posts has lead me to articles about Quaternion math solutions, which even though it is said to be simple, the articles are too advanced for my skills and it is really hard to get a sense (in 3D) of what is going on in. I've also tried using Euler Angles to do the calculations, but have run into issues with Gimble Lock, as the sensor I'm using needs to rotate freely, and sometimes upside down or in a 90 degree angle.

My problem: I receive quaternion readings from a sensor hooked up to an Arduino. These readings come in the form [w, x, y, z] and change as I rotate the sensor around freely.

An example of these readings are: [0.93, 0.23, 0.21, -0.23]

I have an imaginary point floating in 3D, with coordinates [x, y z]. Let's use [1, 0, 0] as an example. The task is now to rotate this point around the center of the coordinate system using the quaternion readings from the sensor and hopefully to calculate the new updated xyz coordinates for the point.

I actually have 10 points I need to update their position based on the quaternion readings, but if I just learn how to move one point, I can repeat the calculations for the rest)

The coordinate system I'm using is this: Coordinate system of the sensor

The sensor is quite stable delivering several readings per second, which only change when I rotate the sensor. Placing the sensor horizontally on a table gives the readings [1.00, 0.01, -0.01, 0.00]

Maybe it makes sense to imagine a sphere with a radius of 1 in the center of a coordinate system. The point are all located on the surface of this sphere, thereby always having the distance 1 to the coordinate systems origin. The quaternion readings from the sensor then rotates the sphere and thereby the points on its surface, and I need to update the position of these points.

My math skills are not very good, and (if possible) explaining the calculations in java/javascript or Arduino(C++) would be a lot of help.

Thank you!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.