How intepret the results from BNO085 sensor?

Hi!

I'm testing my new sensor BNO085 and I want to determine the boat's course. I use the ready-made code from the examples (SH2_ROTATION_VECTOR - determining the course based on data from accelerometer, gyroscope and magnetometer). I get the result in quaternions, then I transform them into Eulerians and degrees - function below:

void quaternionToEuler(float qr, float qi, float qj, float qk, euler_t* ypr, bool degrees) {
  Serial.println(RAD_TO_DEG);

    float sqr = sq(qr);
    float sqi = sq(qi);
    float sqj = sq(qj);
    float sqk = sq(qk);

    ypr->yaw = atan2(2.0 * (qi * qj + qk * qr), (sqi - sqj - sqk + sqr));
    ypr->pitch = asin(-2.0 * (qi * qk - qj * qr) / (sqi + sqj + sqk + sqr));
    ypr->roll = atan2(2.0 * (qj * qk + qi * qr), (-sqi - sqj + sqk + sqr));

    if (degrees) {
      ypr->yaw *= RAD_TO_DEG;
      ypr->pitch *= RAD_TO_DEG;
      ypr->roll *= RAD_TO_DEG;
    }
}

According to the documentation, the Y axis marked on the sensor points north (screen below), so if the sensor receives a result of 0, then north is where the Y axis points on the sensor?

No, the result will be 1+0i+0j+0k, top row in that table. A result of 0 is not valid, rotations represented as quaternions have magnitude 1, ie a^2+b^2+c^2+d^2 = 1, where a,b,c,d are the coefficients of 1,i,j,k

okey, so how interpet the result in euler and then in deegres from this function? For example, I have a 90 deegres and this is a East. So in which direction (which axis on sensor) is East?

I check this now. You have right, where I received for examaple 0+0i+0j+1k the Y axis pointed at South so this is agree with documentation.

Dealing with 3D angle representations always requires a cool head to get things right (or just try all the variants as there's only a finite number!)

At least with quaternions a rotation is relatively intuitive, the vector part of the quarternion gives the axis of rotation, the scalar part the angle (more exactly the cosine of half the angle)

Thanks for your answer. I tested my results and it's ok, but I have to design arm to sensor calibrate (in three axis).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.