phyphox Forums
Attitude sensor android vs iphone - Printable Version

+- phyphox Forums (https://phyphox.org/forums)
+-- Forum: App-Feedback (https://phyphox.org/forums/forumdisplay.php?fid=6)
+--- Forum: Bugs and Problems (https://phyphox.org/forums/forumdisplay.php?fid=9)
+--- Thread: Attitude sensor android vs iphone (/showthread.php?tid=1739)



Attitude sensor android vs iphone - Elektron - 04-27-2023

Hello,

I'm absolutely enthousiastic about phyphox and the classroom possibilities it enables! For an astronomy project I would like to help my students to direct their telescopes to the desired direction in the sky. Hence I've put together an experiment that calculates the Right ascension and Declination (coordinates of stars) in the direction the phone is pointing to. It is based on the attitude sensor. However, I need help with two issues:

1) I found documentation about the reference frame and quaternions on android with the result that the experiment is running as expected on most adroid smartphones I have tested. However, many of my students have iphones and it is not giving correct (or even meaningful) coordinates on any of theses phones. I've only found the comment that phyphox adapts the ios coordinates to the android definition. But I haven't found a reference to how this is done in order to systematically test and isolate the problem. Does anybody have experience with this?

2) The calculation of the celestial coordinates is based on time and geographic position. I find it strange, that I can easily retrieve the position from the GPS sensor, but not the time! The user has to enter the time by hand at the time he starts the experiment and then the experiment can calculate the actual time based on that information. I've read several discussions about accessing time from phyphox and lost hope for a simple fix, but if already I post something I thought I could mention this as well...

(it's my first post, I hope I did this in the right way :-) Best regards!


RE: Attitude sensor android vs iphone - Sebastian Staacks - 04-28-2023

Sorry, this is a very short answer because I only have a few minutes right now, but I hope it is a good starting point:

1) Indeed, the coordinate system should be the same on both systems. If it behaves differently I suspect that there might be a bug or some change that we did not notice. Can you try the configuration in this Wiki entry on both phone to see if they match? https://phyphox.org/wiki/index.php/Attitude_sensor
Also, maybe share what you have so far?

2) Phyphox handles everything as a double precision number, so the possible formats to handle time are somewhat limited indeed. If you just want to store the time, can get the current time from the timer-module. By default this only gives seconds since the experiment started, but if you set the attribute "offset1970" you get a Unix timestamp instead (i.e. seconds since 1970).

Are you using the webeditor to create the experiment? If so, please note that the editor is a bit outdated at the moment and we are currently working on an entirely new editor. I think you cannot set the "offset1970" attribute in the old editor and would need to modify the resulting XML file.


RE: Attitude sensor android vs iphone - Elektron - 04-30-2023

Many thanks, I don't think this was a short answer! It already solved issue (2). I was not aware of the timer-module, it  does exactly what I need. With the UT since 1970 I will be able to replace the cumbersome editing of the date by hand and just display date and time automatically.

Issue 1): I don't have an iphone myself and will try in 1-2 weeks when I see my students again. The Wiki entry you are linking to works fine on my android 11. In fact, this file was the starting point for my experiment! At first I tried to import it into the editor, but I was not able to access the attitude sensor from within the editor. Hence I started to look into the file and try to understand with the help of the wiki, what xml and the phyphox file format is and to edit the file by hand. I am attaching what I have so far. Disclaimer: As this is my first xml project, there might be stupid approaches in this unfinished experiment...


RE: Attitude sensor android vs iphone - Sebastian Staacks - 05-03-2023

I knew that this would be good the moment I saw the GPL text at the top Smile

It took quite a while for me to track down the problem, but in the end it is a very simple bug in the iOS version of phyphox: The averaging for the abs (w of the quaternions) channel is broken simply because it does not reset the internal sum for each average. Will be fixed in the next release of phyphox, but for now the only workaround is to disable averaging. If you need the average right now to make the reading more stable, you can record several values into a larger data container (you are already collecting 10 values anyway), put them into the average module (https://phyphox.org/wiki/index.php/Analysis_modules#average) and use its output instead.

Sorry, about that bug. Hope you did not waste too much time on it.


RE: Attitude sensor android vs iphone - Elektron - 05-04-2023

Thank you for your investigation and help, I am glad you could resolve the issue! No, I haven't wasted time on it because I was still occupied working the timer module into the previous version to automatically determine date and time. This seems to work now, I'm attaching the improved version (still with the old averaging though). So I consider both issues solved and will start implementing the averaging by the average module. Many thanks again Smile