hi every body .
i build a sensor board, and used same sensors(except mpu6000, i used 6050) implemented on amp2.5 and try to gather the data from these sensors.
the problem i have is that i think the gathering data from sensors in my board take abnormal time. for example for mpu6050 , gathering gyroscope (reading 6 register from i2c) take about 2.5ms.
after reading all sensor data i can not refresh my sensors data more than 80Hz(gyro,baro,accel,megneto)
what i want is to know amp2.5 how many time in 1 second read data from senors (like gyro)??
and the frequency of control loop ?? what about pixhawk which has 4times faster microcontroller??
the frequency of normal servo motors in 50hz. so is it necessary that we should at least update data in 50hz??
thanks in advance .
The problem with the 6050 is perhaps the I2C connection which is quite slow. That's why we've stuck with the mpu6k on the APM and Pixhawk. I believe some of the later models also have the SPI interface.
I think the APM reads from the mpu6k at 200hz. The pixhawk reads at 1000hz.
It depends on the vehicle, for multicopters, 50hz is far too slow and they simply won't fly. For planes you can probably get away with reading at 100hz, I'm much less sure about 50hz.
my major concern is about fix wing airplane.
recently i could get gyro data in 1.6khz and also same for accel and compass(each one separately) through i2c . if i take all sensors data in about 600hrz (just getting data without controlling loop like simple PID)and with calculation for example for a simple stabilize with PID i hopefully think that i can have controlling loop in 200Hz.
i mean i can refresh my pwm that goes to my servos in 200hz(servos are simple 50hz servos).
because somewhere in this forum i read from one of pixhawk and apm developer that apm controlling loop executes in 100hz and pixhawk 400hz ?
so am i right ??
if i,m right ,so i can't use all of my micro's capability because my micro is same as pixhawk . and i have to review my code seriously .
The arducopter multicopter software runs at 400hz, plane runs at 50hz main loop speed so I think you'll be ok.
Make sure your I2C buss is running at 400Khz. Make sure you request all of the data in a single read sequence. Here's the code from the library I wrote for myself to get data from the MPU6050:
//start transmission to device
// request 14 bytes from device
aXi = Wire.read() 8 | Wire.read();
aYi = Wire.read() 8 | Wire.read();
aZi = Wire.read() 8 | Wire.read();
_tempRaw = Wire.read() 8 | Wire.read();
gXi = Wire.read() 8 | Wire.read();
gYi = Wire.read() 8 | Wire.read();
gZi = Wire.read() 8 | Wire.read();
// send pointer back to the beginning of data, saves time
I just noticed you post indicating that you're controlling a fixed wing aircraft. You probably don't need 400Hz gyro sampling with an airplane, but it won't hurt if you can swing it as it does reduce the error from the constant rotational rate assumption most attitude estimators use.
As a side note, I have used my MPU6050 on a 800kHz I2C buss without issue (and it does save a lot of time), but do so at your own risk as the MPU6050 isn't rated above 400kHz.
thanks phillip and Randy
i found what i needed from your post.