I'm doing a project with an accelerometer/gyrometer combo and I'm using the great RTIMULib2 library. I know installing it and getting it to even work at all is a common challenge, but I've gotten it working, so that's not my problem.
If I do i2cdetect -y 1
, the sensor shows up in address 68, as it should. When I run this sample script I made (even with no RTIMULib.ini file in the directory I'm running it in), everything works, and I get readings printed out to the screen! Interestingly, if there isn't an RTIMULib.ini file in the dir, it creates one. I did do the basic calibration a while ago, but those files are in the RTIMULib directory, which is in another parent dir, so I think it's just creating a default one.
So I know (a) my wiring is correct, (b) the library is installed correctly, and (c) everything can work.
Now, for my actual application, I want to have everything in a class, so it's neater. So I modified my test script above to just be in a class format, like this. As you can see, it's pretty much the same.
I create the object and try getting a reading like this, in another file:
import RPi.GPIO as GPIO
from Compass import Compass
compass = Compass()
print('Compass object created.')
reading = compass.getReading()
print('compass reading: ', reading)
However, when I run this, without changing anything else, instead of getting any reading, I get:
IMU init successful. poll interval: 4 Compass object created.
So it's init'ing the object, but the reading just hangs there for some reason...
I really have no idea what could be causing this. Does anyone have any ideas? I kinda suspect this might just be a python problem, like the object is getting reset or lost or something? Any tips would be really helpful, thanks!