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

    Data acquisition from WiPy in real time

    Scheduled Pinned Locked Moved WiPy 2&3
    wipy2saving dataesp32realtimememoryerror
    5 Posts 2 Posters 822 Views 2 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.
    • V Offline
      VFlorio94
      last edited by VFlorio94

      Hi, I'm using WiPy 2.0 with an IMU ( BNO055).
      I need to acquire and save my data in real time from TWO IMU. I use a list and at the end of acquisition I save data in a file.txt in the sd card.

      fileIMU1 = open('/sd/dati_IMU1.txt', 'w')
      list_eul = [ ]
      temp = Timer.Chrono()
      temp.start()
      while 1: 
              t = temp.read()
              if  t <= sec :
                  gc.collect()
                  list_eul.append(lib_imu.get_euler_int()
                  fileIMU1.write(repr(temp.read()) + '\t')
                  time.sleep(0.2)
             else:
                  fileIMU1.write( '\n' + repr(list_eul) + '\t')
                  fileIMU1.close()
                  del list_eul
             break
      

      Now data were collected in RAM and so I have an issue of 'Memory allocation' because time of acquisition is long (from 10 s to 60 s).
      Another big problem is that if I use two IMU it don't work at sample rate of 0.2 s but it change and it is about 0.4s. How can I impose a sample of 0.2 s with two IMU ?
      How can I do this in another way?
      Is it better reciving data in real time directly on my pc and then save it in a file?

      M 1 Reply Last reply Reply Quote 0
      • M Offline
        Martinnn @VFlorio94
        last edited by

        @vflorio94 said in Data acquisition from WiPy in real time:

        two IMU it don't work at sample rate of 0.2 s

        Maybe check the interface library. The pysense libraries for example contained some unnecessarily long waits. Check the datasheet.

        V 1 Reply Last reply Reply Quote 0
        • V Offline
          VFlorio94 @Martinnn
          last edited by

          @martinnn I don't use any interface library

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            Martinnn @VFlorio94
            last edited by

            @vflorio94
            Well, where is lib_imu.get_euler_int() coming from?
            Also, where do the 0.4 s come from? Did you do mesurements which part of the code takes how long?

            V 1 Reply Last reply Reply Quote 0
            • V Offline
              VFlorio94 @Martinnn
              last edited by

              @martinnn lib_imu is a library that I wrote and in this function give only data from IMU and there aren't any delay.
              if I wrote data immediately on a file.txt in SD card it employ 0,2 s so the sample became 0,4.
              but if I collect data and insert them in a list to save data at the end of acquisition it gives me the error 'Memory allocation'.

              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