built-in phone's 3D orientation experiment - Printable Version +- phyphox Forums (https://phyphox.org/forums) +-- Forum: Discussion (https://phyphox.org/forums/forumdisplay.php?fid=1) +--- Forum: Experiments and Ideas (https://phyphox.org/forums/forumdisplay.php?fid=4) +--- Thread: built-in phone's 3D orientation experiment (/showthread.php?tid=1803) |
built-in phone's 3D orientation experiment - pietropicerno - 09-14-2023 dear all, apologies if this request has been already submitted. Wouldn't be nice if PhyPhox provided an orientation sensor as a built-in experiment? Android framework gives access to "type_rotation_vector" (an angle-axis/quaternion representation of the phone's 3D orientation based on acc+gyro+mag sensor fusion) and to "type_game_rotation_vector" (the same as the previous one without magnetometer). From these virtual orientation sensors, the phone's 3D orientation in terms of Euler angles (roll, pitch and yaw) can be derived by using " SensorManager.getRotationMatrixFromVector()", that converts in rotation matrix the output (quaternion) provided either by "type_rotation_vector" or "type_game_rotation_vector", and then using "SensorManager.getOrientation()" that returns roll pitch and yaw angles for an easier interpretation of the phone's orientation. In PhyPhox editor I have noticed that no game_rotation_vector is included in the list of available sensors. I hope you could implement this feature soon! Thanks for the attention, Pietro PS: with respect to the already present built-in inclinometer experiment, that is probably base solely on accelerometer data (and that cannot be used in dynamic conditions), retrieving the phone's orientation directly from the vendor sensor fusion algorithm would give a more responsive and accurate 3D orientation of the phone that could track the phone's orientation even in dynamic conditions. RE: built-in phone's 3D orientation experiment - Jens Noriʇzsɔɥ - 09-15-2023 The attitude sensor has been left out for a reason as explained on https://phyphox.org/wiki/index.php/Attitude_sensor and we would definitely need to recheck the validity of its results on a substantial number of devices. Problems like gimbal lock will always persist and the user base for quaternions is quite narrow, isn’t it? Game rotation vector looks like a worse variant of attitude: for what purpose would this be necessary? AFAICS, there is no equivalent on iOS, so it would be pretty down the list then anyway… Ad p.s.: check https://phyphox.org/forums/showthread.php?tid=1758&pid=3545#pid3545 for an inclination experiment utilising the gravity vector. RE: built-in phone's 3D orientation experiment - pietropicerno - 09-19-2023 (09-15-2023, 10:29 AM)Jens Noritzsch Wrote: The attitude sensor has been left out for a reason as explained on https://phyphox.org/wiki/index.php/Attitude_sensor and we would definitely need to recheck the validity of its results on a substantial number of devices. Problems like gimbal lock will always persist and the user base for quaternions is quite narrow, isn’t it? Thanks Jens! 1) I got your point and your "policy". I know that type_rotation_vector is proprietary and it would differ from smartphone to smartphone, but I would just take it "as is". 2) I understand the limits of Euler angles, but for teaching purposes they are fine though. 3) I love your inclination experiment using the gravity vector so it can be used in case of an accelerating smartphone, but type_gravity is computed using the proprietary sensor fusion algorithm so we're back to the 1st point. Well, according to android type_gravity should be computed by subtracting type_linear_acceleration to type_accelerometer and, since type_linear_acceleration" is computed using the orientation of the phone with acc and gyro only (see Sensor types | Android Open Source Project ) then I suppose that type_gravity is computed using type_game_rotation_vector (and, infact, ythe inclination of your experiment is not disturbed by ferromagnetic pbjects). Thanks for the support Jens! Now, lots of things are more clear to me. Best, Pietro RE: built-in phone's 3D orientation experiment - Jens Noriʇzsɔɥ - 09-21-2023 The point about the “game rotation vector” is not about being proprietary: it is attitude without magnetometer, isn't it, giving likely worse results… RE: built-in phone's 3D orientation experiment - pietropicerno - 09-21-2023 Hi Jens, yes I know! But I'd prefer to be immune of ferromagnetic disturbance rahter than having a stable heading for a long time ;-). Thanks, Pietro PS: I really hope you could re-consider, in the future, to add a built-in euler angles (acc+gyro+mag, preferably with XYZ and YXZ decomposition order, and either with NED and ENU absolute frame convention) experiment for teaching purposes! |