Bug? uiFlow 1.4.5 Stick C IMU ypr[] (getX and getY) values are weird.



  • I tried to get the roll, pitch, and yaw (ypr[]) of Stick-C IMU using uiFlow 1.4.5 (and 1.4.5.1) but the values seemed weird. X( ypr[1]) and Y (ypr[2]) are decreasing from time to time until the variables getting overflowed. I have checked my IMU using C++ (Ardunio IDE) and all were OK.





  • @liemph

    from m5stack import *
    from m5ui import *
    from uiflow import *
    lcd.setRotation(1)
    import imu
    import hat
    
    setScreenColor(0x111111)
    
    hat_bugc0 = hat.get(hat.BUGC)
    
    
    imu0 = imu.IMU()
    label0 = M5TextBox(34, 10, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
    label1 = M5TextBox(35, 33, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
    label2 = M5TextBox(10, 10, "X", lcd.FONT_Default,0xFFFFFF, rotate=0)
    label3 = M5TextBox(9, 34, "Y", lcd.FONT_Default,0xFFFFFF, rotate=0)
    
    raw_x = None
    raw_y = None
    
    
    
    raw_x = 0
    raw_y = 0
    while True:
      raw_x = imu0.ypr[1]
      raw_y = imu0.ypr[2]
      label0.setText(str(raw_x))
      label1.setText(str(raw_y))
      wait(1)
      wait_ms(2)
    


  • @liemph thank you feedback . you could delete wait block to solve it. our engineer will fix it later .



  • Hi, the problem is still there. Removing the wait block kinda of fix it but reading are inconsistent. Any fix?

    Thanks



  • @ipodlux For the time being, I stopped using uiFlow (or Python) for IMU related project. It is not reliable and it is slow. Use Arduino IDE, you will have a much faster code and reliable result.