Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoPy asynycio as_GPS

    Scheduled Pinned Locked Moved LoPy
    6 Posts 3 Posters 235 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      romeotango
      last edited by romeotango

      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'

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron @romeotango
        last edited by

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

        1 Reply Last reply Reply Quote 0
        • R Offline
          romeotango
          last edited by

          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!

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jcaron @romeotango
            last edited by

            @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.

            1 Reply Last reply Reply Quote 0
            • R Offline
              romeotango
              last edited by romeotango

              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

              robert-hhR 1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @romeotango
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom