I'm able to get quaternion data from the BNO055 sensor, and would like to convert these to angular velocity for my project. I know you can pull the gyroscope directly for the data, but from what I understand using quaternions and converting those is more robust?

I found a function that does this in a Adafruit repository for the sensor. However, I'm not sure what the Delta time variable should be equal to, in relation to the sample frequency. Could anyone advise?

Here is the function code:

  Vector<3> toAngularVelocity(double dt) const {
    Vector<3> ret;
    Quaternion one(1.0, 0.0, 0.0, 0.0);
    Quaternion delta = one - *this;
    Quaternion r = (delta / dt);
    r = r * 2;
    r = r * one;

    ret.x() = r.x();
    ret.y() = r.y();
    ret.z() = r.z();
    return ret;

And the link

  • Thank you for your time everyone. I really appreciate it. Apr 13, 2021 at 8:09

1 Answer 1


I do not know how to interpret the data given by that sensor, but from reading the code, the meaning of dt is pretty clear.

The function you show assumes that the sensor started in the reference orientation (quaternion one), then rotated at a constant angular velocity until it reached the current orientation (quaternion *this), and this rotation happened over a time dt.

Then dt is the time required for moving from the reference orientation to the orientation described by the quaternion *this. You should probably check out the sensor's datasheet for more details on how the orientations are provided.

  • Hi again Edgar and thanks for your response. I'll check and update the question. Apr 13, 2021 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.