Re: BN055 Vertical Orientation
Does the device make any assumptions about its initial orientation?
You can customize how the axes are oriented (i.e. swap them around, etc.) but the Adafruit Arduino library doesn't expose it right now. Check out section 3.4 Axis Remap of the BNO055 datasheet for info on the registers to adjust its orientation: https://www.adafruit.com/datasheets/BST ... 000_12.pdf
Another thing to be aware of is that until the sensor calibrates it has a relative orientation output (i.e. orientation will be relative to where the sensor was when it powered on).
A system status value of '0' in NDOF mode means that the device has not yet found the 'north pole', and orientation values will be relative not absolute. Once calibration and setup is complete (system status > '0') the heading will jump to an absolute value since the BNO has found magnetic north (the system calibration status jumps to 1 or higher). See the Device Calibration page in this learning guide for further details.
Re: BN055 Vertical Orientation
Re: BN055 Vertical Orientation
Re: BN055 Vertical Orientation
Re: BN055 Vertical Orientation
roll = atan2(y, z) * 57.3; //about x
pitch = atan2((- x) , sqrt(y * y + z * z)) * 57.3; //about y
// replace x, y, z -> z, x, y
roll = atan2(x, y) * 57.3; //about z
pitch = atan2((- z) , sqrt(x * x + y * y)) * 57.3; //about x
// replace x, y, z -> y, z, x
roll = atan2(y, z) * 57.3; //about y
pitch = atan2((- x) , sqrt(y * y + z * z)) * 57.3; //about z
Re: BN055 Vertical Orientation
float yy = quat.y() * quat.y();
float roll = -1*atan2(2 * (quat.w() * quat.x() + quat.y() * quat.z()), 1 - 2 * (quat.x() * quat.x() + yy));
float pitch = asin(2 * quat.w() * quat.y() - quat.x() * quat.z());
float yaw = atan2(2 * (quat.w() * quat.z() + quat.x() * quat.y()), 1 - 2 * (yy + quat.z() * quat.z()));
float rollDeg = 57.2958 * roll;
float pitchDeg = 57.2958 * pitch;
float yawDeg = 57.2958 * yaw;
Re: BN055 Vertical Orientation
Re: BN055 Vertical Orientation
Re: BN055 Vertical Orientation
Re: BN055 Vertical Orientation
imu::Quaternion quat = bno.getQuat(); //Request Quaternions From Sensor
float roll = atan2(2*(quat.y() * quat.z()) + 2*(quat.w() * quat.x()), pow(quat.w(),2) - pow(quat.x(),2) - pow(quat.y(),2) - pow(quat.z(),2));
float pitch = -1*asin(2*(quat.x() * quat.z()) - 2*(quat.w() * quat.y()));
float yaw = atan2(2*(quat.x() * quat.y()) + 2*(quat.w() * quat.z()), pow(quat.w(),2) + pow(quat.x(),2) - pow(quat.y(),2) - pow(quat.z(),2));
float rollDeg = 57.2958 * roll;
float pitchDeg = 57.2958 * pitch;
float yawDeg = 57.2958 * yaw;
imu::Quaternion quat = bno.getQuat(); //Request Quaternions From Sensor
float roll = atan2(-2*(quat.y() * quat.z()) + 2*(quat.w() * quat.x()), pow(quat.w(),2) - pow(quat.x(),2) + pow(quat.y(),2) - pow(quat.z(),2));
float pitch = asin(2*(quat.x() * quat.y()) - 2*(quat.w() * quat.y()));
float yaw = atan2(-2*(quat.x() * quat.z()) + 2*(quat.w() * quat.y()), pow(quat.w(),2) + pow(quat.x(),2) - pow(quat.y(),2) - pow(quat.z(),2));
float rollDeg = 57.2958 * roll;
float pitchDeg = 57.2958 * pitch;
float yawDeg = 57.2958 * yaw;
Re: BN055 Vertical Orientation
Re: BN055 Vertical Orientation
Re: BN055 Vertical Orientation
the quaternion matrix
Re: BN055 Vertical Orientation
sj_remington wrote:the quaternion matrix
That matrix may indeed represent one of the many possible ways to derive Euler angles from a quaternion. But which particular definition of Euler angles?
What I am saying is that if you relabel the axes, you can relabel the yaw, pitch and roll angles accordingly, as long as you stick to the rules (XYZ -> XZY violates them). But you also need to know how those angles are defined.
I recommend that you take a step back and learn the basic rules for quaternion operations: it is high school trigonometry and algebra (really!). Since quaternions have become central to the graphics engines used for games, you will find the operations clearly explained in many tutorials on the web.
In the long run you will learn that Euler angles are NOT the way to go for the sort of application you have in mind.
Edit: it occurred to me that the BNO055 provides Euler angles. If you mentally remap the default BNO055 orientation axes, following the rules for cyclic permutation, the angles output by the BNO055 must also be cyclically permuted by the same operation.