GPS location refresh rate extremely low - gps

I'm trying to access GPS data from androidhelper, but the 'location' events come at about 1 minute intervals.
I'm testing in a Motorola e5, with Android 8.
The basic code is:
import androidhelper
droid.androidhelper.Android()
droid.startLocating()
droid.eventWaitFor('location', int(9000))
location = droid.readLocation().result
print(location['gps']['latitude'])
print(location['gps']['longitude'])
droid.stopLocating()
With other apps, the GPS data refresh rate is about 1 second.
Is there any way to improve the refresh rate for androidhelper?

[https://kylelk.github.io/html-examples/androidhelper.html][1]
I think it has to do with the defaults:
startLocating(minDistance=60000,minUpdateDistance=30) Starts collecting location data. minDistance (Integer) minimum time between updates in milliseconds (default=60000) minUpdateDistance (Integer) minimum distance between updates in meters (default=30)
If I reduce them it seems to be much faster.

Related

API occasionally hangs for an amount of time in a narrow range

Trying to connect to the etherscan API to listen for some addresses changing and print the time that the response takes. Doing this in an async loop for 13 addresses.
The code:
url = 'https://api.etherscan.io/api?module=account&action=txlist&address=' + address + '&startblock=0&endblock=99999999&sort=asc&apikey=' + api_token
response = requests.get(url)
print("Response received after this much time: " + str(response.elapsed.total_seconds()))
For the overwhelming majority (98%) of the time, this prints an amount between .64 and .66 seconds.
The problem:
of the 2% of the time its not that delay, 80% of the time its between 1.66 and 1.68 seconds. The remaining 20% of the time, it is either ~3.7, ~5.7, or between 129.8 and 130.2 seconds.
I am mostly just concerned with the rare 130 second delays, and I'm hoping that the strangely consistent delays are a sign of something.
My rate limits are 5/second and 100k/day.
Any way to diagnose why this would be?

React native location tracking without Google API with turf

I was wondering if it is possible to track user location in a React Native application without using Google APIs.
In reality I'm using the Google API, but only to get the current location in this way
Geolocation.getCurrentPosition((position) => {
This function is placed inside a setInterval that every 3 seconds gets the new coordinates. The issue that I'm facing is that if I'm stopped the coordinates can be not precise and I store in the state array a value that will break the distance calculation.
Example of coordinates stored
LOG [17.9443, 40.633]
LOG [17.9443, 40.633]
LOG [17.9442, 40.633]
LOG [17.9442, 40.633]
LOG [17.9443, 40.633]
LOG [17.9443, 40.633]
LOG [17.9443, 40.633]
In this case, despite have being stopped, the calculation would give 16 meters of walk.
How the calculation is made?
I'm using the turf library. I store all points in a state array. Then use the points to generate runtime a turf.lineString and in the end I calculate the length (meters) of the lineString.
setTrackPoints((prevState) => [...prevState, turf.truncate(turf.flip(currentCoordinates),{precision: 4})]);
let lineString = turf.lineString(trackPoints, { name: 'tracked' })
turf.length(lineString, {units: 'meters'}).toFixed(2)
What can be the right way to get rid of dirty data? Reducing the precision to 3 would provide a distance that is not enough precise.

How can I tell how much time I have left in my Google Colaboratory session?

A Google Colab session expires after 12 hours at the longest. For this reason, I don't know whether it's worth starting to train my model or wait until the session has expired to start a brand new session.
Is there a way to know how long my session has been active for, or, equivalently, how much time I have left on my session?
Thanks.
import time, psutil
uptime = time.time() - psutil.boot_time()
remain = 12*60*60 - uptime
Menu -> Runtime -> View runtime logs
Look at the start time (may be on the last page), then add 12 hours.

AnyLogic selectOutput condition

I'm simulation a queuing system where customers join one queue called RDQueue with a capacity of 5, and then moves to a different queue called TDQueue when RDQueue is full (reached the capacity).
I used a selectOutput block with RDQueue on the true branch and TDQueue on the false branch with the condition: RDQueue.size()<5
There should be customers going to TDQueue, but when I run this simulation no customers ever go through the false branch.
(for some reason the image of what I've done won't upload)
I have a source with arrival rate of 0.361 per minute and a delay for RD with a delay time: exponential(8.76) minutes.
According to queuing theory, 68.5% of arrival customers should find RDQueue full and go to TDQueue.
TIA
If your delay time is exponential(8.76) the delay time will always be below the rate in which they are coming:
Random sample from exponential distribution: x = log(1-u)/(−λ)
with λ=8.76 and u as a uniform random number, the expected value of your delay time is 0.114 minutes, so your RDQueue has a probability of being full of nearly 0%

Perf: what do [<n percent>] records mean in perf stat output?

perf stat -e <events> <command> with many different events usually returns an output like this
127.352.815.472 r53003c [23,76%]
65.712.112.871 r53019c [23,81%]
178.027.463.861 r53010e [23,88%]
162.854.142.303 r5302c2 [24,05%]
...
What do the percentage records mean?
The percentages show the percentage of time that the specific event was being measured in the case where perf has to multiplex events. Event multiplexing is explained in more detail on the perf wiki, and I've included a brief quote below:
If there are more events than counters, the kernel uses time
multiplexing (switch frequency = HZ, generally 100 or 1000) to give
each event a chance to access the monitoring hardware. Multiplexing
only applies to PMU events. With multiplexing, an event is not
measured all the time. At the end of the run, the tool scales the
count based on total time enabled vs time running.