Closed GregoireH closed 8 years ago
@mdouglas90 Could you have a look please ?
There are 6 methods that can cause the drone to enter critical state:
The issue appears to be related to the position estimation for the z direction. Without calibrating the imu, my z position estimation tended to increase by 300-400 m about ground (which surpasses the 75 m fence_1_z and the 100 m fence_2_z).
I don't know why the imu startup calibration would affect that as I don't believe that the simulated gyroscope uses any of the calibration values.
is the imu healthy ?
I can only find the function Imu::is_ready() which returns if the calibration is ongoing at the moment, not if the imu had a healthy read.
The issue is related to the barometer calibration which occurs during the first barometer read here. For some reason that I don't know why, when I run it, the drone believes that it has an altitude of ~35 m belows the ground (so at 365 m above sea level). This function calls this to set the altitude_biasgf.
During the barometer update function, this variable is then subtracted from the measured value (altitude_filtered) in the barometer_sim::update() function.
When not calibrating the imu on startup, the first cycle of altitude filter is 0, so the bias is set to an addition 365 m off, which gives an altitude much higher than correct. After a cycle or so, the altitude filter would be correctly at 400 m. If the barometer were calibrated then, it would give a better altitude_biasgf.
I assume that the issue does not appear when calibrating the IMU because the barometer already had several cycles to update its altitude_filter before we calibrate the barometer in position estimation. Position estimation will not call its position_correction function (which is where we first calibrate the barometer) until all calibrations are done. See here.
I suppose a possible solution to this would be to ensure that the barometer has had at least one altitude_filtered before allowing calibration.
cyril wanted to write some scripts to start the drone and run a small experiment several times to get statistics.
We found that we had to disable the imu start calibration, https://github.com/lis-epfl/MAVRIC_Library/blob/master/sensing/imu.cpp#L68
But then the drone was getting into critical each time we were arming it.
I figured out that it was coming from the set_fence flag. by commenting out that line, we can operate normally
I guess it is due to some problem between the timing where the origin is initialized