-
njm
Search for Xcode in the forum.
I used the @Romspy post successfully to publish an app. Check this thread:
https://forum.omz-software.com/topic/5310/when-will-omz-release-an-xcode-template-for-python3 -
njm
@stephen said:
for brush in self.fishingNodes:
from random import choice
x, y = choice(self.fishingSpots)
brush.run_action(Action.move_to(x, y, 5))self.Animate() def Animate(self): scale = move = alpha=[] r = rx = ry = 0 for x in range(100):
@stephen, I'm confused by the indentation and code sequence in this region of class Pond. Maybe the problem is here?
-
njm
@stephen, I replied and then realized I hadn't read your post fully. I then deleted and purged it. Sorry for the confusion. I would code it the some way you did. I do like @mikael 's method, very pythonic. Many thanks to both of you for supporting this wonderful app.
-
njm
@Drizzel, I think the issue is that after starting location updates, it takes some time for it to stabilize. I found that usually after 8 seconds the lat/long readings were no longer jumping around. I initially thought that it might be that your law of cosines equation was not well conditioned so I tried the haversine form and found little difference. Here is my mangle of your code:
gps_logger.py
To show what is going on, change the initial sleep interval to something small like 0.1sec and see just how much it bounces around. -
njm
Thanks @cvp
I gave it a try. Here is a simple comparison of UIDevice.orientation to motion.get_attitude:
facedown.pyThe 6 only comes up when completely upside down. The transition from flat to "vertical" happens near a pitch or roll of 30deg. Still not as reliable as the gravity term and ui.WebView
-
-
njm
As a work around, using the yaw component from motion.get_attitude works. Apple calibrates it with the magnetometer some how. Acceleration, attitude and gravity all seem to be unchanged. The attached code works in both 12.1 and 12.2.
Screenshots in the gist show the magnetometer results for 12.1 at N,E,S and W.
For 12.2 the magnetometer results appear to be random.The device orientation comes from ui.WebView (Thanks @JonB https://forum.omz-software.com/topic/997/get-current-screen-or-orientation-width).
In portrait mode when the screen is held high (or low) enough to be face down, yaw and roll flip 180deg. This can be detected by the sign of a gravity component. The original Swift example (https://medium.com/swiftly-swift/how-to-build-a-compass-app-in-swift-2b6647ae25e8) uses a CoreMotion component not easily obtained by Pythonista to flag a face down orientation.
edit: By face down I mean past vertical. The pitch component must be in the range [+90,-90]
-
njm
Hello everyone. I’m a long time lurker and thanks for all your posts. I’m developing a gps app and it appears motion on iOS 12.2 gives random results. My testflight and Pythonista versions work fine at 12.1. Google helped me find chatter on other sites saying that the privacy settings for motion are now being enforced the way location settings are.
Is anyone else having a problem? Workarounds?