I have MPU6050 accelerometer and gyroscope MEMS sensor for calculate roll and pitch. Bu this calculation now enough my project.
In my project, sensor is on the top of the box. My idea is to calculate the tipping state of the box with a single angle. Box as below:
The green vector will always be perpendicular to earth vector. The blue vector is always perpendicular to the sensor. If I have a vector perpendicular to the sensor and a vector perpendicular to the earth, I can calculate the tipping condition with a single data by calculating the angle between these two vectors.
So my question is how can i get these two vectors from roll and pitch?