can you tell my how to read 2 of SRF08 ?
i think with this function :
Code: Select all
Sonar1 = srf08_ctx.range[0]; // Sonar 1
Sonar2 = srf08_ctx.range[1]; // Sonar 2
is that right ?
Thanks
Code: Select all
Sonar1 = srf08_ctx.range[0]; // Sonar 1
Sonar2 = srf08_ctx.range[1]; // Sonar 2
Tommie wrote:Look at the debug3 label at the bottom of the screen. It should display the distance between sensor and ground.
PonyoFS wrote:Hi,
Do you know what I2c speed is supported by the srf08 ?
Thanks.
Antony.
PonyoFS wrote:I have the solution, on the multiwiicopter board V4r5, HV i2c bus is powered by the esc when you have separated power... Sorry.![]()
But i have another problem, address of the srf08 is fixed on 0xF2 (1 long flash and 9 short flashes) and i don't know why. And nothing happened on the GUI.
Do you have a solution ?
mehranpour wrote:can i running altitude holding just with sonar?
without baro?
mehranpour wrote:can i running altitude holding just with sonar?
without baro?
Code: Select all
i2c_writeReg(SRF08_SENSOR_FIRST, SRF08_LIGHT_GAIN, 0x45); delay(50); // range= 3m
i2c_writeReg(SRF08_SENSOR_FIRST, SRF08_LIGHT_GAIN, 0x18); delay(50); // analogue gain
Code: Select all
EstAlt = (EstAlt * 6 + sonarAlt * 2) >> 3;
farzadsw wrote:mehranpour wrote:can i running altitude holding just with sonar?
without baro?
Yes you can!![]()
I'm using multiwii 2.2 source code, and I just changed a few lines in code to make altitude holding based on a sonar (SRF08) sensor possible.
First of all, you need to get valid data from sonar sensor (SRF08 or 02). Although 2.1 and 2.2 versions of the code have essential routines for SRFx sensors, There are some small mistakes in original source code, see this:
http://www.multiwii.com/forum/viewtopic.php?f=8&t=3212&start=60#p33293
Also, if your sonar sensor (SRF08) is not working as expected in long ranges, you can tune "Range" and "Gain" values to get a valid data. I limited the measurement range to about 3 meters and lowered the gain to ignore weak echoes, by adding two lines to "Sonar_init()" routine:Code: Select all
i2c_writeReg(SRF08_SENSOR_FIRST, SRF08_LIGHT_GAIN, 0x45); delay(50); // range= 3m
i2c_writeReg(SRF08_SENSOR_FIRST, SRF08_LIGHT_GAIN, 0x18); delay(50); // analogue gain
Now you will get valid data. If data is not completely reliable, you cannot use it for altitude hold. By some tuning, both SRF02 and SRF08 sensors will provide you altitude data but compared to SRF02, SRF08 is more robust! for example, my SRF02 sometimes generates random numbers above floors with a carpet on it.
By replacing baro Altitude with sonarAlt in line 284 of IMU library, you will have sonar altitude hold:Code: Select all
EstAlt = (EstAlt * 6 + sonarAlt * 2) >> 3;
good luck
Farzad
Code: Select all
#if(SONAR) // BARO+SONAR Fusion
if(sonarAlt > 0 && f.SMALL_ANGLES_25) { // use sonar only if valid sonar data, and with inclinations below 25 degres
float ratio = (SONAR_BARO_FUSION_HC-sonarAlt)/(SONAR_BARO_FUSION_HC-SONAR_BARO_FUSION_LC); // baro/sonar ratio
ratio = constrain(ratio, 0.0f, 0.90f); // min sonar ratio = 0, max sonar ratio = 0.9
BaroAlt = BaroAlt * (1.0f-ratio) + sonarAlt * ratio;
}
#endif
alt.EstAlt = (alt.EstAlt * 6 + BaroAlt * 2) >> 3; // additional LPF to reduce baro noise (faster by 30 µs)