sedgwickc / BBB_LSM303

A C++ driver for the LSM303 accelerometer and magnetometer sensor written for the BeagleBone Black.
3 stars 1 forks source link

error while loading shared libraries: libmraa.so.0 #4

Open munframed opened 8 years ago

munframed commented 8 years ago

Hey! Great work! I've been working on the BBB and 10 DOF sensor the past few weeks but I really like to give your way a try as well. It was a pain to install mraa (took more than a day) and when I finally thought I had it installed successfully, after using make (I'm trying to run the LSM303 application), it generates that LSM303 file, but when I want to run it, it gives me this error:

./LSM303: error while loading shared libraries: libmraa.so.0: cannot open shared object file: No such file or directory

What should I do? The instructions for installing mraa wasn't for Debian, so I did this,

git clone https://github.com/intel-iot-devkit/mraa.git
mkdir mraa/build && cd $_
cmake .. -DBUILDSWIGNODE=OFF
make
make install

and it went through. Any idea what I have possibly done wrong? Thank you!

munframed commented 8 years ago
root@beaglebone:/# find -name libmraa.so.0
./root/git/mraa/build/src/libmraa.so.0
./root/git/BBB_LSM303/mraa/libmraa.so.0
./usr/local/lib/libmraa.so.0

So it's there in the library and I think I have it successfully installed Aren't I?

munframed commented 8 years ago

I copied libmraa.so.0 from /usr/local/lib to /usr/lib and it worked. I can't validate the data it gives me but at least it gives me something :D

-0.500139,-9.89491,10.3166
-1.98094,-5.02101,10.1793
1.29448,0,10.1989

by moving it in X direction. Fluctuating highly in Y, and Z is kinda off. I'll keep working on it but does it seem that it's working correctly?

sedgwickc commented 8 years ago

Thanks for giving the code a try! I'm glad you figured out your linker error. This is where my mraa libraries are installed:

sudo find / -name libmraa.so.0
[sudo] password for cwick:
/usr/local/lib/arm-linux-gnueabihf/libmraa.so.0
/home/cwick/mraa/build/src/libmraa.so.0

I haven't had a chance to validate the data I'm getting from mine yet but I am planning on doing so this weekend. After quickly running the test, I can verify that the X axis seems to be responsive and the Y axis seems erratic. I'll open another issue to address the calibration and validation of the data in the next few days so keep an eye out. If you make progress though feel free to open one yourself and I'll add my findings and expertise.

Out of curiosity, what are you using your Beaglebone and the 10DOF sensor for? I'm using mine for a rover project that I've recently started.

sedgwickc commented 8 years ago

I couldn't leave it be and after having a look I realized why the Y axis was being erratic. I was incorrectly combining the accelerometer register values! :/ Pull the latest code and let me know how it behaves for you. I'll be implementing the retrieval of the magnetometer data this weekend so watch out for those changes!

munframed commented 8 years ago

Cool thanks for your replies! I was so tired yesterday I couldn't even double check the code to see where the problem is with Y, I left the lab right when I got the code to work. I'm trying to read sensors for a GPS/INS probably Kalman filter state estimation to use in a model-based control of a small UAV. Not as cool as a rover, but still! I had the arduino code edited plus Derrek Molloy tutorials and book read, and it was still so painful to get it to work. I knew nothing about mraa it sure makes life easier :D (And of course I want to do it in C++ and not python). I need to investigate mraa more and see if it makes the code lagy or slow since for a UAV control, milliseconds matter. I may go for a code with no linker or as close as possible to the machine lang, but it's gonna be the final steps in this project. Good luck with the rover. P.S. I could add /usr/local/lib to the library path and now I don't need to have libmraa.so.0 it in /usr/lib for the code to work.