I’m working on a drone and I am using Raspberry Pi 3 with the Navio2 board (Flashed with Stretch).
I will work on ROS and not Ardupilot, and I need the LSM9DS1 and the MPU9250 to work at 100 Hz.
I used the example AcceleroGyroMag from /Navio2/C++/Example but when I print the Raw Data (on screen) or saving it ( in a USB stick on /media/usb), it shows that the magnetometer seems to freeze (as shown in the image below ).
I couldn’t find any info on this particular issue, and I was wondering if it was a problem due to the fact I did not calibrated the MPU9250 (is it possible to calibrate the IMU without Ardupilot ?) or a parameter to change (which i didn’t found).
The MPU9250 info is fetched by the SPi bus but the magnetometer data is coming from the i2c bus, could it be the reason ?
MoreOver I was looking for changing the refresh rate frequency of each IMU (I guess with the SPIdev::transfer function but I’m not sure at all , actually i use a usleep(10000) to get my data at 100Hz )
Thank you in advance,
Sounds like a serious endeavor! We’ll try our best to assist you in this difficult task.
Sure! You can check out different calibration algorithms (soft-iron and hard-iron) and implement them yourself or look up an implementation in ROS.
SPIdev::transfer is not exactly what you’re looking for. It’s the method that is used to access data over SPI. It sets SPI frequency rather than the rate of data acquisition.
usleep sounds more like it.
You can start by using ArduPilot as a proxy that just spits out accel, gyro and mag data to ROS thru mavros. You can check out our docs for more information. After you figure out what’s going on you can look into ArduPilot’s examples for AHRS and put your ROS code in there if you really want to.
Thank you a lot for the information provided, I was still wondering if you knew why I have the magnetometer freezing : when data is printed at 100 Hz, magnetometer value (mx my and mz ) change once for ten data printed (rate between 8 Hz and 10 Hz), and if it was possible to change it in the driver (to have 100 Hz magnetometer).
Thanks a lot,
Problem solved it was in the file MPU9250.cpp in /home/pi/Navio2/C++/Navio/Common
in the initialize() function.
Hello. Please, tell me more about the solution? I also have a frieze magnetrometer.
LSM driver also freeze a magnetrometer values, becuase maximum frequency for him is 80HZ (frequency for accel\gyro in driver is 952HZ). But on 15ms update speed not freezing.
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.