Data acquisition from WiPy in real time



  • 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?



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



  • @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?



  • @martinnn I don't use any interface library



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



Pycom on Twitter