LoPy asynycio as_GPS



  • os.uname()
    (sysname='LoPy', nodename='LoPy', release='1.20.1.r2', version='v1.11-06dfad0 on 2019-11-30', machine='LoPy with ESP32', lorawan='1.0.2', pybytes='1.3.0')

    For a project for motorcyclists I need current GPS data.
    I would like to determine and record data for the simulation during the ride.
    Therefore I found the wonderful libraries of Peter Hinch.
    I use
    uasyncio in the fast_io version
    as_GPS

    os.listdir("as_GPS")
    ['as_GPS.py', 'as_GPS_utils.py', 'as_rwGPS.py']

    asyncio works in simple tests.

    But as_GPS does not want to start:
    I can't find any typos.
    No difference when using the original uasyncio version
    (DeepL helped me to translate)

    (2020, 1, 4, 11, 6, 55, 480879, None)
    Pycom MicroPython 1.20.1.r2 [v1.11-06dfad0] on 2019-11-30; LoPy with ESP32
    Pybytes Version: 1.3.0
    Type "help()" for more information.
    import uasyncio as asyncio
    import as_GPS
    from machine import UART
    uart= UART(1, baudrate=9600, pins=('P20','P21'))
    sreader = asyncio.StreamReader(uart) # Create a StreamReader
    gps = as_GPS.AS_GPS(sreader, fix_cb=callback) # Instantiate GPS
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    AttributeError: 'module' object has no attribute 'AS_GPS'



  • @romeotango Importing as_GPS on a Fipy returns the proper set of class members:

    Pycom MicroPython 1.20.1.r1 [ed31fe1] on 2019-11-16; FiPy with ESP32
    Type "help()" for more information.
    >>> import as_GPS
    >>> dir(as_GPS)
    ['__class__', '__name__', 'const', '__file__', 'LONG', 'modf', 'asyncio', 'DD', 'DMS', 'DM', 'KML', 'KPH', 'MPH', 'KNOT', 'MDY', 'DMY', 'RMC', 'GLL', 'VTG', 'GGA', 'GSA', 'GSV', 'POSITION', 'ALTITUDE', 'DATE', 'COURSE', 'AS_GPS']
    >>> 
    

    You could try to erase your module and make a fresh new start.



  • Hallo,
    i do not think, it is am memory problem.
    I have got some Py's at kickstarter. So I tried a FiPy today.
    See the screenshot:

    import gc
    gc.mem_free()
    2549728
    import uasyncio as asyncio
    gc.mem_free()
    2533104
    import as_GPS
    gc.mem_free()
    2532832
    uart= UART(1, baudrate=9600, pins=('P20','P21'))
    gc.mem_free()
    2532480
    sreader = asyncio.StreamReader(uart)
    gc.mem_free()
    2532256
    gps = as_GPS.AS_GPS(sreader, fix_cb=callback)
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    AttributeError: 'module' object has no attribute 'AS_GPS'
    gc.mem_free()
    2531776



  • @romeotango the original LoPy didn’t have much RAM, so if you are loading lots of scripts and they in turn use quite a bit of memory that may be an issue.



  • Hallo,
    thank you for your answer.
    In the meantime I have performed several complete resets.
    System reloaded with delete.
    The error messages are not very meaningful. And refer once to missing memory, can't allocate.
    I reduced the packages for uasyncio and as_GPS with mpy-cross.
    Then this error does not occur anymore.
    But I still can't get over this point:
    AttributeError: 'module' object has no attribute 'AS_GPS'

    I can't think of any reason for the mistakes, except:
    LoPy is incompatible with these packages.
    Maybe I have to buy a PyBoard and try it on it.
    Have a nice Sunday!



  • @romeotango are you sure the right file is imported? Check via FTP for any other as_gps.py files, for instance.


Log in to reply
 

Pycom on Twitter