Maybe it makes sence to create a german sub forum here? Ich fänd das toll

I do not agree - Ich stimme dem nicht zu.Maybe it makes sence to create a german sub forum here? Ich fänd das toll
I second that. There will always be the an exception made when someone needs help but cannot express in English what their problem is. Helping them with translation is the polite thing to do. But the default language should remain English.
I assume you've seen log_kml.py which logs GPS coordinates in a format which enables the route to be plotted on Google Earth. By default it only logs a point every 10s: you must be one fast rider (or a fighter pilot) to need to log every 10msromeotango wrote: ↑Fri Jan 10, 2020 12:00 pm...My Beginners-Project will be a small tracker for motorcycling. But with a planned frequency of 10!Hz.
I'm still thinking about the storage format to allow the evaluation and storage on SD-Card on the LoPy or similar...
The kml file looks like this>>> Running log_kml-lopy.py
>>>
>>>
None
52.124739
8.638227
>
Pycom MicroPython 1.20.1.r2 [v1.11-06dfad0] on 2019-11-30; LoPy with ESP32
Pybytes Version: 1.3.0
What is my error?<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="yellowPoly">
<LineStyle>
<color>7f00ffff</color>
<width>4</width>
</LineStyle>
<PolyStyle>
<color>7f00ff00</color>
</PolyStyle>
</Style>
<Placemark><styleUrl>#yellowPoly</styleUrl>
<LineString>
<extrude>1</extrude>
<tesselate>1</tesselate>
<altitudeMode>absolute</altitudeMode>
<coordinates>
</coordinates>
</LineString></Placemark>
</Document></kml>
Code: Select all
# log_kml.py Log GPS data to a kml file for display on Google Earth
# Copyright (c) Peter Hinch 2018
# MIT License (MIT) - see LICENSE file
# Test program for asynchronous GPS device driver as_pyGPS
# KML file format: https://developers.google.com/kml/documentation/kml_tut
# http://www.toptechboy.com/arduino/lesson-25-display-your-gps-data-as-track-on-google-earth/
# Logging stops and the file is closed when the keyboard interrupt given.
# Copyright (c) Rainer Treichel
# forked from Peter Hinch log_kml.py
import gc
gc.collect()
import as_GPS
gc.collect()
import uasyncio as asyncio
from machine import UART
gc.collect()
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
import pycom
from micropython import const
str_start = '''<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="yellowPoly">
<LineStyle>
<color>7f00ffff</color>
<width>4</width>
</LineStyle>
<PolyStyle>
<color>7f00ff00</color>
</PolyStyle>
</Style>
<Placemark><styleUrl>#yellowPoly</styleUrl>
<LineString>
<extrude>1</extrude>
<tesselate>1</tesselate>
<altitudeMode>absolute</altitudeMode>
<coordinates>
'''
str_end = '''
</coordinates>
</LineString></Placemark>
</Document></kml>
'''
green = const (0x007f00) # green
yellow = const (0x7f7f00) # yellow
red = const (0x7f0000) # red
blue = const (0x0000ff)
off = const (0x000000)
def led2me():
pycom.heartbeat(False)
def led2pycom():
pycom.heartbeat (True)
def led(colour):
pycom.rgbled (colour)
# Toggle the LED green/blue
def toggle_led():
led(green)
await asyncio.sleep (1)
led(blue)
async def garbage():
gc.collect()
print ("garbage collect")
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
await asyncio.sleep(5)
async def log_kml(fn='/sd/log.kml', interval=1):
led(yellow) # Waiting for data
uart = UART(1, baudrate=9600, pins=('P20','P21'))
print(uart.readline())
sreader = asyncio.StreamReader(uart)
gps = as_GPS.AS_GPS(sreader, fix_cb=toggle_led())
await gps.data_received()# True, True, True, False)
print(gps.latitude_string(as_GPS.KML))
print(gps.longitude_string(as_GPS.KML))
led(blue)
with open(fn, 'w') as f:
f.write(str_start)
while not KeyboardInterrupt:
f.write(gps.longitude_string(as_GPS.KML))
f.write(',')
f.write(gps.latitude_string(as_GPS.KML))
f.write(',')
f.write(str(gps.altitude))
f.write('\r\n')
led(off)
# for _ in range(interval * 10):
await asyncio.sleep_ms(100)
f.write(str_end)
led(off)
led2me()
loop = asyncio.get_event_loop()
loop.run_until_complete(log_kml())
led2pycom()
Code: Select all
while not KeyboardInterrupt:
Code: Select all
while True:
try:
do_your_gps_stuff_here
except KeyboardInterrupt:
break