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

    pytrack sample code

    Scheduled Pinned Locked Moved Getting Started
    pytrack
    32 Posts 5 Posters 4.1k Views 5 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.
    • A Offline
      abhishek2101 @dan
      last edited by

      @dan
      below is the output i am getting

      (None, None) - (1970, 1, 1, 0, 2, 13, 827831, None) - 2547456

      danD 1 Reply Last reply Reply Quote 0
      • danD Offline
        dan @abhishek2101
        last edited by

        @abhishek2101 for the time, you either have to set it yourself, or sync it with a NTP server (via WiFi or cellular). Are you inside a building? It might take a while (or even fail) to get a location, so I'd recommend trying it outside or near windows

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          abhishek2101 @dan
          last edited by

          @dan
          i am outside on a terrace.

          danD 1 Reply Last reply Reply Quote 0
          • danD Offline
            dan @abhishek2101
            last edited by

            @abhishek2101 it might take some time to find a GPS satellite? If the issue persists, let me know and we'll look into it in detail.

            A 1 Reply Last reply Reply Quote 0
            • catalinC Offline
              catalin
              last edited by

              hi @abhishek2101, it seems you have a GPS problem. I would recommend:

              • leave the pytrack for 30 mins outside, to pick-up the satellites data, as this is a cold-start, could take a while
              • check, with a mobile app, how many satellites are visible on your exact position, it could be a glitch

              Catalin,

              Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
              Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

              1 Reply Last reply Reply Quote 0
              • A Offline
                abhishek2101 @dan
                last edited by

                @dan
                can you let me know what are below lines doing in the code

                l76 = L76GNSS(py, timeout=180)
                chrono = Timer.Chrono()
                chrono.start()
                while (True):
                
                    coord = l76.coordinates()
                    print(coord)
                
                danD 1 Reply Last reply Reply Quote 0
                • danD Offline
                  dan @abhishek2101
                  last edited by

                  @abhishek2101

                  • Set up GPS module
                  • Start measuring timespan (docs) (but I'm not sure why it's there... It was probably left there by mistake, I'll look into that)
                  • Always get coordinates
                  A 1 Reply Last reply Reply Quote 0
                  • A Offline
                    abhishek2101 @dan
                    last edited by

                    @dan
                    timeout=180
                    does this mean that chip will spend 180 sec before locking onto satellites ?

                    danD 1 Reply Last reply Reply Quote 0
                    • danD Offline
                      dan @abhishek2101
                      last edited by

                      @abhishek2101

                      Set the timeout to a time period (in seconds) for the GPS to search for a lock. If a lock is not found by the time the timeout has expired, the coordinates method will return (None, None).

                      docs

                      A 1 Reply Last reply Reply Quote 0
                      • A Offline
                        abhishek2101 @dan
                        last edited by

                        @dan
                        mine is set for 180 seconds, that should be enough time to lock onto satellites, right ?

                        if this time is less, what do you think is the ideal time ?

                        does this mean that every update happens after 180 seconds, or it the first one only ?

                        danD 1 Reply Last reply Reply Quote 0
                        • danD Offline
                          dan @abhishek2101
                          last edited by dan

                          @abhishek2101 It's just the timeout for locking onto a satellite, so if after 180 seconds it doesn't find one, it returns None. In the example, we have 30.

                          It's just for the initialisation. After that, if you have it in a while(True) loop for example, it'll update around every second.

                          A 1 Reply Last reply Reply Quote 0
                          • A Offline
                            abhishek2101 @dan
                            last edited by

                            @dan
                            Mine always return none even after initialising for 300 seconds.

                            Can you help please ?

                            danD 1 Reply Last reply Reply Quote 0
                            • danD Offline
                              dan @abhishek2101
                              last edited by

                              @abhishek2101 have you tried what @catalin recommended?

                              @catalin said in pytrack sample code:

                              hi @abhishek2101, it seems you have a GPS problem. I would recommend:

                              • leave the pytrack for 30 mins outside, to pick-up the satellites data, as this is a cold-start, could take a while
                              • check, with a mobile app, how many satellites are visible on your exact position, it could be a glitch
                              A 1 Reply Last reply Reply Quote 0
                              • A Offline
                                abhishek2101 @dan
                                last edited by

                                @dan
                                I will try and report back.

                                But taking 30 min to lock onto satellites is simply not acceptable. It makes pytrack unusable.

                                danD 1 Reply Last reply Reply Quote 0
                                • danD Offline
                                  dan @abhishek2101
                                  last edited by

                                  @abhishek2101 could you check the GPS coverage at your location? I have tested it here at the office and got the coordinates within a few seconds. I don't think it's a software or hardware issue.

                                  A 3 Replies Last reply Reply Quote 1
                                  • A Offline
                                    abhishek2101 @dan
                                    last edited by

                                    @dan
                                    Google maps on my iPhone shows my location at the same place within few seconds.

                                    J 1 Reply Last reply Reply Quote 0
                                    • A Offline
                                      abhishek2101 @dan
                                      last edited by

                                      @dan
                                      can you share the code you used.

                                      danD 1 Reply Last reply Reply Quote 0
                                      • danD Offline
                                        dan @abhishek2101
                                        last edited by

                                        @abhishek2101 I'm using our Pytrack example: https://github.com/pycom/pycom-libraries/blob/master/pytrack/main.py

                                        1 Reply Last reply Reply Quote 0
                                        • A Offline
                                          abhishek2101 @dan
                                          last edited by

                                          @dan
                                          I am outside with pytrack having access to open sky.

                                          following is the code

                                          from L76GNSS import L76GNSS
                                          from pytrack import Pytrack
                                          py = Pytrack()
                                          l76 = L76GNSS(py, timeout=30)
                                          while (True):
                                          
                                              coord = l76.coordinates()
                                              print(coord)
                                          

                                          still after 20 minutes I only see (none, none).

                                          One only I saw coordinate values but that came in after approx 40 minutes.

                                          How are we suppose to use pytrack if it takes so long to lock onto satellites (that too, not always) or am I missing anything. Please help.

                                          A C 2 Replies Last reply Reply Quote 0
                                          • A Offline
                                            abhishek2101 @abhishek2101
                                            last edited by

                                            @abhishek2101 said in pytrack sample code:

                                            @dan
                                            I am outside with pytrack having access to open sky.

                                            following is the code

                                            from L76GNSS import L76GNSS
                                            from pytrack import Pytrack
                                            py = Pytrack()
                                            l76 = L76GNSS(py, timeout=30)
                                            while (True):
                                            
                                                coord = l76.coordinates()
                                                print(coord)
                                            

                                            still after 20 minutes I only see (none, none).

                                            One only I saw coordinate values but that came in after approx 40 minutes.

                                            How are we suppose to use pytrack if it takes so long to lock onto satellites (that too, not always) or am I missing anything. Please help.

                                            need to fix this asap, can somebody help.

                                            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
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom